From 8dd9cfd4a0be6bc93a51cf18d0f92819d346aba9 Mon Sep 17 00:00:00 2001 From: Johnothan King Date: Tue, 20 May 2025 00:40:35 -0700 Subject: [PATCH 1/4] Added -p and -l options to hash, umask, builtin and trap built-ins The following options have been added for printing reinputtable command output: umask -p (ksh93v- backport) builtin -p (ksh93v- backport) hash -l Additionally, 'trap -l' has been backported from ksh93v- for listing signals. --- NEWS | 7 ++++++ src/cmd/ksh93/bltins/trap.c | 12 ++++++++-- src/cmd/ksh93/bltins/typeset.c | 40 ++++++++++++++++++++++++++++------ src/cmd/ksh93/bltins/umask.c | 14 +++++++----- src/cmd/ksh93/data/builtins.c | 20 ++++++++++++----- src/cmd/ksh93/sh.1 | 31 ++++++++++++++++++++++---- src/cmd/ksh93/sh/nvtree.c | 4 ++++ 7 files changed, 104 insertions(+), 24 deletions(-) diff --git a/NEWS b/NEWS index 2e03c4b823ee..1caef2beef40 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,13 @@ For full details, see the git log at: https://github.com/ksh93/ksh Uppercase BUG_* IDs are shell bug IDs as used by the Modernish shell library. +2025-05-20: + +- [v1.1] Added 'hash -l', 'builtin -p', and 'umask -p', which can be used to + print reinputtable commands for recreating the current hash table, builtin + state and umask. (The latter two options are ksh93v- backports.) +- [v1.1] Backported 'trap -l' from ksh93v- for listing signals. + 2025-05-15: - Fixed an issue that prevented Unicode code points in $'...' strings and diff --git a/src/cmd/ksh93/bltins/trap.c b/src/cmd/ksh93/bltins/trap.c index cf06556aadc0..a2a89ee5af8e 100644 --- a/src/cmd/ksh93/bltins/trap.c +++ b/src/cmd/ksh93/bltins/trap.c @@ -16,7 +16,7 @@ * * ***********************************************************************/ /* - * trap [-p] action sig... + * trap [-lp] action sig... * kill [-lL] [sig...] * kill [-n signum] [-s signame] pid... * stop job... @@ -44,11 +44,14 @@ static void sig_list(int); int b_trap(int argc,char *argv[],Shbltin_t *context) { char *arg = argv[1]; - int sig, clear = 0, dflag = 0, pflag = 0; + int sig, clear = 0, dflag = 0, lflag = 0, pflag = 0; NOT_USED(argc); NOT_USED(context); while (sig = optget(argv, sh_opttrap)) switch (sig) { + case 'l': + lflag=1; + break; case 'p': pflag=1; break; @@ -66,6 +69,11 @@ int b_trap(int argc,char *argv[],Shbltin_t *context) errormsg(SH_DICT,ERROR_usage(2),"%s", optusage(NULL)); UNREACHABLE(); } + if(lflag) + { + sig_list(-1); + return(0); + } if(arg = *argv) { char *action = arg; diff --git a/src/cmd/ksh93/bltins/typeset.c b/src/cmd/ksh93/bltins/typeset.c index 8bbc1c6a751c..c027e3a8d14e 100644 --- a/src/cmd/ksh93/bltins/typeset.c +++ b/src/cmd/ksh93/bltins/typeset.c @@ -29,8 +29,8 @@ * nameref [options] [arg...] * alias [-ptx] [arg...] * unalias [-a] [arg...] - * hash [-r] [utility...] - * builtin [-dls] [-f file] [name...] + * hash [-lr] [utility...] + * builtin [-dlps] [-f file] [name...] * set [options] [name...] * unset [-fnv] [name...] * @@ -138,7 +138,7 @@ int b_alias(int argc,char *argv[],Shbltin_t *context) { unsigned flag = NV_NOARRAY|NV_NOSCOPE|NV_ASSIGN; Dt_t *troot; - int rflag=0, xflag=0, n; + int rflag=0, xflag=0, lflag=0, n; struct tdata tdata; NOT_USED(argc); NOT_USED(context); @@ -155,6 +155,9 @@ int b_alias(int argc,char *argv[],Shbltin_t *context) tdata.aflag = *argv[1]; while((n = optget(argv, *argv[0]=='h' ? sh_opthash : sh_optalias))) switch(n) { + case 'l': + lflag = 1; + /* FALLTHROUGH */ case 'p': tdata.prefix = argv[0]; tdata.pflag = 1; @@ -167,7 +170,7 @@ int b_alias(int argc,char *argv[],Shbltin_t *context) xflag = 1; break; case 'r': - rflag=1; + rflag = 1; break; case ':': if(sh.shcomp) @@ -181,6 +184,11 @@ int b_alias(int argc,char *argv[],Shbltin_t *context) error(ERROR_USAGE|ERROR_OUTPUT, STDOUT_FILENO, "%s", opt_info.arg); return 0; } + if(lflag && rflag) + { + errormsg(SH_DICT,2,"the -l and -r options cannot be combined"); + error_info.errors++; + } if(error_info.errors) { errormsg(SH_DICT,ERROR_usage(2),"%s",optusage(NULL)); @@ -196,7 +204,7 @@ int b_alias(int argc,char *argv[],Shbltin_t *context) if(tdata.pflag) { troot = sh_subtracktree(0); /* use existing hash table */ - tdata.aflag = '+'; /* for 'alias -pt', don't add anything to the hash table */ + tdata.aflag = '+'; /* for -p/-l, don't add anything to the hash table */ } else { @@ -1131,7 +1139,7 @@ int b_builtin(int argc,char *argv[],Shbltin_t *context) char *arg=0, *name; int n, r=0, flag=0; Namval_t *np; - long dlete=0; + int dlete=0; struct tdata tdata; Shbltin_f addr; Stk_t *stkp; @@ -1166,6 +1174,9 @@ int b_builtin(int argc,char *argv[],Shbltin_t *context) list = 1; #endif break; + case 'p': + tdata.prefix = argv[0]; + break; case ':': errormsg(SH_DICT,2, "%s", opt_info.arg); break; @@ -1209,6 +1220,11 @@ int b_builtin(int argc,char *argv[],Shbltin_t *context) #endif /* SHOPT_DYNAMIC */ if(*argv==0 && !dlete) { +#if SHOPT_DYNAMIC + if(tdata.prefix) + for(n = 0; n < nlib; n++) + sfprintf(sfstdout, "%s -f %s\n", tdata.prefix, liblist[n].lib); +#endif print_scan(sfstdout, flag, sh.bltin_tree, 1, &tdata); return 0; } @@ -1216,6 +1232,12 @@ int b_builtin(int argc,char *argv[],Shbltin_t *context) flag = stktell(stkp); while(arg = *argv) { + if(tdata.prefix) + { + sfprintf(sfstdout,"%s %s\n",tdata.prefix,arg); + argv++; + continue; + } name = path_basename(arg); sfwrite(stkp,"b_",2); sfputr(stkp,name,0); @@ -1474,8 +1496,12 @@ static int print_namval(Sfio_t *file,Namval_t *np,int flag, struct tdata *tp) if(nv_isattr(np,NV_NOPRINT|NV_INTEGER)==NV_NOPRINT) { if(is_abuiltin(np)) + { + if(tp->prefix) + sfputr(file,tp->prefix,' '); sfputr(file,nv_name(np),'\n'); - return 0; + } + return(0); } if(nv_istable(np)) { diff --git a/src/cmd/ksh93/bltins/umask.c b/src/cmd/ksh93/bltins/umask.c index 7b9819dd327d..352bb18d0f44 100644 --- a/src/cmd/ksh93/bltins/umask.c +++ b/src/cmd/ksh93/bltins/umask.c @@ -16,7 +16,7 @@ * * ***********************************************************************/ /* - * umask [-S] [mask] + * umask [-pS] [mask] * * David Korn * AT&T Labs @@ -39,12 +39,15 @@ int b_umask(int argc,char *argv[],Shbltin_t *context) { char *mask; - int flag = 0, sflag = 0; + int flag = 0, pflag = 0, sflag = 0; NOT_USED(context); while((argc = optget(argv,sh_optumask))) switch(argc) { + case 'p': + pflag = 1; + break; case 'S': - sflag++; + sflag = 1; break; case ':': errormsg(SH_DICT,2, "%s", opt_info.arg); @@ -93,11 +96,12 @@ int b_umask(int argc,char *argv[],Shbltin_t *context) } else { + char *prefix = pflag ? "umask " : ""; umask(flag=umask(0)); if(sflag) - sfprintf(sfstdout,"%s\n",fmtperm(~flag&0777)); + sfprintf(sfstdout,"%s%s\n",prefix,fmtperm(~flag&0777)); else - sfprintf(sfstdout,"%0#4o\n",flag); + sfprintf(sfstdout,"%s%0#4o\n",prefix,flag); } return 0; } diff --git a/src/cmd/ksh93/data/builtins.c b/src/cmd/ksh93/data/builtins.c index 31d6f8abbf94..5eb7dacede3a 100644 --- a/src/cmd/ksh93/data/builtins.c +++ b/src/cmd/ksh93/data/builtins.c @@ -392,7 +392,7 @@ const char sh_optalias[] = ; const char sh_optbuiltin[] = -"[-1c?\n@(#)$Id: builtin (ksh 93u+m) 2022-07-03 $\n]" +"[-1c?\n@(#)$Id: builtin (ksh 93u+m) 2025-05-20 $\n]" "[--catalog?" SH_DICT "]" "[+NAME?builtin - add, delete, or display shell built-ins]" "[+DESCRIPTION?\bbuiltin\b can be used to add, delete, or display " @@ -441,6 +441,9 @@ const char sh_optbuiltin[] = "[f]:[lib?Not supported.]" "[l?No effect.]" #endif /* SHOPT_DYNAMIC */ +"[p?Causes the output to be in the form of \bbuiltin\b commands that can be " + "used as input to the shell to recreate the current set of " + "builtins.]" "[s?Display only the special built-ins.]" "\n" "\n[pathname ...]\n" @@ -965,7 +968,7 @@ _JOB_ ; const char sh_opthash[] = -"[-1c?\n@(#)$Id: hash (ksh 93u+m) 2024-06-30 $\n]" +"[-1c?\n@(#)$Id: hash (ksh 93u+m) 2025-05-20 $\n]" "[--catalog?" SH_DICT "]" "[+NAME?hash - display the locations of recently used programs]" "[+DESCRIPTION?\bhash\b displays or modifies the hash table with the " @@ -974,7 +977,10 @@ const char sh_opthash[] = "table. Otherwise, \bhash\b performs a \bPATH\b search for each " "\autility\a supplied and adds the result to the hash table. " "An error is issued for each \autility\a that is not found.]" -"[r?Empty the hash table. This can also be achieved by resetting \bPATH\b.]" +"[l?Causes the output to be in the form of hash commands that can be used " + "as input to the shell to recreate the current tracked aliases.]" +"[r?Empty the hash table. This can also be achieved by resetting \bPATH\b. " + "This option cannot be combined with the \b-l\b option.]" "\n" "\n[utility...]\n" "\n" @@ -1502,7 +1508,7 @@ const char sh_optreadonly[] = "[+?\breadonly\b is built in to the shell as a declaration command so that " "field splitting and pathname expansion are not performed on " "the arguments. Tilde expansion occurs on \avalue\a.]" -"[p?Causes the output to be in a form of \breadonly\b commands that can be " +"[p?Causes the output to be in the form of \breadonly\b commands that can be " "used as input to the shell to recreate the current set of " "readonly variables.]" "\n" @@ -1758,7 +1764,7 @@ const char sh_optsleep[] = ; const char sh_opttrap[] = -"[-1c?\n@(#)$Id: trap (AT&T Research) 1999-07-17 $\n]" +"[-1c?\n@(#)$Id: trap (ksh 93u+m) 2025-05-20 $\n]" "[--catalog?" SH_DICT "]" "[+NAME?trap - trap signals and conditions]" "[+DESCRIPTION?\btrap\b is a special built-in that defines actions to be " @@ -1797,6 +1803,7 @@ const char sh_opttrap[] = "non-zero exit status, but does not terminate the invoking shell.]" "[+?If no \aaction\a or \acondition\as are specified then all the current " "trap settings are written to standard output.]" +"[l?Output the list of signals and their numbers to standard output.]" "[p?Causes the current traps to be output in a format that can be processed " "as input to the shell to recreate the current traps.]" "\n" @@ -1994,7 +2001,7 @@ const char sh_opttimes[] = ; const char sh_optumask[] = -"[-1c?\n@(#)$Id: umask (AT&T Research) 1999-04-07 $\n]" +"[-1c?\n@(#)$Id: umask (ksh 93u+m) 2025-05-20 $\n]" "[--catalog?" SH_DICT "]" "[+NAME?umask - get or set the file creation mask]" "[+DESCRIPTION?\bumask\b sets the file creation mask of the current " @@ -2009,6 +2016,7 @@ const char sh_optumask[] = "file creation mask for the current process to standard output.]" "[S?Causes the file creation mask to be written or treated as a symbolic value " "rather than an octal number.]" +"[p?Write the file creation mask in a format that can be used for reinput.]" "\n" "\n[mask]\n" "\n" diff --git a/src/cmd/ksh93/sh.1 b/src/cmd/ksh93/sh.1 index 32997b24b367..18004794c8fc 100644 --- a/src/cmd/ksh93/sh.1 +++ b/src/cmd/ksh93/sh.1 @@ -6512,6 +6512,12 @@ whose name is .B lib_init() and invokes this function with an argument of .BR 0 . +The +.B \-p +option causes the output to be in the form of +.B builtin +commands that can be used as input to the shell to recreate the current +set of builtins. .TP .PD 0 \f3cd\fP \*(OK \f3\-L\fP \*(CK \*(OK \f3-eP\fP \*(CK \*(OK \f2arg\^\fP \*(CK @@ -7010,7 +7016,7 @@ The option .B # can only be specified as the first option. .TP -\f3hash\fP \*(OK \f3\-r\fP \f2\^\fP\*(CK \*(OK \f2utility\^\fP ... \*(CK +\f3hash\fP \*(OK \f3\-lr\fP \f2\^\fP\*(CK \*(OK \f2utility\^\fP ... \*(CK .B hash displays or modifies the hash table with the locations of recently used programs. If given no arguments, it lists all command/path associations @@ -7025,9 +7031,20 @@ An error message is issued for each .I utility\^ that is not found and the exit status is non-zero if any were not found. The +.B \-l +option causes the output to be in the form of +.B hash +commands that can be reinput to recreate the current table of +tracked aliases. +The .B \-r option empties the hash table. This can also be achieved by resetting -.BR PATH. +.BR PATH . +The +.B \-r +and +.B \-l +options cannot be used simultaneously. .TP .PD 0 \f3hist\fP \*(OK \f3\-e\fP \f2ename\^\fP \ \*(CK \*(OK \f3\-N\fP \f2num\^\fP \*(CK \*(OK \f3\-Enlr\^\fP \*(CK \*(OK \f2first\^\fP \*(OK \f2last\^\fP \*(CK \*(CK @@ -8457,7 +8474,7 @@ Seconds are zero-padded unless the .B posix shell option is on. .TP -\(dg \f3trap\fP \*(OK \f3\-p\fP \*(CK \*(OK \f2action\^\fP \*(CK \*(OK \f2sig\^\fP \*(CK .\|.\|. +\(dg \f3trap\fP \*(OK \f3\-lp\fP \*(CK \*(OK \f2action\^\fP \*(CK \*(OK \f2sig\^\fP \*(CK .\|.\|. The .B \-p option causes the trap @@ -8583,6 +8600,9 @@ or .B return without an argument in a trap action will preserve the exit status of the command that invoked the trap. +The +.B \-l +option lists the signals and their numbers to standard output. .TP \f3true\fP Does nothing, and exits 0. Used with @@ -9137,7 +9157,7 @@ If no option is given, is assumed. .RE .TP -\f3umask\fP \*(OK \f3\-S\fP \*(CK \*(OK \f2mask\^\fP \*(CK +\f3umask\fP \*(OK \f3\-pS\fP \*(CK \*(OK \f2mask\^\fP \*(CK The user file-creation mask is set to .I mask\^ (see @@ -9160,6 +9180,9 @@ The option causes the mode to be printed as a symbolic value. Otherwise, the mask is printed in octal. +The +.B \-p +option writes the file creation mask in a format that can be used for reinput. .TP \f3unalias\fP \*(OK \f3\-a\fP \*(CK \f2name\^\fP .\|.\|. The aliases diff --git a/src/cmd/ksh93/sh/nvtree.c b/src/cmd/ksh93/sh/nvtree.c index beda555f79d4..9f5391326149 100644 --- a/src/cmd/ksh93/sh/nvtree.c +++ b/src/cmd/ksh93/sh/nvtree.c @@ -432,7 +432,11 @@ void nv_attribute(Namval_t *np,Sfio_t *out,char *prefix,int noname) } } else if(prefix && *prefix) + { sfputr(out,prefix,' '); + if(*prefix=='h') + return; /* don't print 'hash -t' */ + } for(tp = shtab_attributes; *tp->sh_name;tp++) { val = tp->sh_number; From 54a9f0bfbc58aa9f77809acf0044d38b16799822 Mon Sep 17 00:00:00 2001 From: Johnothan King Date: Tue, 20 May 2025 16:15:19 -0700 Subject: [PATCH 2/4] Revert to 'a form of' --- src/cmd/ksh93/data/builtins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/ksh93/data/builtins.c b/src/cmd/ksh93/data/builtins.c index 5eb7dacede3a..e431870fa11a 100644 --- a/src/cmd/ksh93/data/builtins.c +++ b/src/cmd/ksh93/data/builtins.c @@ -1508,7 +1508,7 @@ const char sh_optreadonly[] = "[+?\breadonly\b is built in to the shell as a declaration command so that " "field splitting and pathname expansion are not performed on " "the arguments. Tilde expansion occurs on \avalue\a.]" -"[p?Causes the output to be in the form of \breadonly\b commands that can be " +"[p?Causes the output to be in a form of \breadonly\b commands that can be " "used as input to the shell to recreate the current set of " "readonly variables.]" "\n" From 06e0312117b2b74ca6df67be2b2ddb168f658fe6 Mon Sep 17 00:00:00 2001 From: Johnothan King Date: Fri, 30 May 2025 13:57:54 -0700 Subject: [PATCH 3/4] Fix builtin -p bug backported from 93v- --- src/cmd/ksh93/bltins/typeset.c | 8 +++++++- src/cmd/ksh93/tests/builtins.sh | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/cmd/ksh93/bltins/typeset.c b/src/cmd/ksh93/bltins/typeset.c index 165efa222e8d..1fc19e432cf9 100644 --- a/src/cmd/ksh93/bltins/typeset.c +++ b/src/cmd/ksh93/bltins/typeset.c @@ -1234,7 +1234,13 @@ int b_builtin(int argc,char *argv[],Shbltin_t *context) { if(tdata.prefix) { - sfprintf(sfstdout,"%s %s\n",tdata.prefix,arg); + if(np = nv_search(arg,sh.bltin_tree,0)) + sfprintf(sfstdout,"%s %s\n",tdata.prefix,arg); + else + { + errormsg(SH_DICT,ERROR_exit(0),"%s: %s",*argv,"not found"); + r = 1; + } argv++; continue; } diff --git a/src/cmd/ksh93/tests/builtins.sh b/src/cmd/ksh93/tests/builtins.sh index 6f29ba253349..9efc23c96d6f 100755 --- a/src/cmd/ksh93/tests/builtins.sh +++ b/src/cmd/ksh93/tests/builtins.sh @@ -1644,6 +1644,17 @@ do case $bltin in [[ $got == " version "* ]] || err_exit "$bltin does not support --version (got $(printf %q "$got"))" done 3< <(builtin) +# ====== +# builtin -p must produce an error if the given builtin doesn't exist +# https://github.com/ksh93/ksh/pull/856#issuecomment-2923384587 +exp='builtin: not: not found +builtin: a: not found +builtin: built-in: not found +builtin type' +got=$(set +x; redirect 2>&1; builtin -p not a built-in type) +[[ $exp == $got ]] || err_exit "builtin -p doesn\'t function correctly when given arguments" \ + "(expected $(printf %q "$exp"), got $(printf %q "$got"))" + # ====== # https://github.com/ksh-community/ksh/issues/19 # https://github.com/ksh93/ksh/issues/602 From 91efa00e2e16ff0519d0551a810a09f260d7959b Mon Sep 17 00:00:00 2001 From: Johnothan King Date: Wed, 25 Jun 2025 16:41:27 -0700 Subject: [PATCH 4/4] rm rejected hash -l --- NEWS | 9 ++++----- src/cmd/ksh93/bltins/typeset.c | 16 ++++------------ src/cmd/ksh93/data/builtins.c | 13 +++++-------- src/cmd/ksh93/sh.1 | 13 +------------ src/cmd/ksh93/sh/nvtree.c | 4 ---- 5 files changed, 14 insertions(+), 41 deletions(-) diff --git a/NEWS b/NEWS index fc865106cbf5..08c0c6c039ab 100644 --- a/NEWS +++ b/NEWS @@ -2,12 +2,11 @@ This documents significant changes in the dev branch of ksh 93u+m. For full details, see the git log at: https://github.com/ksh93/ksh Uppercase BUG_* IDs are shell bug IDs as used by the Modernish shell library. +2025-06-25: -2025-06-18: - -- [v1.1] Added 'hash -l', 'builtin -p', and 'umask -p', which can be used to - print reinputtable commands for recreating the current hash table, builtin - state and umask. (The latter two options are ksh93v- backports.) +- [v1.1] Backported 'builtin -p' and 'umask -p' from ksh93v-, which + can be used to print reinputtable commands for recreating the builtin + table state and umask. - [v1.1] Backported 'trap -l' from ksh93v- for listing signals. 2025-06-14: diff --git a/src/cmd/ksh93/bltins/typeset.c b/src/cmd/ksh93/bltins/typeset.c index 1fc19e432cf9..b15e13cb8d1c 100644 --- a/src/cmd/ksh93/bltins/typeset.c +++ b/src/cmd/ksh93/bltins/typeset.c @@ -29,7 +29,7 @@ * nameref [options] [arg...] * alias [-ptx] [arg...] * unalias [-a] [arg...] - * hash [-lr] [utility...] + * hash [-r] [utility...] * builtin [-dlps] [-f file] [name...] * set [options] [name...] * unset [-fnv] [name...] @@ -138,7 +138,7 @@ int b_alias(int argc,char *argv[],Shbltin_t *context) { unsigned flag = NV_NOARRAY|NV_NOSCOPE|NV_ASSIGN; Dt_t *troot; - int rflag=0, xflag=0, lflag=0, n; + int rflag=0, xflag=0, n; struct tdata tdata; NOT_USED(argc); NOT_USED(context); @@ -155,9 +155,6 @@ int b_alias(int argc,char *argv[],Shbltin_t *context) tdata.aflag = *argv[1]; while((n = optget(argv, *argv[0]=='h' ? sh_opthash : sh_optalias))) switch(n) { - case 'l': - lflag = 1; - /* FALLTHROUGH */ case 'p': tdata.prefix = argv[0]; tdata.pflag = 1; @@ -184,11 +181,6 @@ int b_alias(int argc,char *argv[],Shbltin_t *context) error(ERROR_USAGE|ERROR_OUTPUT, STDOUT_FILENO, "%s", opt_info.arg); return 0; } - if(lflag && rflag) - { - errormsg(SH_DICT,2,"the -l and -r options cannot be combined"); - error_info.errors++; - } if(error_info.errors) { errormsg(SH_DICT,ERROR_usage(2),"%s",optusage(NULL)); @@ -204,7 +196,7 @@ int b_alias(int argc,char *argv[],Shbltin_t *context) if(tdata.pflag) { troot = sh_subtracktree(0); /* use existing hash table */ - tdata.aflag = '+'; /* for -p/-l, don't add anything to the hash table */ + tdata.aflag = '+'; /* for 'alias -pt', don't add anything to the hash table */ } else { @@ -1521,7 +1513,7 @@ static int print_namval(Sfio_t *file,Namval_t *np,int flag, struct tdata *tp) sfputr(file,tp->prefix,' '); sfputr(file,nv_name(np),'\n'); } - return(0); + return 0; } if(nv_istable(np)) { diff --git a/src/cmd/ksh93/data/builtins.c b/src/cmd/ksh93/data/builtins.c index e431870fa11a..c2a02b0b2cf9 100644 --- a/src/cmd/ksh93/data/builtins.c +++ b/src/cmd/ksh93/data/builtins.c @@ -392,7 +392,7 @@ const char sh_optalias[] = ; const char sh_optbuiltin[] = -"[-1c?\n@(#)$Id: builtin (ksh 93u+m) 2025-05-20 $\n]" +"[-1c?\n@(#)$Id: builtin (ksh 93u+m) 2025-06-25 $\n]" "[--catalog?" SH_DICT "]" "[+NAME?builtin - add, delete, or display shell built-ins]" "[+DESCRIPTION?\bbuiltin\b can be used to add, delete, or display " @@ -968,7 +968,7 @@ _JOB_ ; const char sh_opthash[] = -"[-1c?\n@(#)$Id: hash (ksh 93u+m) 2025-05-20 $\n]" +"[-1c?\n@(#)$Id: hash (ksh 93u+m) 2024-06-30 $\n]" "[--catalog?" SH_DICT "]" "[+NAME?hash - display the locations of recently used programs]" "[+DESCRIPTION?\bhash\b displays or modifies the hash table with the " @@ -977,10 +977,7 @@ const char sh_opthash[] = "table. Otherwise, \bhash\b performs a \bPATH\b search for each " "\autility\a supplied and adds the result to the hash table. " "An error is issued for each \autility\a that is not found.]" -"[l?Causes the output to be in the form of hash commands that can be used " - "as input to the shell to recreate the current tracked aliases.]" -"[r?Empty the hash table. This can also be achieved by resetting \bPATH\b. " - "This option cannot be combined with the \b-l\b option.]" +"[r?Empty the hash table. This can also be achieved by resetting \bPATH\b.]" "\n" "\n[utility...]\n" "\n" @@ -1764,7 +1761,7 @@ const char sh_optsleep[] = ; const char sh_opttrap[] = -"[-1c?\n@(#)$Id: trap (ksh 93u+m) 2025-05-20 $\n]" +"[-1c?\n@(#)$Id: trap (ksh 93u+m) 2025-06-25 $\n]" "[--catalog?" SH_DICT "]" "[+NAME?trap - trap signals and conditions]" "[+DESCRIPTION?\btrap\b is a special built-in that defines actions to be " @@ -2001,7 +1998,7 @@ const char sh_opttimes[] = ; const char sh_optumask[] = -"[-1c?\n@(#)$Id: umask (ksh 93u+m) 2025-05-20 $\n]" +"[-1c?\n@(#)$Id: umask (ksh 93u+m) 2025-06-25 $\n]" "[--catalog?" SH_DICT "]" "[+NAME?umask - get or set the file creation mask]" "[+DESCRIPTION?\bumask\b sets the file creation mask of the current " diff --git a/src/cmd/ksh93/sh.1 b/src/cmd/ksh93/sh.1 index 18dd61f25c96..118f532a0c4e 100644 --- a/src/cmd/ksh93/sh.1 +++ b/src/cmd/ksh93/sh.1 @@ -7030,7 +7030,7 @@ The option .B # can only be specified as the first option. .TP -\f3hash\fP \*(OK \f3\-lr\fP \f2\^\fP\*(CK \*(OK \f2utility\^\fP ... \*(CK +\f3hash\fP \*(OK \f3\-r\fP \f2\^\fP\*(CK \*(OK \f2utility\^\fP ... \*(CK .B hash displays or modifies the hash table with the locations of recently used programs. If given no arguments, it lists all command/path associations @@ -7045,20 +7045,9 @@ An error message is issued for each .I utility\^ that is not found and the exit status is non-zero if any were not found. The -.B \-l -option causes the output to be in the form of -.B hash -commands that can be reinput to recreate the current table of -tracked aliases. -The .B \-r option empties the hash table. This can also be achieved by resetting .BR PATH . -The -.B \-r -and -.B \-l -options cannot be used simultaneously. .TP .PD 0 \f3hist\fP \*(OK \f3\-e\fP \f2ename\^\fP \ \*(CK \*(OK \f3\-N\fP \f2num\^\fP \*(CK \*(OK \f3\-Enlr\^\fP \*(CK \*(OK \f2first\^\fP \*(OK \f2last\^\fP \*(CK \*(CK diff --git a/src/cmd/ksh93/sh/nvtree.c b/src/cmd/ksh93/sh/nvtree.c index 9f5391326149..beda555f79d4 100644 --- a/src/cmd/ksh93/sh/nvtree.c +++ b/src/cmd/ksh93/sh/nvtree.c @@ -432,11 +432,7 @@ void nv_attribute(Namval_t *np,Sfio_t *out,char *prefix,int noname) } } else if(prefix && *prefix) - { sfputr(out,prefix,' '); - if(*prefix=='h') - return; /* don't print 'hash -t' */ - } for(tp = shtab_attributes; *tp->sh_name;tp++) { val = tp->sh_number;