deps/kb_meme/meme-5.0.1/src/meme2images.c
/**************************************************************************
 * Process the command line arguments and put the results in the
 * options structure.
 **************************************************************************/
Process the command line arguments and put the results in the
options structure.
Process the command line arguments and put the results in the options structure .
void process_arguments(int argc, char **argv, OPTIONS_T *options) {
  int option_index = 1;
  bool bad_argument = false;
  struct option meme2images_options[] = {
    {"motif", required_argument, NULL, 'm'},
    {"eps", no_argument, NULL, 'e'},
    {"png", no_argument, NULL, 'p'},
    {"rc", no_argument, NULL, 'r'},
    {"help", no_argument, NULL, 'h'},
    {NULL, 0, NULL, 0} 
  };
  options->png = false;
  options->eps = false;
  options->rc = false;
  options->dir = NULL;
  options->motifs_file = NULL;
  options->ids = rbtree_create(rbtree_strcmp, NULL, NULL, NULL, NULL);
  while (1) {
    int opt = getopt_long_only(argc, argv, "", meme2images_options, NULL);
    if (opt == -1) break;
    switch (opt) {
      case 'm':    
        rbtree_make(options->ids, optarg, NULL);
        break;
      case 'e':    
        options->eps = true;
        break;
      case 'p':    
        options->png = true;
        break;
      case 'r':    
        options->rc = true;
        break;
      case 'h':           
        usage(NULL);
        break;
      case '?':           
        bad_argument = true;
    }
  }
  if (bad_argument) usage("One or more unknown or ambiguous options were supplied.");
  option_index = optind;
  if (option_index >= argc) usage("No motif file!");
  options->motifs_file = argv[option_index++];
  if (!file_exists(options->motifs_file)) 
    usage("Motif file \"%s\" does not exist!", options->motifs_file);
  if (option_index >= argc) usage("No output directory specified!");
  options->dir = argv[option_index++];
  if (!(options->png || options->eps)) {
    options->png = true;
    options->eps = true;
  }
}
void process_arguments ( int argc , char * * argv , OPTIONS_T * options ) { int option_index = 1 ; bool bad_argument = false ; struct option meme2images_options [ ] = { { " " , required_argument , NULL , ' ' } , { " " , no_argument , NULL , ' ' } , { " " , no_argument , NULL , ' ' } , { " " , no_argument , NULL , ' ' } , { " " , no_argument , NULL , ' ' } , { NULL , 0 , NULL , 0 } } ; options -> png = false ; options -> eps = false ; options -> rc = false ; options -> dir = NULL ; options -> motifs_file = NULL ; options -> ids = rbtree_create ( rbtree_strcmp , NULL , NULL , NULL , NULL ) ; while ( 1 ) { int opt = getopt_long_only ( argc , argv , " " , meme2images_options , NULL ) ; if ( opt == -1 ) break ; switch ( opt ) { case ' ' : rbtree_make ( options -> ids , optarg , NULL ) ; break ; case ' ' : options -> eps = true ; break ; case ' ' : options -> png = true ; break ; case ' ' : options -> rc = true ; break ; case ' ' : usage ( NULL ) ; break ; case ' ' : bad_argument = true ; } } if ( bad_argument ) usage ( " " ) ; option_index = optind ; if ( option_index >= argc ) usage ( " " ) ; options -> motifs_file = argv [ option_index ++ ] ; if ( ! file_exists ( options -> motifs_file ) ) usage ( " \" \" " , options -> motifs_file ) ; if ( option_index >= argc ) usage ( " " ) ; options -> dir = argv [ option_index ++ ] ; if ( ! ( options -> png || options -> eps ) ) { options -> png = true ; options -> eps = true ; } }
Process the command line arguments and put the results in the
 options structure.
Process the command line arguments and put the results in the options structure .
//boundary indicator // set defaults // parse optional arguments //-motif <ID> //-eps //-png //-rc //-help //unrecognised or ambiguous argument // get the motif file // get the output directory // if no option is set then output both png and eps