Skip to content

Commit

Permalink
Fix various minor problems and update the documentation (#237)
Browse files Browse the repository at this point in the history
These are minor fixes I've accumulated over time. The following
changes are somewhat notable:

- Added a missing entry for 'typeset -s' to the man page.
- Add strftime(3) to the 'see also' section. This and the date(1)
  addition are meant to add onto the documentation for 'printf %T'.
- Removed the man page the entry for ksh reading $PWD/.profile on
  login. That feature was removed in commit aa7713c.
- Added date(1) to the 'see also' section of the man page.
- Note that the 'hash' command can be used instead of 'alias -t' to
  workaround one of the caveats listed in the man page.
- Use an 'out of memory' error message rather than 'out of space'
  when memory allocation fails.
- Replaced backticks with quotes in some places for consistency.
- Added missing documentation for the %P date format.
- Added missing documentation for the printf %Q and %p formats
  (backported from ksh2020: att#1032).
- The comments that show each builtin's options have been updated.
  • Loading branch information
JohnoKing committed Mar 21, 2021
1 parent 2d7e9a0 commit 814b5c6
Show file tree
Hide file tree
Showing 151 changed files with 378 additions and 378 deletions.
14 changes: 7 additions & 7 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,8 @@ Any uppercase BUG_* names are modernish shell bug IDs.
$RANDOM
$LINENO

- Fixed two bugs that caused `unset .sh.lineno` to always produce a memory
fault and `(unset .sh.level)` to memory fault when run in nested
- Fixed two bugs that caused 'unset .sh.lineno' to always produce a memory
fault and '(unset .sh.level)' to memory fault when run in nested
functions.

2020-06-18:
Expand Down Expand Up @@ -880,7 +880,7 @@ Any uppercase BUG_* names are modernish shell bug IDs.
2020-06-13:

- Fixed a timezone name determination bug on FreeBSD that caused the
output from `LC_ALL=C printf '%T' now` to print the wrong time zone name.
output from "LC_ALL=C printf '%T\n' now" to print the wrong time zone name.

2020-06-11:

Expand Down Expand Up @@ -927,14 +927,14 @@ Any uppercase BUG_* names are modernish shell bug IDs.
Emacs editing mode is bugged in ksh93u+ and ksh2020. Let's
say you were to run the following commands after starting
a fresh instance of ksh:
$ alias foo='true'
$ alias foo=true
$ unalias foo
If you type 'a' and then press the up arrow on your keyboard,
ksh will complete 'a' to `alias foo='true'` by doing a reverse
ksh will complete 'a' to 'alias foo=true' by doing a reverse
search for the last command that starts with 'a'.
Run the alias command again, then type 'u' and press the up
arrow key again. If ksh is in Vi mode, you will get `unalias foo`,
but in Emacs mode you will get `alias foo='true'` again.
arrow key again. If ksh is in Vi mode, you will get 'unalias foo',
but in Emacs mode you will get 'alias foo=true' again.
All subsequent commands were ignored as ksh was saving the first
command and only based later searches off of it.

Expand Down
2 changes: 1 addition & 1 deletion docs/ksh/builtins.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ <H3><CENTER><FONT color=red><FONT face=courier>Guidelines for writing <TT>ksh-93
It is best to set the value of the environment variable
<TT>PACKAGE_ast</TT> to the pathname of the directory
containing the development kit.
The <TT>include</TT> directory contains a sub-directory
The <TT>include</TT> directory contains a subdirectory
named <TT>ast</TT> that contains interface prototypes
for functions that you can call from built-ins. The <TT>lib</TT>
directory contains the <TT>ast</TT> library
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/INIT/RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
regress.sh: INPUT and OUTPUT handle -f for printf instead of print
04-06-11 package.sh: make sure $INSTALLROOT/bin is in front of $PATH
package.sh: skip nmake if older than 2000-10-31
04-05-20 package.sh: fix arg vs. package parse with - or '' to disambuguate
04-05-20 package.sh: fix arg vs. package parse with - or '' to disambiguate
04-05-11 package.sh: package verbose update lists closure for package setup
package.sh: add src/lib/libardir to nmake proto bootstrap
regress.sh: probe for rm -u vs. chmod -R u+rwx
Expand Down
16 changes: 8 additions & 8 deletions src/cmd/INIT/mamake.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ buffer(void)
if (buf = state.old)
state.old = state.old->old;
else if (!(buf = newof(0, Buf_t, 1, 0)) || !(buf->buf = newof(0, char, CHUNK, 0)))
report(3, "out of space [buffer]", NiL, (unsigned long)0);
report(3, "out of memory [buffer]", NiL, (unsigned long)0);
buf->end = buf->buf + CHUNK;
buf->nxt = buf->buf;
return buf;
Expand Down Expand Up @@ -418,7 +418,7 @@ appendn(Buf_t* buf, char* str, int n)
i = buf->nxt - buf->buf;
m = (((buf->end - buf->buf) + n + CHUNK + 1) / CHUNK) * CHUNK;
if (!(buf->buf = newof(buf->buf, char, m, 0)))
report(3, "out of space [buffer resize]", NiL, (unsigned long)0);
report(3, "out of memory [buffer resize]", NiL, (unsigned long)0);
buf->end = buf->buf + m;
buf->nxt = buf->buf + i;
}
Expand Down Expand Up @@ -453,7 +453,7 @@ duplicate(char* s)

n = strlen(s);
if (!(t = newof(0, char, n, 1)))
report(3, "out of space [duplicate]", s, (unsigned long)0);
report(3, "out of memory [duplicate]", s, (unsigned long)0);
strcpy(t, s);
return t;
}
Expand All @@ -468,7 +468,7 @@ dictionary(void)
Dict_t* dict;

if (!(dict = newof(0, Dict_t, 1, 0)))
report(3, "out of space [dictionary]", NiL, (unsigned long)0);
report(3, "out of memory [dictionary]", NiL, (unsigned long)0);
return dict;
}

Expand Down Expand Up @@ -542,7 +542,7 @@ search(register Dict_t* dict, char* name, void* value)
else if (value)
{
if (!(root = newof(0, Dict_item_t, 1, strlen(name))))
report(3, "out of space [dictionary]", name, (unsigned long)0);
report(3, "out of memory [dictionary]", name, (unsigned long)0);
strcpy(root->name, name);
}
if (root)
Expand Down Expand Up @@ -609,7 +609,7 @@ rule(char* name)
if (!(r = (Rule_t*)search(state.rules, name, NiL)))
{
if (!(r = newof(0, Rule_t, 1, 0)))
report(3, "out of space [rule]", name, (unsigned long)0);
report(3, "out of memory [rule]", name, (unsigned long)0);
r->name = (char*)search(state.rules, name, (void*)r);
}
return r;
Expand All @@ -628,7 +628,7 @@ cons(Rule_t* r, Rule_t* p)
if (!x)
{
if (!(x = newof(0, List_t, 1, 0)))
report(3, "out of space [list]", r->name, (unsigned long)0);
report(3, "out of memory [list]", r->name, (unsigned long)0);
x->rule = p;
x->next = r->prereqs;
r->prereqs = x;
Expand Down Expand Up @@ -712,7 +712,7 @@ view(void)
}
n = strlen(s);
if (!(vp = newof(0, View_t, 1, strlen(p) + n + 1)))
report(3, "out of space [view]", s, (unsigned long)0);
report(3, "out of memory [view]", s, (unsigned long)0);
vp->node = n + 1;
strcpy(vp->dir, s);
*(vp->dir + n) = '/';
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/INIT/mktest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ unit.rt [ unit [ arg ... ] ]
[+PROG \acommand\a [ \aarg\a ... ]]?Run \acommand\a with
optional arguments.]
[+TEST [ \anumber\a ]] [ \adescription\a ... ]]?Define a new
test group with optional \anumber\a and \adescripion\a.]
test group with optional \anumber\a and \adescription\a.]
[+TWD [ \adir\a ... ]]?Set the temporary test dir to \adir\a.
The default is \aunit\a\b.tmp\b, where \aunit\a is the test
input file sans directory and suffix. If \adir\a matches \b/*\b
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/INIT/ratz.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ typedef struct internal_state {
gz_headerp gzhead; /* gzip header information to write */
uInt gzindex; /* where in extra, name, or comment */
Byte method; /* STORED (for zip only) or DEFLATED */
int last_flush; /* value of flush param for previous deflate call */
int last_flush; /* value of flush parameter for previous deflate call */

/* used by deflate.c: */

Expand Down Expand Up @@ -4939,7 +4939,7 @@ char** argv;
while (block(stdin, gz, (char*)&header))
{
/*
* last 2 blocks are NUL
* last 2 blocks are NULL
*/

if (!*header.name)
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/INIT/regress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ unit [ command [ arg ... ] ]
the next explicit \bSET\b.]
[+TALLY?Called by \bregress\b display the \bTEST\b results.]
[+TEST \b\anumber\a [ \adescription\a ... ]]?Define a new test
group labelled \anumber\a with optional \adescripion\a.]
group labelled \anumber\a with optional \adescription\a.]
[+TITLE \b[+]] \atext\a?Set the \bTEST\b output title to
\atext\a. If \b+\b is specified then \atext\a is appended to
the default title. The default title is the test file base
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/builtin/pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ dialogue(Sfio_t* mp, Sfio_t* lp, int delay, int timeout)
}
if (*s && !(master->ignore = vmstrdup(vm, s)))
{
error(ERROR_SYSTEM|2, "out of space");
error(ERROR_SYSTEM|2, "out of memory");
goto done;
}
break;
Expand All @@ -958,7 +958,7 @@ dialogue(Sfio_t* mp, Sfio_t* lp, int delay, int timeout)
}
if (*s && !(error_info.id = vmstrdup(vm, s)))
{
error(ERROR_SYSTEM|2, "out of space");
error(ERROR_SYSTEM|2, "out of memory");
goto done;
}
break;
Expand All @@ -970,7 +970,7 @@ dialogue(Sfio_t* mp, Sfio_t* lp, int delay, int timeout)
}
if (*s && !(master->prompt = vmstrdup(vm, s)))
{
error(ERROR_SYSTEM|2, "out of space");
error(ERROR_SYSTEM|2, "out of memory");
goto done;
}
break;
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/COMPATIBILITY
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ omitted features that are completely upward compatible.
the stty lnext character is set to control-v or is unset.
The sequence escape control-v will display the shell version.

29. In ksh-88, DEBUG traps were executed. after each command. In ksh-93
29. In ksh-88, DEBUG traps were executed after each command. In ksh-93
DEBUG traps are executed before each command.

30. In ksh-88, a redirection to a file name given by an empty string was
Expand Down
3 changes: 1 addition & 2 deletions src/cmd/ksh93/README
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ and/or execute only script. Note, that ksh does not read the .profile
or $ENV file when it the real and effective user/group id's are not
equal.

The tests sub-directory contains a number of regression tests for ksh.
The tests subdirectory contains a number of regression tests for ksh.
To run all these tests with the shell you just built, run the command
bin/shtests
For help and more options, type
Expand Down Expand Up @@ -198,4 +198,3 @@ https://github.com/ksh93/ksh
Originally written by:
David Korn
dgk@research.att.com

0 comments on commit 814b5c6

Please sign in to comment.