bug-indent
[Top][All Lists]
Advanced

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

[patch] -nip fails with BERKELEY_DEFAULTS (still a problem with 2.2.11)


From: John Hein
Subject: [patch] -nip fails with BERKELEY_DEFAULTS (still a problem with 2.2.11)
Date: Fri, 25 Jun 2010 10:40:25 -0600

There were a couple problems in 2.2.10 and 2.2.9.  See also:

http://lists.gnu.org/archive/html/bug-indent/2009-02/msg00005.html
http://lists.gnu.org/archive/html/bug-indent/2005-11/msg00000.html

Here's the patch again, refreshed slightly for gnu indent 2.2.11
I've been using it localy since 2.2.9


1) fix 'indent -npro -nip' when compiled with BERKELEY_DEFAULTS

   symptom: 
    command line: unknown option "nhnl"

   Note that the "nhnl" above is just luck due to layout by the compiler.  It
   could be random garbage.

   explanation: PRO_SETTINGS lists need to be terminated with two nulls.

2) fix error message for args prefixed with '--', like 'indent -npro 
--no-such-arg'

   symptom: 
    command line: unknown option "-no-such-arg"

   explanation: the error message uses 'option - 1' instead of 'option - 
option_length'
    and -- options have option_length == 2.

--- args.c.orig 2010-06-25 10:34:14.000000000 -0600
+++ args.c      2010-06-25 10:35:23.000000000 -0600
@@ -282,7 +282,7 @@
     {"npcs",    PRO_BOOL,                           false,      OFF, 
&settings.proc_calls_space,                 &exp_pcs},
     {"nlps",    PRO_BOOL,                           false,      OFF, 
&settings.leave_preproc_space,              &exp_lps},
     {"nlp",     PRO_BOOL,                            true,      OFF, 
&settings.lineup_to_parens,                 &exp_lp},
-    {"nip",     PRO_SETTINGS,                           0, ONOFF_NA, (int *) 
"-ip0",                             &exp_nip},
+    {"nip",     PRO_SETTINGS,                           0, ONOFF_NA, (int *) 
"-ip0\0",                           &exp_nip},
     {"nhnl",    PRO_BOOL,                            true,      OFF, 
&settings.honour_newlines,                  &exp_hnl},
     {"nfca",    PRO_BOOL,                            true,      OFF, 
&settings.format_comments,                  &exp_fca},
     {"nfc1",    PRO_BOOL,                            true,      OFF, 
&settings.format_col1_comments,             &exp_fc1},
@@ -799,7 +799,8 @@
 
     if (!found)
     {
-        DieError(invocation_error, _("%s: unknown option \"%s\"\n"), 
option_source, option - 1);
+        DieError(invocation_error, _("%s: unknown option \"%s\"\n"),
+            option_source, option - option_length);
     }
     else
     {

reply via email to

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