Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 180 of file cmd.c.
Referenced by translate_files().
{ char cmd; char sep = '\n'; char *arg; char *l = Line; int res = 1; int cnt = 0; int changed = 0; l = backSpaceEdit(l); if (l[1] != KDBG_ESC_CHAR) return l[1]; //for reprocessing as not escaped log(outFile, "\n"); l += 2; //skip space+escape character if ( (cnt=sscanf(l,"%c%c",&cmd,&sep)) < 1) { esclog(outFile, "Command expected\n"); res = 0; } if (res && cnt==2 && sep != ' ') { esclog(outFile, "' ' expected\n"); res = 0; } l++; //skip cmd while ( *l == ' ')l++; //skip more spaces arg = l; opt_cli = 1; switch (cmd) { case 'a': handle_address_cmd(outFile, arg); break; case 'h': usage(1); break; case 'b': if (handle_switch(outFile, &opt_buffered, arg, "-b Logfile buffering")) set_LogFile(&logFile); //re-open same logfile break; case 'c': handle_switch(outFile, &opt_console, NULL, "-c Console option"); break; case 'd': handle_switch_str(outFile, opt_dir, NULL, "-d Directory option"); break; case 'l': if (handle_switch_str(outFile, opt_logFile, arg, "-l logfile") || (strcmp(opt_mod,"a")!=0)) { opt_mod = "a"; set_LogFile(&logFile); //open new logfile } break; case 'L': if (handle_switch_str(outFile, opt_logFile, arg, "-L logfile") || (strcmp(opt_mod,"w")!=0)) { opt_mod = "w"; set_LogFile(&logFile); //open new logfile } break; case 'm': handle_switch(outFile, &opt_Mark, arg, "-m mark (*)"); break; case 'M': handle_switch(outFile, &opt_Mark, arg, "-M Mark (?)"); break; case 'P': handle_switch_str(outFile, opt_Pipe, NULL, "-P Pipeline option"); break; case 'q': opt_quit = 1; esclog(outFile, "Bye!\n"); break; case 'r': handle_switch(outFile, &opt_raw, arg, "-r Raw"); break; case 'R': changed = handle_switch_pstr(outFile, &opt_Revision, arg, NULL); opt_Revision_check = 0; if (opt_Revision) { opt_Revision_check = 1; if (strstr(opt_Revision, "check") == opt_Revision) { esclog(outFile, "-R is \"%s\" (%s)\n", opt_Revision, changed ? "changed":"unchanged"); } else if (strstr(opt_Revision, "regscan") == opt_Revision) { char *s = strchr(opt_Revision, ','); revinfo.range = DEF_RANGE; if (s) { *s++ = '\0'; revinfo.range = atoi(s); } regscan(outFile); } else if (strstr(opt_Revision, "regclear") == opt_Revision) { list_clear(&sources); summ.regfound = 0; esclog(outFile, "cleared regression scan results\n"); } } break; case 's': if (strcmp(arg,"clear") == 0) { memset(&summ, 0, sizeof(SUMM)); esclog(outFile, "Statistics cleared\n"); } else stat_print(outFile, &summ); break; case 'S': cnt = sscanf(arg, "%d+%d", &opt_Source, &opt_SrcPlus); if (opt_Source) { handle_switch(outFile, &opt_undo, "1", "-u Undo"); handle_switch(outFile, &opt_redo, "1", "-U Undo and reprocess"); opt_Revision_check = 1; } esclog(outFile, "-S Sources option is %d+%d,\"%s\"\n", opt_Source, opt_SrcPlus, opt_SourcesPath); esclog(outFile, "(Setting source tree not implemented)\n"); break; case 't': handle_switch(outFile, &opt_twice, arg, "-t Translate twice"); break; case 'T': handle_switch(outFile, &opt_twice, arg, NULL); handle_switch(outFile, &opt_Twice, arg, "-T Translate for (address-1)"); break; case 'u': handle_switch(outFile, &opt_undo, arg, "-u undo"); break; case 'U': handle_switch(outFile, &opt_undo, arg, NULL); handle_switch(outFile, &opt_redo, arg, "-U Undo and reprocess"); break; case 'v': handle_switch(outFile, &opt_verbose, arg, "-v Verbosity"); break; case 'z': handle_switch_str(outFile, opt_7z, NULL, "-z 7z path"); break; default: if (strchr(optchars, cmd)) esclog(outFile, "Command not implemented in cli: %c %s\n",cmd, arg) else esclog(outFile, "Unknown command: %c %s\n",cmd, arg); } opt_cli = 0; memset(Line, '\0', LINESIZE); // flushed return KDBG_ESC_CHAR; //handled escaped command }