~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_getopt.c

  • Committer: Brian Aker
  • Date: 2008-08-09 21:43:24 UTC
  • mfrom: (279.1.4 codestyle)
  • Revision ID: brian@tangent.org-20080809214324-jy2c15bx49naddsf
Merge from Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
203
203
          }
204
204
        }
205
205
        opt_str= check_struct_option(cur_arg, key_name);
206
 
        optend= strcend(opt_str, '=');
207
 
        length= (uint) (optend - opt_str);
208
 
        if (*optend == '=')
 
206
        optend= strrchr(opt_str, '=');
 
207
        if (optend != NULL)
 
208
        {
 
209
          length= (uint) (optend - opt_str);
209
210
          optend++;
 
211
        }
210
212
        else
 
213
        {
 
214
          length= strlen(opt_str);
211
215
          optend= 0;
 
216
        }
212
217
 
213
218
        /*
214
219
          Find first the right option. Return error in case of an ambiguous,
557
562
{
558
563
  char *ptr, *end;
559
564
 
560
 
  ptr= strcend(cur_arg + 1, '.'); /* Skip the first character */
561
 
  end= strcend(cur_arg, '=');
 
565
  ptr= strrchr(cur_arg + 1, '.'); /* Skip the first character */
 
566
  end= strrchr(cur_arg, '=');
562
567
 
563
568
  /* 
564
569
     If the first dot is after an equal sign, then it is part
567
572
     NULL, or the character right before equal sign is the first
568
573
     dot found, the option is not a struct option.
569
574
  */
570
 
  if (end - ptr > 1)
 
575
  if ((ptr != NULL) && (end != NULL) && (end - ptr > 1))
571
576
  {
572
577
    uint len= (uint) (ptr - cur_arg);
573
578
    set_if_smaller(len, FN_REFLEN-1);