Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 0.49 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. void commandArrange(char* command) {
  2.  
  3.         char* commandComplete = malloc(sizeof(MAX_LEN));
  4.         char* tmp = malloc(sizeof(MAX_LEN));
  5.         tmp = strtok(command," \t"); // devide to tokens, remove spaces/tabs
  6.         if (tmp[0] == '#' || tmp == NULL) {
  7.                 return;
  8.         }
  9.  
  10.         strcpy(commandComplete,tmp);
  11.  
  12.         while (tmp != NULL) {
  13.                 strcat(commandComplete," ");
  14.                 tmp = strtok(NULL," \t");
  15.                 if (tmp != NULL) {
  16.                         strcat(commandComplete,tmp);
  17.                 }
  18.         }
  19.  
  20.         commandAnalyzeAndExecute(commandComplete);
  21.         free(tmp);
  22. }