12,29d11 < // Thanks to http://www.linuxquestions.org/questions/programming-9/replace-a-substring-with-another-string-in-c-170076/ < char *replace_str(char *str, char *orig, char *rep) { < static char buffer[4096]; < char *p; < < if(!(p = strstr(str, orig))) { // Is 'orig' even in 'str'? < return str; < } < < strncpy(buffer, str, p-str); // Copy characters from 'str' start to 'orig' st$ < buffer[p-str] = '\0'; < < sprintf(buffer+(p-str), "%s%s", rep, p+strlen(orig)); < < return buffer; < } < < 49c31 < char msg[201]="Please use use_qsort.exe [[/reverse] [/numerical] [/prompt_or_readfile]] [[sortingarg1] [sortingarg2] ... ]\0", sentry[201], entry[201]="x\0", cmd[20001]="use_qsort.exe \0"; --- > char msg[201]="Please use use_qsort.exe [[/reverse] [/numerical] [/prompt_or_readfile]] [[sortingarg1] [sortingarg2] ... ]\0", entry[201]="x\0", cmd[20001]="use_qsort.exe \0"; 86,89d67 < while (strstr(entry, "\n")) { strcpy(sentry, replace_str(entry, "\n", " ")); strcpy(entry, sentry); } < while (strstr(entry, "<")) { strcpy(sentry, replace_str(entry, "<", "%3c")); strcpy(entry, sentry); } < while (strstr(entry, ">")) { strcpy(sentry, replace_str(entry, ">", "%3e")); strcpy(entry, sentry); } < while (strstr(entry, " ")) { strcpy(sentry, replace_str(entry, " ", "%20")); strcpy(entry, sentry); } 94d71 < //printf("%s\n", cmd);