Re: Interactive behaviour
Eric Blake <[email protected]>
| Newsgroups | gmane.comp.gnu.m4.patches |
|---|---|
| Message-ID | <[email protected]> |
Gary V. Vaughan <gary <at> gnu.org> writes: > > As far as I can see, the only reason --interactive is -e instead of > > -i is > > due to command-line compatibility with SysV implementations such as > > Solaris m4. But should I add -i as a synonym for -e as a followon > > patch? > > Yes, I think that is an excellent idea. From http://www.gnu.org/prep/ > standards/html_node/Option-Table.html: > > `interactive' > `-i' in `cp', `ln', `mv', `rm'; `-e' in `m4'; `-p' in `xargs'; > `-w' in `tar'. > > So, `-i, --interactive' in help, with `-e' as a silent compatibility > option > seems sanest to me. Done below, branch and head. I also went all the way and issue a deprecation warning for -H on head, rather than waiting a full release cycle of silent no- ops. > We might want to Cc: Karl Berry in on the patch > incase > he wants to amend the GCS document? I'll have to make a full pass of all long option names, and how they fit in GCS, and give it to him in bulk. branch: 2006-09-20 Eric Blake <[email protected]> * src/m4.c (usage, OPTSTRING, main): Rename -e to -i, and give deprecation warning on -e. * doc/m4.texinfo (Invoking m4, Extensions): Document this. * NEWS: Document this. Index: NEWS =================================================================== RCS file: /sources/m4/m4/NEWS,v retrieving revision 1.1.1.1.2.63 diff -u -r1.1.1.1.2.63 NEWS --- NEWS 20 Sep 2006 03:59:42 -0000 1.1.1.1.2.63 +++ NEWS 21 Sep 2006 04:07:00 -0000 @@ -15,13 +15,22 @@ * When standard input is a seekable file, the m4exit, syscmd, and esyscmd macros now restore the current position to the next unread byte rather than discarding an arbitrary amount of buffered data. +* SysV command-line compatibility is no longer a goal of GNU M4; the + focus will be instead on POSIX compatibility. This release continues to + support previous usage, but adds warnings in areas which will allow a + future version of GNU M4 to use its own extensions without being tied to + the SysV command line interface. * The no-op compatibility command line options -B, -N, -S, -T, and --diversions may be withdrawn or assigned new meanings in future releases, so they now issue a warning if used. +* A new command line option -i replaces the compatibility -e as the + short spelling of --interactive, for consistency with other GNU tools; a + warning is issued if the old spelling is used, and it may be assigned new + meaning in future releases. * A new command line option --debugfile replaces the options -o and --error-output as the preferred spelling. The old options were misleading in their names and inconsistent with other GNU tools; they are - still silently accepted, but no longer documented in --help, and may + still silently accepted, but no longer documented in --help, and may be assigned new meanings in future releases. Version 1.4.6 - 25 August 2006, by Eric Blake (CVS version 1.4.5a) Index: doc/m4.texinfo =================================================================== RCS file: /sources/m4/m4/doc/m4.texinfo,v retrieving revision 1.1.1.1.2.77 diff -u -r1.1.1.1.2.77 m4.texinfo --- doc/m4.texinfo 20 Sep 2006 03:59:42 -0000 1.1.1.1.2.77 +++ doc/m4.texinfo 21 Sep 2006 04:07:00 -0000 @@ -400,10 +400,14 @@ Stop execution and exit @code{m4} once the first warning has been issued, considering all of them to be fatal. -@item -e +@item -i @itemx --interactive +@itemx -e Makes this invocation of @code{m4} interactive. This means that all -output will be unbuffered, and interrupts will be ignored. +output will be unbuffered, and interrupts will be ignored. The +spelling @option{-e} exists for compatibility with other @code{m4} +implementations, and issues a warning because it may be withdrawn in a +future version of @acronym{GNU} M4. @item -P @itemx --prefix-builtins @@ -4765,7 +4769,7 @@ In addition to the above extensions, @acronym{GNU} @code{m4} implements the following command line options: @option{-F}, @option{-G}, @option{-I}, -@option{-L}, @option{-R}, @option{-V}, @option{-W}, @option{-d}, +@option{-L}, @option{-R}, @option{-V}, @option{-W}, @option{-d}, @option{-i}, @option{-l}, @option{--debugfile} and @option{-t}. @xref{Invoking m4}, for a description of these options. Index: src/m4.c =================================================================== RCS file: /sources/m4/m4/src/Attic/m4.c,v retrieving revision 1.1.1.1.2.30 diff -u -r1.1.1.1.2.30 m4.c --- src/m4.c 20 Sep 2006 03:59:42 -0000 1.1.1.1.2.30 +++ src/m4.c 21 Sep 2006 04:07:00 -0000 @@ -139,7 +139,7 @@ --help display this help and exit\n\ --version output version information and exit\n\ -E, --fatal-warnings stop execution after first warning\n\ - -e, --interactive unbuffer output, ignore interrupts\n\ + -i, --interactive unbuffer output, ignore interrupts\n\ -P, --prefix-builtins force a `m4_' prefix to all builtins\n\ -Q, --quiet, --silent suppress some warnings for builtins\n\ ", stdout); @@ -235,7 +235,7 @@ {"freeze-state", required_argument, NULL, 'F'}, {"hashsize", required_argument, NULL, 'H'}, {"include", required_argument, NULL, 'I'}, - {"interactive", no_argument, NULL, 'e'}, + {"interactive", no_argument, NULL, 'i'}, {"nesting-limit", required_argument, NULL, 'L'}, {"prefix-builtins", no_argument, NULL, 'P'}, {"quiet", no_argument, NULL, 'Q'}, @@ -261,9 +261,9 @@ int retcode; #ifdef ENABLE_CHANGEWORD -#define OPTSTRING "B:D:EF:GH:I:L:N:PQR:S:T:U:W:d::el:o:st:" +#define OPTSTRING "B:D:EF:GH:I:L:N:PQR:S:T:U:W:d::eil:o:st:" #else -#define OPTSTRING "B:D:EF:GH:I:L:N:PQR:S:T:U:d::el:o:st:" +#define OPTSTRING "B:D:EF:GH:I:L:N:PQR:S:T:U:d::eil:o:st:" #endif int @@ -391,6 +391,9 @@ break; case 'e': + error (0, 0, "Warning: `m4 -e' is deprecated, use `-i' instead"); + /* fall through */ + case 'i': interactive = TRUE; break; head: 2006-09-20 Eric Blake <[email protected]> * src/main.c (usage, OPTSTRING, main): Rename -e to -i. Make warnings consistent. (long_options, HASHSIZE_OPTION): Warn on -H. * doc/m4.texinfo (Invoking m4): Document this. * tests/options.at (deprecated options): Update. Index: NEWS =================================================================== RCS file: /sources/m4/m4/NEWS,v retrieving revision 1.18 diff -u -r1.18 NEWS --- NEWS 20 Sep 2006 13:05:51 -0000 1.18 +++ NEWS 21 Sep 2006 04:09:14 -0000 @@ -74,11 +74,14 @@ representation and to catch any more missing state; once 2.0 is released, any further changes would introduce format 3. -* The `-o' and `--error-output' options, which were replaced by +* The `-o'/`--error-output' options, which were replaced by `--debugfile' in M4 1.4.7, now issue a deprecation warning. This warning interferes with all versions of Autoconf prior to 2.61, so plan on installing an updated Autoconf when installing M4 2.0. +* The `-H'/`--hashsize' options, which were made no-ops in a previous + beta, now issue a deprecation warning. + * The `dumpdef' macro now always outputs to standard error, rather than the debug file specified by the `--debugfile' option or `debugfile' macro. Index: doc/m4.texinfo =================================================================== RCS file: /sources/m4/m4/doc/m4.texinfo,v retrieving revision 1.49 diff -u -r1.49 m4.texinfo --- doc/m4.texinfo 20 Sep 2006 13:05:51 -0000 1.49 +++ doc/m4.texinfo 21 Sep 2006 04:09:14 -0000 @@ -419,10 +419,12 @@ @itemx --batch Makes this invocation of @code{m4} non-interactive. This means that output will be buffered, and interrupts will halt execution. If neither -@option{-b} nor @option{-e} are specified, this is activated by default +@option{-b} nor @option{-i} are specified, this is activated by default when any input files are specified, or when either standard input or -standard error is not a terminal. If both @option{-b} and @option{-e} -are specified, only the last one takes effect. +standard error is not a terminal. Note that this means that @kbd{m4} +alone might be interactive, but @kbd{m4 -} is not, even though both +commands process only standard input. If both @option{-b} and +@option{-i} are specified, only the last one takes effect. @item -c @itemx --discard-comments @@ -433,15 +435,19 @@ Stop execution and exit @code{m4} once the first warning has been issued, considering all of them to be fatal. -@item -e +@item -i @itemx --interactive +@itemx -e Makes this invocation of @code{m4} interactive. This means that all output will be unbuffered, and interrupts will be ignored. If neither -@option{-b} nor @option{-e} are specified, this is activated by default +@option{-b} nor @option{-i} are specified, this is activated by default when no input files are specified, and when both standard input and standard error are terminals (similar to the way that /bin/sh determines -when to be interactive). If both @option{-b} and @option{-e} are -specified, only the last one takes effect. +when to be interactive). If both @option{-b} and @option{-i} are +specified, only the last one takes effect. The spelling @option{-e} +exists for compatibility with other @code{m4} implementations, and +issues a warning because it may be withdrawn in a future version of +@acronym{GNU} M4. @item -P @itemx --prefix-builtins @@ -608,9 +614,9 @@ @item -N @var{NUM} @itemx --diversions=@var{NUM} These options are present only for compatibility with previous -versions of GNU @code{m4}. They do nothing, because the symbol table -size and number of diversions are not fixed anymore. They will -eventually disappear in future releases. +versions of GNU @code{m4}. They do nothing except issue a warning, +because the symbol table size and number of diversions are not fixed +anymore. They will eventually disappear in future releases. @itemx -S @var{NUM} @itemx -T @var{NUM} Index: src/main.c =================================================================== RCS file: /sources/m4/m4/src/main.c,v retrieving revision 1.86 diff -u -r1.86 main.c --- src/main.c 20 Sep 2006 13:05:51 -0000 1.86 +++ src/main.c 21 Sep 2006 04:09:14 -0000 @@ -85,7 +85,7 @@ -b, --batch buffer output, process interrupts\n\ -c, --discard-comments do not copy comments to the output\n\ -E, --fatal-warnings stop execution after first warning\n\ - -e, --interactive unbuffer output, ignore interrupts\n\ + -i, --interactive unbuffer output, ignore interrupts\n\ -P, --prefix-builtins force a `m4_' prefix to all builtins\n\ -Q, --quiet, --silent suppress some warnings for builtins\n\ -r, --regexp-syntax=SPEC change the default regexp syntax\n\ @@ -176,6 +176,7 @@ DEBUGFILE_OPTION = CHAR_MAX + 1, /* no short opt */ DIVERSIONS_OPTION, /* not quite -N, because of message */ ERROR_OUTPUT_OPTION, /* not quite -o, because of message */ + HASHSIZE_OPTION, /* not quite -H, because of message */ IMPORT_ENVIRONMENT_OPTION, /* no short opt */ PREPEND_INCLUDE_OPTION, /* not quite -B, because of message */ SAFER_OPTION, /* -S still has old no-op semantics */ @@ -194,9 +195,8 @@ {"discard-comments", no_argument, NULL, 'c'}, {"fatal-warnings", no_argument, NULL, 'E'}, {"freeze-state", required_argument, NULL, 'F'}, - {"hashsize", required_argument, NULL, 'H'}, {"include", required_argument, NULL, 'I'}, - {"interactive", no_argument, NULL, 'e'}, + {"interactive", no_argument, NULL, 'i'}, {"load-module", required_argument, NULL, 'm'}, {"module-directory", required_argument, NULL, 'M'}, {"nesting-limit", required_argument, NULL, 'L'}, @@ -213,6 +213,7 @@ {"debugfile", required_argument, NULL, DEBUGFILE_OPTION}, {"diversions", required_argument, NULL, DIVERSIONS_OPTION}, + {"hashsize", required_argument, NULL, HASHSIZE_OPTION}, {"error-output", required_argument, NULL, ERROR_OUTPUT_OPTION}, {"import-environment", no_argument, NULL, IMPORT_ENVIRONMENT_OPTION}, {"prepend-include", required_argument, NULL, PREPEND_INCLUDE_OPTION}, @@ -224,13 +225,13 @@ { NULL, 0, NULL, 0 }, }; -#define OPTSTRING "B:D:EF:GH:I:L:M:N:PQR:S:T:U:bcd::el:m:o:r:st:" +#define OPTSTRING "B:D:EF:GH:I:L:M:N:PQR:S:T:U:bcd::eil:m:o:r:st:" /* For determining whether to be interactive. */ enum interactive_choice { - INTERACTIVE_UNKNOWN, /* Still processing arguments, no -b or -e yet */ - INTERACTIVE_YES, /* -e specified last */ + INTERACTIVE_UNKNOWN, /* Still processing arguments, no -b or -i yet */ + INTERACTIVE_YES, /* -i specified last */ INTERACTIVE_NO /* -b specified last */ }; @@ -288,15 +289,18 @@ usage (EXIT_FAILURE); case 'H': - /* -H was supported in 1.4.x. FIXME - make obsolete after - 2.0, and remove after 2.1. For now, keep it silent. */ + case HASHSIZE_OPTION: + /* -H was supported in 1.4.x, but is a no-op now. FIXME - + remove support for -H after 2.0. */ + error (0, 0, _("Warning: `%s' is deprecated"), + optchar == 'H' ? "-H" : "--hashsize"); break; case 'N': case DIVERSIONS_OPTION: /* -N became an obsolete no-op in 1.4.x. FIXME - remove support for -N after 2.0. */ - error (0, 0, _("Warning: `m4 %s' is deprecated"), + error (0, 0, _("Warning: `%s' is deprecated"), optchar == 'N' ? "-N" : "--diversions"); break; @@ -305,7 +309,7 @@ /* Compatibility junk: options that other implementations support, but which we ignore as no-ops and don't list in --help. */ - error (0, 0, _("Warning: `m4 -%c' may be removed in a future release"), + error (0, 0, _("Warning: `-%c' is deprecated"), optchar); break; @@ -339,7 +343,7 @@ errno = 0; strtol (optarg, &end, 10); if (*end == '\0' && errno == 0) - error (0, 0, _("Warning: recommend using `m4 -B ./%s' instead"), + error (0, 0, _("Warning: recommend using `-B ./%s' instead"), optarg); } /* fall through */ @@ -417,6 +421,10 @@ break; case 'e': + error (0, 0, _("Warning: `%s' is deprecated, use `%s' instead"), + "-e", "-i"); + /* fall through */ + case 'i': interactive = INTERACTIVE_YES; break; @@ -433,8 +441,8 @@ stdout, and --error-output is misnamed since it does not affect error messages to stderr. Change the meaning of -o after 2.1. */ - error (0, 0, _("Warning: %s is deprecated, use --debugfile instead"), - optchar == 'o' ? "-o" : "--error-output"); + error (0, 0, _("Warning: `%s' is deprecated, use `%s' instead"), + optchar == 'o' ? "-o" : "--error-output", "--debugfile"); /* fall through */ case DEBUGFILE_OPTION: if (!m4_debug_set_output (context, optarg)) Index: tests/options.at =================================================================== RCS file: /sources/m4/m4/tests/options.at,v retrieving revision 1.10 diff -u -r1.10 options.at --- tests/options.at 20 Sep 2006 04:04:29 -0000 1.10 +++ tests/options.at 21 Sep 2006 04:09:14 -0000 @@ -136,37 +136,47 @@ dnl -N/--diversions are no-ops since 1.4.x AT_CHECK_M4([-N1 --diversions=1], [0], [], -[[m4: Warning: `m4 -N' is deprecated -m4: Warning: `m4 --diversions' is deprecated +[[m4: Warning: `-N' is deprecated +m4: Warning: `--diversions' is deprecated ]]) -dnl -H/--hashsize are no-ops since 2.0, and still silent for now... -AT_CHECK_M4([-H1 --hashsize=1]) +dnl -H/--hashsize are no-ops since 2.0 +AT_CHECK_M4([-H1 --hashsize=1], [0], [], +[[m4: Warning: `-H' is deprecated +m4: Warning: `--hashsize' is deprecated +]]) dnl -S/-T are no-ops for compatibility AT_CHECK_M4([-S1 -T1], [0], [], -[[m4: Warning: `m4 -S' may be removed in a future release -m4: Warning: `m4 -T' may be removed in a future release +[[m4: Warning: `-S' is deprecated +m4: Warning: `-T' is deprecated ]]) dnl -Bint can be confused with its no-op meaning in 1.4.x, but all other dnl uses of -B or its long option are okay -AT_CHECK_M4([-B1 -B./1 --prepend-include=1], [0], [], -[[m4: Warning: recommend using `m4 -B ./1' instead +AT_CHECK_M4([-B1], [0], [], +[[m4: Warning: recommend using `-B ./1' instead ]]) +AT_CHECK_M4([-B./1 --prepend-include=1], [0], [], +[[]]) dnl --error-output is a misleading name AT_CHECK_M4([--error-output=trace], [0], [], -[[m4: Warning: --error-output is deprecated, use --debugfile instead +[[m4: Warning: `--error-output' is deprecated, use `--debugfile' instead ]]) AT_CHECK([rm trace]) dnl -o will change meaning in the future AT_CHECK_M4([-otrace], [0], [], -[[m4: Warning: -o is deprecated, use --debugfile instead +[[m4: Warning: `-o' is deprecated, use `--debugfile' instead ]]) AT_CHECK([rm trace]) +dnl -e is an odd spelling for --interactive +AT_CHECK_M4([-e], [0], [], +[[m4: Warning: `-e' is deprecated, use `-i' instead +]]) + AT_CLEANUP