~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_getopt.c

  • Committer: Brian Aker
  • Date: 2008-07-16 21:28:26 UTC
  • mfrom: (77.3.28 glibclient)
  • Revision ID: brian@tangent.org-20080716212826-p44t3u6v1zb0dmxg
Merge from Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
                   my_get_one_option get_one_option)
111
111
{
112
112
  uint opt_found, argvpos= 0, length;
113
 
  bool end_of_options= 0, must_be_var, set_maximum_value,
 
113
  bool end_of_options= 0, must_be_var, set_maximum_value=false,
114
114
          option_is_loose;
115
115
  char **pos, **pos_end, *optend, *prev_found=NULL,
116
116
       *opt_str, key_name[FN_REFLEN];
264
264
                      disabled_my_option : (char*) "1";
265
265
                    break;
266
266
                  case OPT_MAXIMUM:
267
 
                    set_maximum_value= 1;
268
 
                    must_be_var= 1;
 
267
                    set_maximum_value= true;
 
268
                    must_be_var= true;
269
269
                    break;
270
270
                  }
271
271
                  break; /* break from the inner loop, main loop continues */
489
489
                }
490
490
              }
491
491
              if ((error= setval(optp, optp->value, argument,
492
 
                                 set_maximum_value)))
493
 
              {
 
492
                                 set_maximum_value)))
 
493
              {
494
494
                my_getopt_error_reporter(ERROR_LEVEL,
495
495
                                         "%s: Error while setting value '%s' to '%s'",
496
496
                                         my_progname, argument, optp->name);
497
 
                return error;
498
 
              }
499
 
              get_one_option(optp->id, optp, argument);
500
 
              break;
501
 
            }
502
 
          }
503
 
          if (!opt_found)
504
 
          {
505
 
            if (my_getopt_print_errors)
 
497
                return error;
 
498
              }
 
499
              get_one_option(optp->id, optp, argument);
 
500
              break;
 
501
            }
 
502
          }
 
503
          if (!opt_found)
 
504
          {
 
505
            if (my_getopt_print_errors)
506
506
              my_getopt_error_reporter(ERROR_LEVEL,
507
507
                                       "%s: unknown option '-%c'", 
508
508
                                       my_progname, *optend);
509
 
            return EXIT_UNKNOWN_OPTION;
510
 
          }
511
 
        }
512
 
        (*argc)--; /* option handled (short), decrease argument count */
513
 
        continue;
 
509
            return EXIT_UNKNOWN_OPTION;
 
510
          }
 
511
        }
 
512
        (*argc)--; /* option handled (short), decrease argument count */
 
513
        continue;
514
514
      }
515
515
      if ((error= setval(optp, value, argument, set_maximum_value)))
516
516
      {
517
517
        my_getopt_error_reporter(ERROR_LEVEL,
518
518
                                 "%s: Error while setting value '%s' to '%s'",
519
519
                                 my_progname, argument, optp->name);
520
 
        return error;
 
520
        return error;
521
521
      }
522
522
      get_one_option(optp->id, optp, argument);
523
523
 
586
586
  Will set the option value to given value
587
587
*/
588
588
 
589
 
static int setval(const struct my_option *opts, char* *value, char *argument,
590
 
                  bool set_maximum_value)
 
589
static int setval(const struct my_option *opts, char **value, char *argument,
 
590
                  bool set_maximum_value)
591
591
{
592
592
  int err= 0;
593
593