X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fargp-help.c;h=150a0ad28f37e681c739653eb2e32e61676d3f5e;hb=298d8b4a29e66da0b046b64b822f97d1c8fef74b;hp=396e73326f9d42718b0d014721be30cfa56cad30;hpb=7d5d77e65684de1c65c74c1b1d87a6c4f591b045;p=gnulib.git diff --git a/lib/argp-help.c b/lib/argp-help.c index 396e73326..150a0ad28 100644 --- a/lib/argp-help.c +++ b/lib/argp-help.c @@ -1,21 +1,20 @@ /* Hierarchial argument parsing help output - Copyright (C) 1995-2005, 2007 Free Software Foundation, Inc. + Copyright (C) 1995-2005, 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 @@ -89,11 +88,11 @@ struct uparams int dup_args_note; /* Various output columns. */ - int short_opt_col; /* column in which short options start */ - int long_opt_col; /* column in which long options start */ + int short_opt_col; /* column in which short options start */ + int long_opt_col; /* column in which long options start */ int doc_opt_col; /* column in which doc options start */ int opt_doc_col; /* column in which option text starts */ - int header_col; /* column in which group headers are printed */ + int header_col; /* column in which group headers are printed */ int usage_indent; /* indentation of wrapped usage lines */ int rmargin; /* right margin used for wrapping */ @@ -161,7 +160,7 @@ fill_in_uparams (const struct argp_state *state) { const char *var = getenv ("ARGP_HELP_FMT"); struct uparams new_params = uparams; - + #define SKIPWS(p) do { while (isspace ((unsigned char) *p)) p++; } while (0); if (var) @@ -170,7 +169,7 @@ fill_in_uparams (const struct argp_state *state) while (*var) { SKIPWS (var); - + if (isalpha ((unsigned char) *var)) { size_t var_len; @@ -181,9 +180,9 @@ fill_in_uparams (const struct argp_state *state) while (isalnum ((unsigned char) *arg) || *arg == '-' || *arg == '_') arg++; var_len = arg - var; - + SKIPWS (arg); - + if (*arg == '\0' || *arg == ',') unspec = 1; else if (*arg == '=') @@ -191,7 +190,7 @@ fill_in_uparams (const struct argp_state *state) arg++; SKIPWS (arg); } - + if (unspec) { if (var[0] == 'n' && var[1] == 'o' && var[2] == '-') @@ -210,7 +209,7 @@ fill_in_uparams (const struct argp_state *state) arg++; SKIPWS (arg); } - + for (un = uparam_names; un->name; un++) if (strlen (un->name) == var_len && strncmp (var, un->name, var_len) == 0) @@ -595,7 +594,7 @@ hol_entry_long_iterate (const struct hol_entry *entry, } /* Iterator that returns true for the first short option. */ -static inline int +static int until_short (const struct argp_option *opt, const struct argp_option *real, const char *domain, void *cookie) { @@ -677,7 +676,7 @@ hol_cluster_cmp (const struct hol_cluster *cl1, const struct hol_cluster *cl2) { /* If one cluster is deeper than the other, use its ancestor at the same level, so that finding the common ancestor is straightforward. - + clN->depth > 0 means that clN->parent != NULL (see hol_add_cluster) */ while (cl1->depth > cl2->depth) cl1 = cl1->parent; @@ -798,16 +797,14 @@ hol_entry_cmp (const struct hol_entry *entry1, first, but as they're not displayed, it doesn't matter where they are. */ { - char first1 = short1 ? short1 : long1 ? *long1 : 0; - char first2 = short2 ? short2 : long2 ? *long2 : 0; -#ifdef _tolower - int lower_cmp = _tolower (first1) - _tolower (first2); -#else + unsigned char first1 = short1 ? short1 : long1 ? *long1 : 0; + unsigned char first2 = short2 ? short2 : long2 ? *long2 : 0; + /* Use tolower, not _tolower, since only the former is + guaranteed to work on something already lower case. */ int lower_cmp = tolower (first1) - tolower (first2); -#endif /* Compare ignoring case, except when the options are both the same letter, in which case lower-case always comes first. */ - return lower_cmp ? lower_cmp : + return lower_cmp ? lower_cmp : (rc = first2 - first1) ? rc : HOL_ENTRY_PTRCMP(entry1, entry2); }