1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 19:52:20 +00:00

cleanup: remove pointless no-op 'fc' and 'type' aliases

Both 'fc' and 'type' are already implemented as perfectly
functional builtins -- in fact they use the exact same C function
as 'hist' and 'whence', so the behaviour is clearly identical.

Except 'type' was aliased to 'whence -v', but b_whence() contains
explicit code to activate the v flag if invoked as 'type', so the
alias is not needed for that either.

It looks like someone decided to implement these aliases as proper
builtins (as they should be; they are POSIX standard commands and
'unalias -a' must not get rid of them), but then forgot to remove
these default aliases (and to update the man page).

I'm not even doing a NEWS entry for this as there is no change in
behaviour. The only difference is that you now get the correct
command name in error and usage messages for 'fc' and 'type'.

src/cmd/ksh93/data/aliases.c:
- Remove fc='hist' and type='whence -v' default aliases.

src/cmd/ksh93/sh.1:
- Remove those default aliases from the list.
- Document 'fc' and 'type' builtins.

(cherry picked from commit c73af6a5a36a72c681201c9e9c397f98bbf2a86d)
This commit is contained in:
Martijn Dekker 2020-06-07 17:55:56 +02:00
parent 61d9bca581
commit b9f28bc508
2 changed files with 12 additions and 6 deletions

View file

@ -34,7 +34,6 @@ const struct shtable2 shtab_aliases[] =
#endif /* SHOPT_FS_3D */ #endif /* SHOPT_FS_3D */
"autoload", NV_NOFREE, "typeset -fu", "autoload", NV_NOFREE, "typeset -fu",
"compound", NV_NOFREE|BLT_DCL, "typeset -C", "compound", NV_NOFREE|BLT_DCL, "typeset -C",
"fc", NV_NOFREE, "hist",
"float", NV_NOFREE|BLT_DCL, "typeset -lE", "float", NV_NOFREE|BLT_DCL, "typeset -lE",
"functions", NV_NOFREE, "typeset -f", "functions", NV_NOFREE, "typeset -f",
"hash", NV_NOFREE, "alias -t --", "hash", NV_NOFREE, "alias -t --",
@ -48,7 +47,6 @@ const struct shtable2 shtab_aliases[] =
"stop", NV_NOFREE, "kill -s STOP", "stop", NV_NOFREE, "kill -s STOP",
"suspend", NV_NOFREE, "kill -s STOP $$", "suspend", NV_NOFREE, "kill -s STOP $$",
#endif /*SIGTSTP */ #endif /*SIGTSTP */
"type", NV_NOFREE, "whence -v",
"", 0, (char*)0 "", 0, (char*)0
}; };

View file

@ -792,8 +792,6 @@ but can be unset or redefined:
.TP .TP
.B "compound=\(fmtypeset \-C\(fm" .B "compound=\(fmtypeset \-C\(fm"
.TP .TP
.B "fc=hist"
.TP
.B "float=\(fmtypeset \-lE\(fm" .B "float=\(fmtypeset \-lE\(fm"
.TP .TP
.B "functions=\(fmtypeset \-f\(fm" .B "functions=\(fmtypeset \-f\(fm"
@ -815,8 +813,6 @@ but can be unset or redefined:
.B "stop=\(fmkill \-s \s-1STOP\s+1\(fm" .B "stop=\(fmkill \-s \s-1STOP\s+1\(fm"
.TP .TP
.B "suspend=\(fmkill \-s \s-1STOP\s+1 $$\(fm" .B "suspend=\(fmkill \-s \s-1STOP\s+1 $$\(fm"
.TP
.B "type=\(fmwhence \-v\(fm"
.PD .PD
.RE .RE
.SS Tilde Substitution. .SS Tilde Substitution.
@ -5990,6 +5986,14 @@ Does nothing, and exits 1. Used with
.B until .B until
for infinite loops. for infinite loops.
.TP .TP
.PD 0
\f3fc\fP \*(OK \f3\-e\fP \f2ename\^\fP \ \*(CK \*(OK \f3\-nlr\^\fP \*(CK \*(OK \f2first\^\fP \*(OK \f2last\^\fP \*(CK \*(CK
.TP
\f3fc \-s \fP \*(OK \f2old\fP\f3\=\fP\f2new\^\fP \*(CK \*(OK \f2command\^\fP \*(CK
.PD
The same as
.BR hist .
.TP
\f3fg\fP \*(OK \f2job\^\fP.\|.\|. \*(CK \f3fg\fP \*(OK \f2job\^\fP.\|.\|. \*(CK
This command is only on systems that support job control. This command is only on systems that support job control.
Each Each
@ -7240,6 +7244,10 @@ Does nothing, and exits 0. Used with
.B while .B while
for infinite loops. for infinite loops.
.TP .TP
\f3type\fP \*(OK \f3\-afp\fP \*(CK \f2name\^\fP .\|.\|.
The same as
.BR whence\ -v .
.TP
\(dg\(dg \f3typeset\fP \*(OK \f3\(+-ACHSfblmnprtux\^\fP \*(CK \*(OK \f3\(+-EFLRXZi\*(OK\f2n\^\fP\*(CK \*(CK \*(OK \f3\+-M \*(OK \f2mapname\fP \*(CK \*(CK \*(OK \f3\-T \*(OK \f2tname\fP=(\f2assign_list\fP) \*(CK \*(CK \*(OK \f3\-h \f2str\fP \*(CK \*(OK \f3\-a\fP \*(OK\f2type\fP\*(CK \*(CK \*(OK \f2vname\^\fP\*(OK\f3=\fP\f2value\^\fP \*(CK \^ \*(CK .\|.\|. \(dg\(dg \f3typeset\fP \*(OK \f3\(+-ACHSfblmnprtux\^\fP \*(CK \*(OK \f3\(+-EFLRXZi\*(OK\f2n\^\fP\*(CK \*(CK \*(OK \f3\+-M \*(OK \f2mapname\fP \*(CK \*(CK \*(OK \f3\-T \*(OK \f2tname\fP=(\f2assign_list\fP) \*(CK \*(CK \*(OK \f3\-h \f2str\fP \*(CK \*(OK \f3\-a\fP \*(OK\f2type\fP\*(CK \*(CK \*(OK \f2vname\^\fP\*(OK\f3=\fP\f2value\^\fP \*(CK \^ \*(CK .\|.\|.
Sets attributes and values for shell variables and functions. Sets attributes and values for shell variables and functions.
When invoked inside a function defined with the When invoked inside a function defined with the