ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

char handle_escape_cmd ( FILE outFile,
char Line,
char path,
char LineOut 
)

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
}

Generated on Sun May 27 2012 04:45:41 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.