- int help_needed;
- int name_set;
- int file_set;
- string name="Philipp";
- string filename;
-
- argument_reader ar("ldc2");
- ar.add_param("h","help","Give help",&help_needed);
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name Gelaber Gelaber Gelaber Gelaber M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
- ar.add_argument("<input-blaaaaaaaaaaaaaaa-filename>","File to read data from",&file_set,&filename);
-
- dump_vector(ar.read_args(argc,args));
-
- if (help_needed){
+
+ /* Configuration data */
+ string config_file;
+ string infile, outfile;
+ int infile_set=0, outfile_set=0, config_file_set=0;
+
+ int
+ do_help=0,
+ output_info=0,
+ output_called=0,
+ output_exported=0,
+ output_unsatisfied=0,
+ split_objects=0,
+ split_objects_numbered=0,
+ ignore_block_errors=0,
+ ignore_checksum_errors=0,
+ pause_on_checksum_error=0,
+ ignore_unknown_block_errors=0,
+ ignore_object_integrity_errors=0,
+ list_contents=1,
+ verbose=0;
+
+ in_fd=0; /* stdin {O _ \ */
+ out_fd=1; /* stdout {O ^ / */
+
+ configuration_manager ar("ldc2");
+
+ /* Here come the configuration switches */
+ ar.add_option_switch("h","help",
+ "Output this help text and exit.",
+ &do_help,false,true);
+
+ ar.add_option_switch("a","output_info",
+ "Print tape data information (default)",
+ &output_info,true,true);
+
+ ar.add_option_switch("c","output_called",
+ "Print all called symbols from the object(s).",
+ &output_called,true,true);
+
+ ar.add_option_switch("e","output_exported",
+ "Print all exported symbols from the object(s).",
+ &output_exported,true,true);
+
+ ar.add_option_switch("u","output_unsatisfied",
+ "List all unsatisfied symbols.",
+ &output_unsatisfied,true,true);
+
+ ar.add_option_switch("S","split_objects_numbered",
+ "Split input data into distinct numbered files",
+ &split_objects_numbered,true,true);
+
+ ar.add_option_switch("s","split_objects",
+ "Split input data into distinct object files.",
+ &split_objects,true,true);
+
+ ar.add_option_switch("b","ignore_block_errors",
+ "Ignore block integrity errors. This will output broken blocks,too",
+ &ignore_block_errors,true,true);
+
+ ar.add_option_switch("k","ignore_checksum_errors",
+ "Ignore block checksum errors. Errors will be converted to warnings.",
+ &ignore_checksum_errors,true,true);
+
+ ar.add_option_switch("p","pause_on_checksum_error",
+ "Wait for user input on checksum error.",
+ &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.",
+ &ignore_unknown_block_errors,true,true);
+
+ ar.add_option_switch("g","ignore_object_integrity_errors",
+ "Ignore errors caused by objects without proper end block. \
+Errors will be converted to warnings.",
+ &ignore_object_integrity_errors,true,true);
+
+ ar.add_option_switch("v","verbose",
+ "Be a bit more verbose.",
+ &verbose,true,true);
+
+ ar.add_option_value("i","in_file",
+ "specify input file",
+ &infile_set,&infile,
+ "<input-file>",true,false);
+
+ ar.add_option_value("o","out_file",
+ "Specify output file.",
+ &outfile_set,&outfile,
+ "<output_file>",true,true);
+
+ ar.add_argument("File from where data is read",
+ &infile_set,&infile,
+ "<input-file>");
+
+ ar.add_argument("File to where output is redirected",
+ &outfile_set,&outfile,
+ "<output-file>");
+
+ ar.add_option_value("F","config_file",
+ "Use the specified configuration file.",
+ &config_file_set,&config_file,
+ "<file-name>",false,true);
+
+
+ // 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(ar.read_file(env_ldc_config))){
+ dump_vector(ar.get_help());
+ exit(1);
+ }
+ }
+
+ // Process command line first time
+ if(dump_vector(ar.read_args(argc,args))){
+ dump_vector(ar.get_help());
+ exit(7);
+ }
+
+ if (do_help) {