Commits

Jian Zhou  committed 102613d

fix cmdlines

  • Participants
  • Parent commits 0b706ae

Comments (0)

Files changed (2)

File tools/Counter/cmdline.c

 /*
   File autogenerated by gengetopt version 2.22
   generated with the following command:
-  /Genomics/grid/users/jzthree/bin/gengetopt 
+  /Genomics/grid/users/jzthree/bin/gengetopt --default-optional -u -N -e 
 
   The developers of gengetopt consider the fixed text that goes in all
   gengetopt output files to be in the public domain:
 
 const char *gengetopt_args_info_purpose = "Pre-Bayesian learning tool; counts distributions of values in data";
 
-const char *gengetopt_args_info_usage = "Usage: Counter [OPTIONS]...";
+const char *gengetopt_args_info_usage = "Usage: Counter [OPTIONS]... [FILES]...";
 
 const char *gengetopt_args_info_description = "";
 
   clear_given (args_info);
   clear_args (args_info);
   init_args_info (args_info);
+
+  args_info->inputs = NULL;
+  args_info->inputs_num = 0;
 }
 
 void
 static void
 cmdline_parser_release (struct gengetopt_args_info *args_info)
 {
-
+  unsigned int i;
   free_string_field (&(args_info->answers_arg));
   free_string_field (&(args_info->answers_orig));
   free_string_field (&(args_info->counts_arg));
   free_string_field (&(args_info->verbosity_orig));
   
   
+  for (i = 0; i < args_info->inputs_num; ++i)
+    free (args_info->inputs [i]);
+
+  if (args_info->inputs_num)
+    free (args_info->inputs);
 
   clear_given (args_info);
 }
   int result;
   result = cmdline_parser_internal (argc, argv, args_info, params, NULL);
 
-  if (result == EXIT_FAILURE)
-    {
-      cmdline_parser_free (args_info);
-      exit (EXIT_FAILURE);
-    }
-  
   return result;
 }
 
 
   result = cmdline_parser_internal (argc, argv, args_info, &params, NULL);
 
-  if (result == EXIT_FAILURE)
-    {
-      cmdline_parser_free (args_info);
-      exit (EXIT_FAILURE);
-    }
-  
   return result;
 }
 
   if (cmdline_parser_required2(args_info, prog_name, NULL) > 0)
     result = EXIT_FAILURE;
 
-  if (result == EXIT_FAILURE)
-    {
-      cmdline_parser_free (args_info);
-      exit (EXIT_FAILURE);
-    }
-  
   return result;
 }
 
       error = 1;
     }
   
-  if (! args_info->countname_given)
-    {
-      fprintf (stderr, "%s: '--countname' ('-O') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->directory_given)
-    {
-      fprintf (stderr, "%s: '--directory' ('-d') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->datasets_given)
-    {
-      fprintf (stderr, "%s: '--datasets' ('-s') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->genome_given)
-    {
-      fprintf (stderr, "%s: '--genome' ('-e') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->contexts_given)
-    {
-      fprintf (stderr, "%s: '--contexts' ('-X') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->genes_given)
-    {
-      fprintf (stderr, "%s: '--genes' ('-g') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->genex_given)
-    {
-      fprintf (stderr, "%s: '--genex' ('-G') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->ubiqg_given)
-    {
-      fprintf (stderr, "%s: '--ubiqg' ('-P') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->genet_given)
-    {
-      fprintf (stderr, "%s: '--genet' ('-c') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->genee_given)
-    {
-      fprintf (stderr, "%s: '--genee' ('-C') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->default_given)
-    {
-      fprintf (stderr, "%s: '--default' ('-b') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->zeros_given)
-    {
-      fprintf (stderr, "%s: '--zeros' ('-Z') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->pseudocounts_given)
-    {
-      fprintf (stderr, "%s: '--pseudocounts' ('-p') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->alphas_given)
-    {
-      fprintf (stderr, "%s: '--alphas' ('-a') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->reggroups_given)
-    {
-      fprintf (stderr, "%s: '--reggroups' ('-R') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->temporary_given)
-    {
-      fprintf (stderr, "%s: '--temporary' ('-y') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->threads_given)
-    {
-      fprintf (stderr, "%s: '--threads' ('-t') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
-  if (! args_info->verbosity_given)
-    {
-      fprintf (stderr, "%s: '--verbosity' ('-v') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
-    }
-  
   if (args_info->Mode_group_counter == 0)
     {
       fprintf (stderr, "%s: %d options of group Mode were given. One is required.%s\n", prog_name, args_info->Mode_group_counter, (additional_error ? additional_error : ""));
           exit (EXIT_SUCCESS);
 
         case 'V':	/* Print version and exit.  */
-          cmdline_parser_print_version ();
+        
+        
+          if (update_arg( 0 , 
+               0 , &(args_info->version_given),
+              &(local_args_info.version_given), optarg, 0, 0, ARG_NO,
+              check_ambiguity, override, 0, 0,
+              "version", 'V',
+              additional_error))
+            goto failure;
           cmdline_parser_free (&local_args_info);
-          exit (EXIT_SUCCESS);
-
+          return 0;
+        
+          break;
         case 'w':	/* Answer file (-w triggers counts mode).  */
         
           if (args_info->Mode_group_counter && override)
   if ( error )
     return (EXIT_FAILURE);
 
+  if (optind < argc)
+    {
+      int i = 0 ;
+      int found_prog_name = 0;
+      /* whether program name, i.e., argv[0], is in the remaining args
+         (this may happen with some implementations of getopt,
+          but surely not with the one included by gengetopt) */
+
+      i = optind;
+      while (i < argc)
+        if (argv[i++] == argv[0]) {
+          found_prog_name = 1;
+          break;
+        }
+      i = 0;
+
+      args_info->inputs_num = argc - optind - found_prog_name;
+      args_info->inputs =
+        (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
+      while (optind < argc)
+        if (argv[optind++] != argv[0])
+          args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ;
+    }
+
   return 0;
 
 failure:

File tools/Counter/cmdline.h

   unsigned int verbosity_given ;	/**< @brief Whether verbosity was given.  */
   unsigned int logratio_given ;	/**< @brief Whether logratio was given.  */
 
+  char **inputs ; /**< @brief unamed options (options without names) */
+  unsigned inputs_num ; /**< @brief unamed options number */
   int Mode_group_counter; /**< @brief Counter for group Mode */
 } ;