bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnulib] Re: Patch to argp


From: Paul Eggert
Subject: [Bug-gnulib] Re: Patch to argp
Date: Thu, 30 Sep 2004 09:57:21 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Sergey Poznyakoff <address@hidden> writes:

> Attached is the patch that fixes a couple of bugs discovered recently in
> argp.

Thanks.  I installed that, and also changed a couple of related admin
files.  The complete patch is enclosed below.

Can you please work to get the argp fixes merged into glibc, so that
we can go back to mirroring glibc?  It's not urgent, but it should get
done.  All you should need to do is file a bug report in glibc
bugzilla, and (in addition to saying why the changes are needed)
mention that gnulib is using them.  Thanks.

> Paul, may I have write access to the repository?

Done.  Sorry about the delay.

2004-09-30  Paul Eggert  <address@hidden>

        * modules/argp (Maintainer): Replace Simon Josefsson
        by Sergey Poznyakoff.
        * config/srclist.txt: Comment-out argp/argp.h, until we get the argp
        changes merged back into glibc.

2004-09-30  Sergey Poznyakoff  <address@hidden>

        * argp-help.c (canon_doc_option): Fixed coredump if *name==NULL
        (hol_entry_help): Never translate an empty string.
        Do not translate option tag (opt->name) if OPTION_NO_TRANS is set
        * argp.h (OPTION_NO_TRANS): New option.

Index: config/srclist.txt
===================================================================
RCS file: /cvsroot/gnulib/gnulib/config/srclist.txt,v
retrieving revision 1.44
retrieving revision 1.45
diff -p -u -r1.44 -r1.45
--- config/srclist.txt  21 Sep 2004 05:07:11 -0000      1.44
+++ config/srclist.txt  30 Sep 2004 16:44:12 -0000      1.45
@@ -1,4 +1,4 @@
-# $Id: srclist.txt,v 1.44 2004/09/21 05:07:11 eggert Exp $
+# $Id: srclist.txt,v 1.45 2004/09/30 16:44:12 eggert Exp $
 # Files for which we are not the source.  See ./srclistvars.sh for the
 # variable definitions.
 
@@ -81,15 +81,14 @@ $LIBCSRC/argp/argp-eexst.c          lib gpl
 $LIBCSRC/argp/argp-fmtstream.c         lib gpl
 $LIBCSRC/argp/argp-fmtstream.h         lib gpl
 $LIBCSRC/argp/argp-fs-xinl.c           lib gpl
-# Currently not quite the same.
+# The commented-out argp files are currently not quite the same.
 #$LIBCSRC/argp/argp-help.c             lib gpl
 $LIBCSRC/argp/argp-namefrob.h          lib gpl
-# Currently not quite the same.
 #$LIBCSRC/argp/argp-parse.c            lib gpl
 $LIBCSRC/argp/argp-pv.c                        lib gpl
 #$LIBCSRC/argp/argp-pvh.c              lib gpl
 $LIBCSRC/argp/argp-xinl.c              lib gpl
-$LIBCSRC/argp/argp.h                   lib gpl
+#$LIBCSRC/argp/argp.h                  lib gpl
 $LIBCSRC/stdlib/getsubopt.c            lib gpl
 #$LIBCSRC/posix/getopt.c               lib gpl
 #$LIBCSRC/posix/getopt.h               lib gpl (getopt_.h in gnulib)
Index: lib/argp-help.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/argp-help.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -p -u -r1.11 -r1.12
--- lib/argp-help.c     12 Aug 2004 07:57:07 -0000      1.11
+++ lib/argp-help.c     30 Sep 2004 16:41:30 -0000      1.12
@@ -228,6 +228,9 @@ fill_in_uparams (const struct argp_state
 /* Returns true if OPT is an documentation-only entry.  */
 #define odoc(opt) ((opt)->flags & OPTION_DOC)
 
+/* Returns true if OPT should not be translated */
+#define onotrans(opt) ((opt)->flags & OPTION_NO_TRANS)
+
 /* Returns true if OPT is the end-of-list marker for a list of options.  */
 #define oend(opt) __option_is_end (opt)
 
@@ -676,14 +679,20 @@ static int
 canon_doc_option (const char **name)
 {
   int non_opt;
-  /* Skip initial whitespace.  */
-  while (isspace (**name))
-    (*name)++;
-  /* Decide whether this looks like an option (leading `-') or not.  */
-  non_opt = (**name != '-');
-  /* Skip until part of name used for sorting.  */
-  while (**name && !isalnum (**name))
-    (*name)++;
+
+  if (!*name)
+    non_opt = 1;
+  else
+    {
+      /* Skip initial whitespace.  */
+      while (isspace (**name))
+       (*name)++;
+      /* Decide whether this looks like an option (leading `-') or not.  */
+      non_opt = (**name != '-');
+      /* Skip until part of name used for sorting.  */
+      while (**name && !isalnum (**name))
+       (*name)++;
+    }
   return non_opt;
 }
 
@@ -1081,13 +1090,15 @@ hol_entry_help (struct hol_entry *entry,
     {
       __argp_fmtstream_set_wmargin (stream, uparams.doc_opt_col);
       for (opt = real, num = entry->num; num > 0; opt++, num--)
-       if (opt->name && ovisible (opt))
+       if (opt->name && *opt->name && ovisible (opt))
          {
            comma (uparams.doc_opt_col, &pest);
-           /* Calling gettext here isn't quite right, since sorting will
+           /* Calling dgettext here isn't quite right, since sorting will
               have been done on the original; but documentation options
               should be pretty rare anyway...  */
            __argp_fmtstream_puts (stream,
+                                  onotrans (opt) ?
+                                            opt->name :
                                   dgettext (state->root_argp->argp_domain,
                                             opt->name));
          }
Index: lib/argp.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/argp.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -p -u -r1.7 -r1.8
--- lib/argp.h  8 Sep 2004 13:31:45 -0000       1.7
+++ lib/argp.h  30 Sep 2004 16:41:57 -0000      1.8
@@ -126,11 +126,12 @@ struct argp_option
    should be displayed in much the same manner as the options.  If this flag
    is set, then the option NAME field is displayed unmodified (e.g., no `--'
    prefix is added) at the left-margin (where a *short* option would normally
-   be displayed), and the documentation string in the normal place.  For
-   purposes of sorting, any leading whitespace and punctuation is ignored,
-   except that if the first non-whitespace character is not `-', this entry
-   is displayed after all options (and OPTION_DOC entries with a leading `-')
-   in the same group.  */
+   be displayed), and the documentation string in the normal place. The NAME
+   field will be translated using gettext, unless OPTION_NO_TRANS is set (see
+   below). For purposes of sorting, any leading whitespace and punctuation is
+   ignored, except that if the first non-whitespace character is not `-', this
+   entry is displayed after all options (and OPTION_DOC entries with a leading
+   `-') in the same group.  */
 #define OPTION_DOC             0x8
 
 /* This option shouldn't be included in `long' usage messages (but is still
@@ -141,6 +142,11 @@ struct argp_option
    distinguish these two cases, -x should probably be marked
    OPTION_NO_USAGE.  */
 #define OPTION_NO_USAGE                0x10
+
+/* Valid only in conjunction with OPTION_DOC. This option disables translation
+   of option name. */
+#define OPTION_NO_TRANS         0x20
+
 
 struct argp;                   /* fwd declare this type */
 struct argp_state;             /* " */
Index: modules/argp
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/argp,v
retrieving revision 1.7
retrieving revision 1.8
diff -p -u -r1.7 -r1.8
--- modules/argp        22 Sep 2004 15:11:04 -0000      1.7
+++ modules/argp        30 Sep 2004 16:40:59 -0000      1.8
@@ -43,5 +43,5 @@ License:
 LGPL
 
 Maintainer:
-Simon Josefsson, glibc
+Sergey Poznyakoff, glibc
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]