From b9f28bc5089f85a39245f50d1036c1d74d832c0e Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Sun, 7 Jun 2020 17:55:56 +0200 Subject: [PATCH] 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) --- src/cmd/ksh93/data/aliases.c | 2 -- src/cmd/ksh93/sh.1 | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/cmd/ksh93/data/aliases.c b/src/cmd/ksh93/data/aliases.c index 61e0b2dec..9b717c180 100644 --- a/src/cmd/ksh93/data/aliases.c +++ b/src/cmd/ksh93/data/aliases.c @@ -34,7 +34,6 @@ const struct shtable2 shtab_aliases[] = #endif /* SHOPT_FS_3D */ "autoload", NV_NOFREE, "typeset -fu", "compound", NV_NOFREE|BLT_DCL, "typeset -C", - "fc", NV_NOFREE, "hist", "float", NV_NOFREE|BLT_DCL, "typeset -lE", "functions", NV_NOFREE, "typeset -f", "hash", NV_NOFREE, "alias -t --", @@ -48,7 +47,6 @@ const struct shtable2 shtab_aliases[] = "stop", NV_NOFREE, "kill -s STOP", "suspend", NV_NOFREE, "kill -s STOP $$", #endif /*SIGTSTP */ - "type", NV_NOFREE, "whence -v", "", 0, (char*)0 }; diff --git a/src/cmd/ksh93/sh.1 b/src/cmd/ksh93/sh.1 index 4a7bf1e1a..e1055265b 100644 --- a/src/cmd/ksh93/sh.1 +++ b/src/cmd/ksh93/sh.1 @@ -792,8 +792,6 @@ but can be unset or redefined: .TP .B "compound=\(fmtypeset \-C\(fm" .TP -.B "fc=hist" -.TP .B "float=\(fmtypeset \-lE\(fm" .TP .B "functions=\(fmtypeset \-f\(fm" @@ -815,8 +813,6 @@ but can be unset or redefined: .B "stop=\(fmkill \-s \s-1STOP\s+1\(fm" .TP .B "suspend=\(fmkill \-s \s-1STOP\s+1 $$\(fm" -.TP -.B "type=\(fmwhence \-v\(fm" .PD .RE .SS Tilde Substitution. @@ -5990,6 +5986,14 @@ Does nothing, and exits 1. Used with .B until for infinite loops. .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 This command is only on systems that support job control. Each @@ -7240,6 +7244,10 @@ Does nothing, and exits 0. Used with .B while for infinite loops. .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 .\|.\|. Sets attributes and values for shell variables and functions. When invoked inside a function defined with the