X-Git-Url: http://gitweb.hachti.de/?a=blobdiff_plain;f=pc-tools%2Fldc2%2Fsrc%2Fconfig.cpp;h=337fe2b29da01adad5a2b10a67814900f3555b14;hb=ea78fc91fca804d41e7caf94025a4616e4f2daad;hp=974fc91581d90f70b9036c1f5e74426f0ead1014;hpb=7880ae2dd0ed55ec671be0fc449487420a126626;p=h316.git diff --git a/pc-tools/ldc2/src/config.cpp b/pc-tools/ldc2/src/config.cpp index 974fc91..337fe2b 100644 --- a/pc-tools/ldc2/src/config.cpp +++ b/pc-tools/ldc2/src/config.cpp @@ -1,3 +1,17 @@ +/****************************************************************************** + * + * LDC2 source code + * + * $Date: 2007/03/26 01:00:38 $ + * $Author: hachti $ + * + * $Log: config.cpp,v $ + * Revision 2.0 2007/03/26 01:00:38 hachti + * *** empty log message *** + * + * + ******************************************************************************/ + /* * Program configuration management */ @@ -26,21 +40,23 @@ int cfg_output_info=0; int cfg_output_called=0; int cfg_output_exported=0; int cfg_output_unsatisfied=0; -int cfg_splitobjects=0; -int cfg_splitobjects_numbered=0; +int cfg_split_objects=0; +int cfg_split_objects_numbered=0; +int cfg_split_blocks=0; int cfg_ignore_block_errors=0; int cfg_ignore_checksum_errors=0; -int cfg_pause_on_checksum_error=0; +//int cfg_pause_on_checksum_error=0; int cfg_ignore_unknown_block_errors=0; int cfg_ignore_object_integrity_errors=0; int cfg_list_contents=1; int cfg_verbose=0; +int cfg_quiet=0; + int cfg_version=0; int in_fd=0; //! File descriptor for data input int out_fd=1; //! File descriptor for text output - void do_config(int argc, char ** args){ string cfg_config_file; @@ -67,14 +83,18 @@ void do_config(int argc, char ** args){ "List all unsatisfied symbols.", &cfg_output_unsatisfied,true,true); - ar.add_option_switch("S","split_objects_numbered", - "Split input data into distinct numbered files", - &cfg_splitobjects_numbered,true,true); - ar.add_option_switch("s","split_objects", "Split input data into distinct object files.", - &cfg_splitobjects,true,true); + &cfg_split_objects,true,true); + ar.add_option_switch("S","split_objects_numbered", + "Split input data into distinct numbered files", + &cfg_split_objects_numbered,true,true); + + ar.add_option_switch("B","split_blocks", + "Split tape into named and numbered block files", + &cfg_split_blocks,true,true); + ar.add_option_switch("b","ignore_block_errors", "Ignore block integrity errors. This will output broken blocks,too", &cfg_ignore_block_errors,true,true); @@ -83,9 +103,9 @@ void do_config(int argc, char ** args){ "Ignore block checksum errors. Errors will be converted to warnings.", &cfg_ignore_checksum_errors,true,true); - ar.add_option_switch("p","pause_on_checksum_error", - "Wait for user input on checksum error.", - &cfg_pause_on_checksum_error,true,true); +// ar.add_option_switch("p","pause_on_checksum_error", +// "Wait for user input on checksum error.", +// &cfg_pause_on_checksum_error,true,true); ar.add_option_switch("n","ignore_unknown_block_errors", "Ignore errors caused by unknown block types. Errors will be converted to warnings.", @@ -97,9 +117,13 @@ Errors will be converted to warnings.", &cfg_ignore_object_integrity_errors,true,true); ar.add_option_switch("v","verbose", - "Be a bit more verbose.", + "Be a bit more verbose. This overrides -q.", &cfg_verbose,true,true); + ar.add_option_switch("q","quiet", + "Be quiet. All warning messages are suppressed.", + &cfg_quiet,true,true); + ar.add_option_switch("V","version", "Output version information and exit.", &cfg_version,false,true); @@ -131,21 +155,21 @@ Errors will be converted to warnings.", // If there's a config file mentioned in the environment, take it! char * env_ldc_config=getenv("LDC_CONFIG"); if(env_ldc_config){ - fprintf(stderr,"Using config file: \"%s\"\n",env_ldc_config); - if(dump_vector_err(ar.read_file(env_ldc_config))){ - dump_vector_err(ar.get_help()); + if (cfg_verbose) fprintf(stderr,"Using config file: \"%s\"\n",env_ldc_config); + if(dump_vector_fp(ar.read_file(env_ldc_config),stderr)){ + dump_vector_fp(ar.get_help(),stderr); exit(1); } } // Process command line first time - if(dump_vector_err(ar.read_args(argc,args))){ - dump_vector_err(ar.get_help()); + if(dump_vector_fp(ar.read_args(argc,args),stderr)){ + dump_vector_fp(ar.get_help(),stderr); exit(7); } if (cfg_do_help) { - dump_vector_err(ar.get_help()); + dump_vector_fp(ar.get_help(),stderr); exit(0); } @@ -153,14 +177,14 @@ Errors will be converted to warnings.", if (cfg_config_file_set){ if (cfg_verbose) fprintf(stderr,"Using config file: \"%s\"\n",cfg_config_file.c_str()); - if(dump_vector_err(ar.read_file(cfg_config_file))){ - dump_vector_err(ar.get_help()); + if(dump_vector_fp(ar.read_file(cfg_config_file),stderr)){ + dump_vector_fp(ar.get_help(),stderr); exit(7); } // Process command line a second time to override values from config file. - if(dump_vector_err(ar.read_args(argc,args))||cfg_do_help){ - dump_vector_err(ar.get_help()); + if(dump_vector_fp(ar.read_args(argc,args),stderr)||cfg_do_help){ + dump_vector_fp(ar.get_help(),stderr); exit(7); } } @@ -187,12 +211,15 @@ Errors will be converted to warnings.", } } + // Verbose overrides quiet: + if (cfg_verbose)cfg_quiet=0; + // The configuration implications according to /cfg007/ - if (in_fd==0) cfg_pause_on_checksum_error=0; - if (cfg_pause_on_checksum_error==1) cfg_ignore_checksum_errors=1; + // if (in_fd==0) cfg_pause_on_checksum_error=0; + // if (cfg_pause_on_checksum_error==1) cfg_ignore_checksum_errors=1; - if (cfg_output_info||cfg_output_called||cfg_output_exported||cfg_output_unsatisfied) - cfg_list_contents=0; + if (cfg_output_info||cfg_output_called||cfg_output_exported|| + cfg_output_unsatisfied) cfg_list_contents=0; }