mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Make the 'history' and 'r' commands builtins (#76)
With this change no more preset aliases exist, so the preset alias tables can be safely removed. All ksh commands can now be used without 'unalias -a' removing them, even in interactive shells. Additionally, the history and r commands are no longer limited to being used in interactive shells. src/cmd/ksh93/bltins/hist.c: - Implement the history and r commands as builtins. Also guarantee lflag is set to one by avoiding 'lflag++'. src/cmd/ksh93/Makefile, src/cmd/ksh93/Mamfile, src/cmd/ksh93/sh/main.c, src/cmd/ksh93/sh/init.c, src/cmd/ksh93/data/aliases.c: - Remove the table of predefined aliases because the last few have been removed. During init the alias tree is now initialized the same way as the function tree. src/cmd/ksh93/bltins/typeset.c: - Remove the bugfix for unsetting predefined aliases because it is now a no-op. Aliases are no longer able to have the NV_NOFREE attribute. src/cmd/ksh93/tests/alias.sh: - Remove the regression test for unsetting predefined aliases since those no longer exist. src/cmd/ksh93/data/builtins.c: - Update sh_opthist[] for 'hist --man', etc. src/cmd/ksh93/sh.1: - Remove the list of preset aliases since those no longer exist. - Document history and r as builtins instead of preset aliases. Co-authored-by: Martijn Dekker <martijn@inlv.org>
This commit is contained in:
parent
17f81ebedb
commit
03224ae3af
13 changed files with 47 additions and 100 deletions
|
@ -777,20 +777,9 @@ not while they are executed.
|
|||
Therefore,
|
||||
for an alias to take effect,
|
||||
the
|
||||
.B
|
||||
alias
|
||||
.B alias
|
||||
definition command has to be executed before
|
||||
the command which references the alias is read.
|
||||
.PP
|
||||
The following aliases
|
||||
are compiled into the shell
|
||||
but can be unset or redefined:
|
||||
.RS 20
|
||||
.PD 0
|
||||
.TP
|
||||
.B "history=\(fmhist \-l\(fm"
|
||||
.TP
|
||||
.B "r=\(fmhist \-s\(fm"
|
||||
.PD
|
||||
.RE
|
||||
.SS Tilde Substitution.
|
||||
|
@ -4367,9 +4356,9 @@ to re-execute the command.
|
|||
In this case a substitution parameter of the form
|
||||
\f2old\fP\f3=\fP\f2new\fP
|
||||
can be used to modify the command before execution.
|
||||
For example, with the preset alias
|
||||
For example, with the builtin
|
||||
.BR r ,
|
||||
which is aliased to
|
||||
which is functionally equivalent to
|
||||
.BR "\(fmhist \-s\(fm" ,
|
||||
typing
|
||||
`\f3r bad=good c\fP'
|
||||
|
@ -6211,6 +6200,11 @@ after the optional substitution
|
|||
\f2old\^\fP\f3=\fP\f2new\^\fP
|
||||
is performed.
|
||||
.TP
|
||||
\f3history\fP \*(OK \f3\-nr\^\fP \*(CK \*(OK \f2first\^\fP \*(OK \f2last\^\fP \*(CK \*(CK
|
||||
Lists commands in the history file.
|
||||
The same as
|
||||
.BR hist\ \-l .
|
||||
.TP
|
||||
\(dd \f3integer\fP \f2vname\fP\*(OK\f3=\fP\f2value\^\fP\*(CK .\|.\|.
|
||||
Declares each \f2vname\fP to be a long integer number.
|
||||
The same as
|
||||
|
@ -6624,6 +6618,11 @@ or
|
|||
on the command line
|
||||
determines which method is used.
|
||||
.TP
|
||||
\f3r\fP \*(OK \f2old\fP\f3\=\fP\f2new\^\fP \*(CK \*(OK \f2command\^\fP \*(CK
|
||||
Reexecutes a command in the history file.
|
||||
The same as
|
||||
.BR hist\ \-s .
|
||||
.TP
|
||||
\f3read\fP \*(OK \f3\-ACSprsv\^\fP \*(CK \*(OK \f3\-d\fP \f2delim \^\fP\*(CK \*(OK \f3\-n\fP \f2n \^\fP\*(CK \*(OK \*(OK \f3\-N\fP \f2n \^\fP\*(CK \*(OK \f3\-t\fP \f2timeout \^\fP\*(CK \*(OK \f3\-u\fP \f2unit \^\fP\*(CK \*(OK \f2vname\f3?\f2prompt\^\f1 \*(CK \*(OK \f2vname\^\fP .\|.\|. \*(CK
|
||||
The shell input mechanism.
|
||||
One line is read and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue