BOOL LASwriteOpener::parse(int argc, char* argv[]) { int i; for (i = 1; i < argc; i++) { if (argv[i][0] == '\0') { continue; } else if (strcmp(argv[i],"-h") == 0 || strcmp(argv[i],"-help") == 0) { usage(); return TRUE; } else if (strcmp(argv[i],"-o") == 0) { if ((i+1) >= argc) { fprintf(stderr,"ERROR: '%s' needs 1 argument: file_name\n", argv[i]); return FALSE; } set_file_name(argv[i+1]); *argv[i]='\0'; *argv[i+1]='\0'; i+=1; } else if (strcmp(argv[i],"-odir") == 0) { if ((i+1) >= argc) { fprintf(stderr,"ERROR: '%s' needs 1 argument: directory\n", argv[i]); return FALSE; } set_directory(argv[i+1]); *argv[i]='\0'; *argv[i+1]='\0'; i+=1; } else if (strcmp(argv[i],"-odix") == 0) { if ((i+1) >= argc) { fprintf(stderr,"ERROR: '%s' needs 1 argument: appendix\n", argv[i]); return FALSE; } set_appendix(argv[i+1]); *argv[i]='\0'; *argv[i+1]='\0'; i+=1; } else if (strcmp(argv[i],"-ocut") == 0) { if ((i+1) >= argc) { fprintf(stderr,"ERROR: '%s' needs 1 argument: number of characters to cut\n", argv[i]); return FALSE; } set_cut(atoi(argv[i+1])); *argv[i]='\0'; *argv[i+1]='\0'; i+=1; } else if (strcmp(argv[i],"-oforce") == 0) { force = TRUE; *argv[i]='\0'; } else if (strcmp(argv[i],"-olas") == 0) { specified = TRUE; format = LAS_TOOLS_FORMAT_LAS; *argv[i]='\0'; } else if (strcmp(argv[i],"-olaz") == 0) { specified = TRUE; format = LAS_TOOLS_FORMAT_LAZ; *argv[i]='\0'; } else if (strcmp(argv[i],"-otxt") == 0) { specified = TRUE; format = LAS_TOOLS_FORMAT_TXT; *argv[i]='\0'; } else if (strcmp(argv[i],"-obin") == 0) { specified = TRUE; format = LAS_TOOLS_FORMAT_BIN; *argv[i]='\0'; } else if (strcmp(argv[i],"-oqi") == 0) { specified = TRUE; format = LAS_TOOLS_FORMAT_QFIT; *argv[i]='\0'; } else if (strcmp(argv[i],"-owrl") == 0) { specified = TRUE; format = LAS_TOOLS_FORMAT_VRML; *argv[i]='\0'; } else if (strcmp(argv[i],"-stdout") == 0) { use_stdout = TRUE; use_nil = FALSE; *argv[i]='\0'; } else if (strcmp(argv[i],"-nil") == 0) { use_nil = TRUE; use_stdout = FALSE; *argv[i]='\0'; } else if (strcmp(argv[i],"-buffered") == 0) { buffered = TRUE; *argv[i]='\0'; } else if (strcmp(argv[i],"-v1") == 0) { use_v1 = TRUE; use_chunking = FALSE; *argv[i]='\0'; } else if (strcmp(argv[i],"-v2") == 0) { use_v1 = FALSE; use_chunking = TRUE; *argv[i]='\0'; } else if (strcmp(argv[i],"-no_chunk") == 0) { use_chunking = FALSE; *argv[i]='\0'; } else if (strcmp(argv[i],"-chunk") == 0) { use_chunking = TRUE; *argv[i]='\0'; } else if (strcmp(argv[i],"-chunk_size") == 0) { if ((i+1) >= argc) { fprintf(stderr,"ERROR: '%s' needs 1 argument: number_points\n", argv[i]); return FALSE; } use_chunking = TRUE; chunk_size = atoi(argv[i+1]); *argv[i]='\0'; *argv[i+1]='\0'; i+=1; } else if (strcmp(argv[i],"-oparse") == 0) { if ((i+1) >= argc) { fprintf(stderr,"ERROR: '%s' needs 1 argument: string\n", argv[i]); return FALSE; } set_parse_string(argv[i+1]); *argv[i]='\0'; *argv[i+1]='\0'; i+=1; } else if (strcmp(argv[i],"-osep") == 0) { if ((i+1) >= argc) { fprintf(stderr,"ERROR: '%s' needs 1 argument: separator\n", argv[i]); return FALSE; } set_separator(argv[i+1]); *argv[i]='\0'; *argv[i+1]='\0'; i+=1; } else if (strcmp(argv[i],"-oscale_rgb") == 0) { if ((i+1) >= argc) { fprintf(stderr,"ERROR: '%s' needs 1 argument: scale\n", argv[i]); return FALSE; } set_scale_rgb((F32)atof(argv[i+1])); *argv[i]='\0'; *argv[i+1]='\0'; i+=1; } else if (strcmp(argv[i],"-opts") == 0) { opts = TRUE; *argv[i]='\0'; } else if (strcmp(argv[i],"-optx") == 0) { optx = TRUE; *argv[i]='\0'; } } return TRUE; }
BOOL PULSEwriteOpener::parse(int argc, char* argv[]) { int i; for (i = 1; i < argc; i++) { if (argv[i][0] == '\0') { continue; } else if (strcmp(argv[i],"-h") == 0 || strcmp(argv[i],"-help") == 0) { usage(); return TRUE; } else if (strcmp(argv[i],"-o") == 0) { if ((i+1) >= argc) { fprintf(stderr,"ERROR: '%s' needs 1 argument: file_name\n", argv[i]); return FALSE; } set_file_name(argv[i+1]); *argv[i]='\0'; *argv[i+1]='\0'; i+=1; } else if (strcmp(argv[i],"-odir") == 0) { if ((i+1) >= argc) { fprintf(stderr,"ERROR: '%s' needs 1 argument: directory\n", argv[i]); return FALSE; } set_directory(argv[i+1]); *argv[i]='\0'; *argv[i+1]='\0'; i+=1; } else if (strcmp(argv[i],"-odix") == 0) { if ((i+1) >= argc) { fprintf(stderr,"ERROR: '%s' needs 1 argument: appendix\n", argv[i]); return FALSE; } set_appendix(argv[i+1]); *argv[i]='\0'; *argv[i+1]='\0'; i+=1; } else if (strcmp(argv[i],"-opls") == 0) { format = PULSEWAVES_FORMAT_PLS; *argv[i]='\0'; } else if (strcmp(argv[i],"-otxt") == 0) { format = PULSEWAVES_FORMAT_TXT; *argv[i]='\0'; } else if (strcmp(argv[i],"-oplz") == 0) { format = PULSEWAVES_FORMAT_PLZ; compress_waves = TRUE; *argv[i]='\0'; } else if (strcmp(argv[i],"-owvz") == 0) { compress_waves = TRUE; *argv[i]='\0'; } else if (strcmp(argv[i],"-stdout") == 0) { use_stdout = TRUE; use_nil = FALSE; *argv[i]='\0'; } else if (strcmp(argv[i],"-nil") == 0) { use_nil = TRUE; use_stdout = FALSE; *argv[i]='\0'; } else if (strcmp(argv[i],"-oparse") == 0) { if ((i+1) >= argc) { fprintf(stderr,"ERROR: '%s' needs 1 argument: string\n", argv[i]); return FALSE; } set_parse_string(argv[i+1]); *argv[i]='\0'; *argv[i+1]='\0'; i+=1; } else if (strcmp(argv[i],"-sep") == 0) { if ((i+1) >= argc) { fprintf(stderr,"ERROR: '%s' needs 1 argument: separator\n", argv[i]); return FALSE; } set_separator(argv[i+1]); *argv[i]='\0'; *argv[i+1]='\0'; i+=1; } } return TRUE; }