]> Creatis software - creaImageIO.git/blobdiff - appli/gimmick/gimmick_ggo.c
*** empty log message ***
[creaImageIO.git] / appli / gimmick / gimmick_ggo.c
index 6f5e74da593d2da70e578e55f9a6067115d61a60..72e99f47bb23d07fcd6f426582121dd9c60c766e 100644 (file)
@@ -37,6 +37,7 @@ const char *gengetopt_args_info_help[] = {
   "  -r, --recurse           Recurse into sub-directories  (default=off)",
   "\nOPTIONS:",
   "  -v, --verbose=INT       Verbosity level  (default=`1')",
+  "  -D, --debug=INT         Debug messages level  (default=`0')",
     0
 };
 
@@ -95,6 +96,7 @@ void clear_given (struct gengetopt_args_info *args_info)
   args_info->dir_given = 0 ;
   args_info->recurse_given = 0 ;
   args_info->verbose_given = 0 ;
+  args_info->debug_given = 0 ;
 }
 
 static
@@ -108,6 +110,8 @@ void clear_args (struct gengetopt_args_info *args_info)
   args_info->recurse_flag = 0;
   args_info->verbose_arg = 1;
   args_info->verbose_orig = NULL;
+  args_info->debug_arg = 0;
+  args_info->debug_orig = NULL;
   
 }
 
@@ -123,6 +127,7 @@ void init_args_info(struct gengetopt_args_info *args_info)
   args_info->dir_help = gengetopt_args_info_help[5] ;
   args_info->recurse_help = gengetopt_args_info_help[6] ;
   args_info->verbose_help = gengetopt_args_info_help[8] ;
+  args_info->debug_help = gengetopt_args_info_help[9] ;
   
 }
 
@@ -209,6 +214,7 @@ cmdline_parser_release (struct gengetopt_args_info *args_info)
   free_string_field (&(args_info->dir_arg));
   free_string_field (&(args_info->dir_orig));
   free_string_field (&(args_info->verbose_orig));
+  free_string_field (&(args_info->debug_orig));
   
   
   for (i = 0; i < args_info->inputs_num; ++i)
@@ -257,6 +263,8 @@ cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
     write_into_file(outfile, "recurse", 0, 0 );
   if (args_info->verbose_given)
     write_into_file(outfile, "verbose", args_info->verbose_orig, 0);
+  if (args_info->debug_given)
+    write_into_file(outfile, "debug", args_info->debug_orig, 0);
   
 
   i = EXIT_SUCCESS;
@@ -540,10 +548,11 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
         { "dir",       1, NULL, 'd' },
         { "recurse",   0, NULL, 'r' },
         { "verbose",   1, NULL, 'v' },
+        { "debug",     1, NULL, 'D' },
         { NULL,        0, NULL, 0 }
       };
 
-      c = getopt_long (argc, argv, "hVpf:d:rv:", long_options, &option_index);
+      c = getopt_long (argc, argv, "hVpf:d:rv:D:", long_options, &option_index);
 
       if (c == -1) break;      /* Exit from `while (1)' loop.  */
 
@@ -615,6 +624,18 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
             goto failure;
         
           break;
+        case 'D':      /* Debug messages level.  */
+        
+        
+          if (update_arg( (void *)&(args_info->debug_arg), 
+               &(args_info->debug_orig), &(args_info->debug_given),
+              &(local_args_info.debug_given), optarg, 0, "0", ARG_INT,
+              check_ambiguity, override, 0, 0,
+              "debug", 'D',
+              additional_error))
+            goto failure;
+        
+          break;
 
         case 0:        /* Long option with no short option */
         case '?':      /* Invalid option.  */