Deleted Added
full compact
2c2
< * Copyright (C) 1984-2009 Mark Nudelman
---
> * Copyright (C) 1984-2011 Mark Nudelman
27d26
< static char *propt();
35a35,63
> /*
> * Return a printable description of an option.
> */
> static char *
> opt_desc(o)
> struct loption *o;
> {
> static char buf[OPTNAME_MAX + 10];
> if (o->oletter == OLETTER_NONE)
> SNPRINTF1(buf, sizeof(buf), "--%s", o->onames->oname);
> else
> SNPRINTF2(buf, sizeof(buf), "-%c (--%s)", o->oletter, o->onames->oname);
> return (buf);
> }
>
> /*
> * Return a string suitable for printing as the "name" of an option.
> * For example, if the option letter is 'x', just return "-x".
> */
> public char *
> propt(c)
> int c;
> {
> static char buf[8];
>
> sprintf(buf, "-%s", prchar(c));
> return (buf);
> }
>
72c100
< printopt = propt(pendopt->oletter);
---
> printopt = opt_desc(pendopt);
264,265c292,294
< toggle_option(c, s, how_toggle)
< int c;
---
> toggle_option(o, lower, s, how_toggle)
> struct loption *o;
> int lower;
269d297
< register struct loption *o;
278,281d305
< /*
< * Look up the option letter in the option table.
< */
< o = findopt(c);
284,285c308
< parg.p_string = propt(c);
< error("There is no %s option", &parg);
---
> error("No such option", NULL_PARG);
291c314
< parg.p_string = propt(c);
---
> parg.p_string = opt_desc(o);
294c317
< }
---
> }
298c321
< parg.p_string = propt(c);
---
> parg.p_string = opt_desc(o);
358,359c381
< *(o->ovar) = flip_triple(*(o->ovar),
< ASCII_IS_LOWER(c));
---
> *(o->ovar) = flip_triple(*(o->ovar), lower);
365,366c387
< *(o->ovar) = flip_triple(o->odefault,
< ASCII_IS_LOWER(c));
---
> *(o->ovar) = flip_triple(o->odefault, lower);
468,469c489
< * Return a string suitable for printing as the "name" of an option.
< * For example, if the option letter is 'x', just return "-x".
---
> * Determine if an option takes a parameter.
471,484d490
< static char *
< propt(c)
< int c;
< {
< static char buf[8];
<
< sprintf(buf, "-%s", prchar(c));
< return (buf);
< }
<
< /*
< * Determine if an option is a single character option (BOOL or TRIPLE),
< * or if it a multi-character option (NUMBER).
< */
486,487c492,493
< single_char_option(c)
< int c;
---
> opt_has_param(o)
> struct loption *o;
489,491d494
< register struct loption *o;
<
< o = findopt(c);
493,494c496,499
< return (TRUE);
< return ((o->otype & (BOOL|TRIPLE|NOVAR|NO_TOGGLE)) != 0);
---
> return (0);
> if (o->otype & (BOOL|TRIPLE|NOVAR|NO_TOGGLE))
> return (0);
> return (1);
502,503c507,508
< opt_prompt(c)
< int c;
---
> opt_prompt(o)
> struct loption *o;
505,507d509
< register struct loption *o;
<
< o = findopt(c);
509c511
< return (NULL);
---
> return ("?");
544c546
< nostring(propt(pendopt->oletter));
---
> nostring(opt_desc(pendopt));