/[inetutils]/inetutils/lib/argp-help.c
ViewVC logotype

Diff of /inetutils/lib/argp-help.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by ams, Fri Jan 21 13:02:48 2005 UTC revision 1.2 by gray, Fri Jul 29 10:52:43 2005 UTC
# Line 1  Line 1 
1  /* Hierarchial argument parsing help output  /* Hierarchial argument parsing help output
2     Copyright (C) 1995-2003, 2004 Free Software Foundation, Inc.     Copyright (C) 1995-2003, 2004, 2005 Free Software Foundation, Inc.
3     This file is part of the GNU C Library.     This file is part of the GNU C Library.
4     Written by Miles Bader <miles@gnu.ai.mit.edu>.     Written by Miles Bader <miles@gnu.ai.mit.edu>.
5    
# Line 15  Line 15 
15    
16     You should have received a copy of the GNU General Public License along     You should have received a copy of the GNU General Public License along
17     with this program; if not, write to the Free Software Foundation,     with this program; if not, write to the Free Software Foundation,
18     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
19    
20  #ifndef _GNU_SOURCE  #ifndef _GNU_SOURCE
21  # define _GNU_SOURCE    1  # define _GNU_SOURCE    1
# Line 1055  hol_entry_help (struct hol_entry *entry, Line 1055  hol_entry_help (struct hol_entry *entry,
1055    int old_wm = __argp_fmtstream_wmargin (stream);    int old_wm = __argp_fmtstream_wmargin (stream);
1056    /* PEST is a state block holding some of our variables that we'd like to    /* PEST is a state block holding some of our variables that we'd like to
1057       share with helper functions.  */       share with helper functions.  */
1058    struct pentry_state pest = { entry, stream, hhstate, 1, state };    struct pentry_state pest;
1059    
1060      pest.entry = entry;
1061      pest.stream = stream;
1062      pest.hhstate = hhstate;
1063      pest.first = 1;
1064      pest.state = state;
1065    
1066    if (! odoc (real))    if (! odoc (real))
1067      for (opt = real, num = entry->num; num > 0; opt++, num--)      for (opt = real, num = entry->num; num > 0; opt++, num--)
# Line 1663  Try `%s --help' or `%s --usage' for more Line 1669  Try `%s --help' or `%s --usage' for more
1669  void __argp_help (const struct argp *argp, FILE *stream,  void __argp_help (const struct argp *argp, FILE *stream,
1670                    unsigned flags, char *name)                    unsigned flags, char *name)
1671  {  {
1672    _help (argp, 0, stream, flags, name);    struct argp_state state;
1673      memset (&state, 0, sizeof state);
1674      state.root_argp = argp;
1675      _help (argp, &state, stream, flags, name);
1676  }  }
1677  #ifdef weak_alias  #ifdef weak_alias
1678  weak_alias (__argp_help, argp_help)  weak_alias (__argp_help, argp_help)
# Line 1739  __argp_error (const struct argp_state *s Line 1748  __argp_error (const struct argp_state *s
1748              {              {
1749                char *buf;                char *buf;
1750    
1751                __asprintf (&buf, fmt, ap);                if (__asprintf (&buf, fmt, ap) < 0)
1752                    buf = NULL;
1753    
1754                __fwprintf (stream, L"%s: %s\n",                __fwprintf (stream, L"%s: %s\n",
1755                            state ? state->name : __argp_short_program_name (),                            state ? state->name : __argp_short_program_name (),
# Line 1817  __argp_failure (const struct argp_state Line 1827  __argp_failure (const struct argp_state
1827                  {                  {
1828                    char *buf;                    char *buf;
1829    
1830                    __asprintf (&buf, fmt, ap);                    if (__asprintf (&buf, fmt, ap) < 0)
1831                        buf = NULL;
1832    
1833                    __fwprintf (stream, L": %s", buf);                    __fwprintf (stream, L": %s", buf);
1834    
# Line 1857  __argp_failure (const struct argp_state Line 1868  __argp_failure (const struct argp_state
1868  #endif  #endif
1869  #if !_LIBC  #if !_LIBC
1870                    if (! s && ! (s = strerror (errnum)))                    if (! s && ! (s = strerror (errnum)))
1871                      s = "Unknown system error"; /* FIXME: translate this */                      s = dgettext (state->root_argp->argp_domain,
1872                                      "Unknown system error");
1873  #endif  #endif
1874                    fputs (s, stream);                    fputs (s, stream);
1875                  }                  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26