Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by regularlambda ( 15 years ago )
void init_shell(irecv_client_t client) {
 irecv_error_t error = 0;
 load_command_history();
 irecv_event_subscribe(client, IRECV_PROGRESS, &progress;_cb, NULL);
 irecv_event_subscribe(client, IRECV_RECEIVED, &received;_cb, NULL);
 irecv_event_subscribe(client, IRECV_PRECOMMAND, &precommand;_cb, NULL);
 irecv_event_subscribe(client, IRECV_POSTCOMMAND, &postcommand;_cb, NULL);
 while (!quit) {
  error = irecv_receive(client);

  if (error != IRECV_E_SUCCESS) {
   debug("%s\n", irecv_strerror(error));
   break;
  }

  char* cmd = readline("> ");
  if (cmd && *cmd) {
   error = irecv_send_command(client, cmd);
   if (error != IRECV_E_SUCCESS) {
    quit = 1;
   }

   append_command_to_history(cmd);
   free(cmd);
  }
 }
}

 

Revise this Paste

Your Name: Code Language: