[patch] -nip fails with BERKELEY_DEFAULTS (still a problem with 2.2.10)
John Hein <[email protected]> Sun, 15 Feb 2009 11:40:17 -0700
| Newsgroups | gmane.comp.gnu.indent.bugs |
|---|---|
| Message-ID | <[email protected]> |
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.
Note: These bugs were mentioned in the thread shown below, but the
original patch has been refreshed for 2.2.10 and the second hunk was
wrong in the original - new patch attached...
http://lists.gnu.org/archive/html/bug-indent/2005-11/msg00001.html
_______________________________________________
bug-indent mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-indent
p
(text/plain, 1.9 KB)
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 2008-03-11 12:50:42.000000000 -0600
+++ args.c 2009-02-15 10:55:04.000000000 -0700
@@ -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},
@@ -798,7 +798,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
{