serverspy/src/serverspy.cxx
//------------------------------------------------------------------------------
// This function will parse arguments and will fill this global variables:
// pdf_str - array of paths to PDF files
// prefs_str - the path and name of the PREFS file
// service_str - the visible name of the clients service
// admin_str - the visible name of the administrators service
//------------------------------------------------------------------------------
This function will parse arguments and will fill this global variables:
pdf_str - array of paths to PDF files
prefs_str - the path and name of the PREFS file
service_str - the visible name of the clients service
admin_str - the visible name of the administrators service
This function will parse arguments and will fill this global variables : pdf_str - array of paths to PDF files prefs_str - the path and name of the PREFS file service_str - the visible name of the clients service admin_str - the visible name of the administrators service
int ParseArguments(int argc, char **argv) {
    int i = 1;
    while(i < argc) {
        if(strcmp(argv[i], "help") == 0)  return 0;
        if(strcmp(argv[i], "-help") == 0) return 0;
        if(strcmp(argv[i], "-timeout") == 0 && i + 1 < argc) {
            TimeoutValue = atoi(argv[i+1]);
            i++;
        }
        if(strcmp(argv[i], "-logfile") == 0 && i + 1 < argc) {
            logfile_str = strdup(argv[i+1]);
            i++;
        }
        if(strcmp(argv[i], "-pdf") == 0) {
            while (i+1 < argc) {
                if (*(argv[i+1]) == '-' || strcmp(argv[i+1], "help") == 0) {
                    break;
                }
                else {
                    if (num_pdfs < 1024) {
                        pdf_str[num_pdfs] = strdup(argv[i+1]);
                        num_pdfs++;
                    }
                    i++;
                }
            }
        }
        if(strcmp(argv[i], "-prefs") == 0 && i + 1 < argc) {
            prefs_str = strdup(argv[i+1]);
            i++;
        }
        if(strcmp(argv[i], "-service") == 0 && i + 1 < argc) {
            service_str = strdup(argv[i+1]);
            i++;
        }
        if(strcmp(argv[i], "-admin") == 0 && i + 1 < argc) {
            admin_str = strdup(argv[i+1]);
            i++;
        }
        if(strcmp(argv[i], "-debug") == 0) {
            do_debug = 1;
        }
        i++;
    }
    if(i>1) return 1;
    else return 0;
}
int ParseArguments ( int argc , char * * argv ) { int i = 1 ; while ( i < argc ) { if ( strcmp ( argv [ i ] , " " ) == 0 ) return 0 ; if ( strcmp ( argv [ i ] , " " ) == 0 ) return 0 ; if ( strcmp ( argv [ i ] , " " ) == 0 && i + 1 < argc ) { TimeoutValue = atoi ( argv [ i + 1 ] ) ; i ++ ; } if ( strcmp ( argv [ i ] , " " ) == 0 && i + 1 < argc ) { logfile_str = strdup ( argv [ i + 1 ] ) ; i ++ ; } if ( strcmp ( argv [ i ] , " " ) == 0 ) { while ( i + 1 < argc ) { if ( * ( argv [ i + 1 ] ) == ' ' || strcmp ( argv [ i + 1 ] , " " ) == 0 ) { break ; } else { if ( num_pdfs < 1024 ) { pdf_str [ num_pdfs ] = strdup ( argv [ i + 1 ] ) ; num_pdfs ++ ; } i ++ ; } } } if ( strcmp ( argv [ i ] , " " ) == 0 && i + 1 < argc ) { prefs_str = strdup ( argv [ i + 1 ] ) ; i ++ ; } if ( strcmp ( argv [ i ] , " " ) == 0 && i + 1 < argc ) { service_str = strdup ( argv [ i + 1 ] ) ; i ++ ; } if ( strcmp ( argv [ i ] , " " ) == 0 && i + 1 < argc ) { admin_str = strdup ( argv [ i + 1 ] ) ; i ++ ; } if ( strcmp ( argv [ i ] , " " ) == 0 ) { do_debug = 1 ; } i ++ ; } if ( i > 1 ) return 1 ; else return 0 ; }
This function will parse arguments and will fill this global variables:
pdf_str - array of paths to PDF files
prefs_str - the path and name of the PREFS file
service_str - the visible name of the clients service
admin_str - the visible name of the administrators service
This function will parse arguments and will fill this global variables : pdf_str - array of paths to PDF files prefs_str - the path and name of the PREFS file service_str - the visible name of the clients service admin_str - the visible name of the administrators service