Skip to content

Commit

Permalink
oksh-7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ibara committed Nov 19, 2023
1 parent f067067 commit 4253ca8
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 123 deletions.
8 changes: 4 additions & 4 deletions CVS/Entries
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
/misc.c/1.78/Result of merge//
/CONTRIBUTORS/1.11/Thu Aug 3 22:00:56 2023//
/LEGAL/1.2/Thu Aug 3 22:00:56 2023//
/Makefile/1.39/Thu Aug 3 22:25:58 2023//
/NOTES/1.16/Thu Aug 3 22:00:56 2023//
/PROJECTS/1.9/Thu Aug 3 22:00:56 2023//
/README/1.16/Thu Aug 3 22:25:58 2023//
/alloc.c/1.19/Thu Aug 3 22:00:56 2023//
/c_ksh.c/1.62/Thu Aug 3 22:00:56 2023//
/c_sh.c/1.64/Thu Aug 3 22:00:56 2023//
/c_test.c/1.28/Result of merge//
/c_test.h/1.4/Thu Aug 3 22:00:56 2023//
/c_ulimit.c/1.29/Thu Aug 3 22:00:56 2023//
Expand All @@ -25,7 +22,6 @@
/expand.h/1.15/Thu Aug 3 22:00:56 2023//
/expr.c/1.34/Thu Aug 3 22:00:56 2023//
/jobs.c/1.62/Thu Aug 3 22:00:56 2023//
/ksh.1/1.219/Thu Aug 3 22:25:58 2023//
/lex.c/1.79/Thu Aug 3 22:00:56 2023//
/lex.h/1.21/Thu Aug 3 22:00:56 2023//
/mail.c/1.27/Thu Aug 3 22:00:56 2023//
Expand All @@ -43,4 +39,8 @@
/tty.h/1.6/Thu Aug 3 22:00:56 2023//
/var.c/1.73/Result of merge//
/version.c/1.12/Thu Aug 3 22:00:56 2023//
/Makefile/1.39/Sun Nov 19 00:26:55 2023//
/README/1.16/Sun Nov 19 00:26:55 2023//
/c_sh.c/1.65/Sun Nov 19 00:26:55 2023//
/ksh.1/1.220/Sun Nov 19 00:26:55 2023//
D
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,5 @@ for details.

Get a tarball
-------------
See releases tab. The latest release is oksh-7.3, which matches the ksh(1)
from OpenBSD 7.3, released April 10, 2023.
See releases tab. The latest release is oksh-7.4, which matches the ksh(1)
from OpenBSD 7.4, released October 16, 2023.
21 changes: 12 additions & 9 deletions c_sh.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: c_sh.c,v 1.64 2020/05/22 07:50:07 benno Exp $ */
/* $OpenBSD: c_sh.c,v 1.65 2023/09/14 18:32:03 cheloha Exp $ */

/*
* built-in Bourne commands
Expand Down Expand Up @@ -676,18 +676,21 @@ c_unset(char **wp)
return 0;
}

#ifndef TIMEVAL_TO_TIMESPEC
#define TIMEVAL_TO_TIMESPEC(tv, ts) do { \
(ts)->tv_sec = (tv)->tv_sec; \
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
} while (0)
#endif

static void
p_tv(struct shf *shf, int posix, struct timeval *tv, int width, char *prefix,
char *suffix)
{
if (posix)
shf_fprintf(shf, "%s%*lld.%02ld%s", prefix ? prefix : "",
width, (long long)tv->tv_sec, tv->tv_usec / 10000, suffix);
else
shf_fprintf(shf, "%s%*lldm%02lld.%02lds%s", prefix ? prefix : "",
width, (long long)tv->tv_sec / 60,
(long long)tv->tv_sec % 60,
tv->tv_usec / 10000, suffix);
struct timespec ts;

TIMEVAL_TO_TIMESPEC(tv, &ts);
p_ts(shf, posix, &ts, width, prefix, suffix);
}

static void
Expand Down
86 changes: 43 additions & 43 deletions ksh.1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.\" $OpenBSD: ksh.1,v 1.219 2023/06/10 07:24:21 op Exp $
.\" $OpenBSD: ksh.1,v 1.220 2023/10/20 18:51:09 schwarze Exp $
.\"
.\" Public Domain
.\"
.Dd $Mdocdate: June 10 2023 $
.Dd $Mdocdate: October 20 2023 $
.Dt KSH 1
.Os
.Sh NAME
Expand Down Expand Up @@ -1188,8 +1188,8 @@ is printed on standard error (preceded by
.Ar name : )
and an error occurs (normally causing termination of a shell script, function,
or script sourced using the
.Sq \&.
built-in).
.Sq Ic \&.
built-in command).
If
.Ar word
is omitted, the string
Expand Down Expand Up @@ -1287,8 +1287,8 @@ keyword (i.e. a Korn shell style function).
.It Ev 1 No ... Ev 9
The first nine positional parameters that were supplied to the shell, function,
or script sourced using the
.Sq \&.
built-in.
.Sq Ic \&.
built-in command.
Further positional parameters may be accessed using
.Pf ${ Ar number Ns } .
.It Ev *
Expand Down Expand Up @@ -1412,10 +1412,10 @@ below for more information.
.It Ev HISTCONTROL
A colon separated list of history settings.
If
.Li ignoredups
.Sy ignoredups
is present, lines identical to the previous history line will not be saved.
If
.Li ignorespace
.Sy ignorespace
is present, lines starting with a space will not be saved.
Unknown settings are ignored.
.It Ev HISTFILE
Expand Down Expand Up @@ -1533,7 +1533,7 @@ is (so they know how far it is to the edge of the screen), escape codes in
the prompt tend to mess things up.
You can tell the shell not to count certain
sequences (such as escape codes) by using the
.Li \e[ Ns Ar ... Ns Li \e]
.Sy \e[ Ns Ar ... Ns Sy \e]
substitution (see below) or by prefixing your prompt with a non-printing
character (such as control-A) followed by a carriage return and then delimiting
the escape codes with this non-printing character.
Expand All @@ -1551,85 +1551,85 @@ The following backslash-escaped special characters can be used
to customise the prompt:
.Pp
.Bl -tag -width "\eD{format}XX" -compact
.It Li \ea
.It Sy \ea
Insert an ASCII bell character.
.It Li \ed
.It Sy \ed
The current date, in the format
.Dq Day Month Date
for example
.Dq Wed Nov 03 .
.It Li \eD Ns Brq Ar format
.It Sy \eD Ns Brq Ar format
The current date, with
.Ar format
converted by
.Xr strftime 3 .
The braces must be specified.
.It Li \ee
.It Sy \ee
Insert an ASCII escape character.
.It Li \eh
.It Sy \eh
The hostname, minus domain name.
.It Li \eH
.It Sy \eH
The full hostname, including domain name.
.It Li \ej
.It Sy \ej
Current number of jobs running
(see
.Sx Job control
below).
.It Li \el
.It Sy \el
The controlling terminal.
.It Li \en
.It Sy \en
Insert a newline character.
.It Li \er
.It Sy \er
Insert a carriage return character.
.It Li \es
.It Sy \es
The name of the shell.
.It Li \et
.It Sy \et
The current time, in 24-hour HH:MM:SS format.
.It Li \eT
.It Sy \eT
The current time, in 12-hour HH:MM:SS format.
.It Li \e@
.It Sy \e@
The current time, in 12-hour HH:MM:SS AM/PM format.
.It Li \eA
.It Sy \eA
The current time, in 24-hour HH:MM format.
.It Li \eu
.It Sy \eu
The current user's username.
.It Li \ev
.It Sy \ev
The current version of
.Nm .
.It Li \eV
.It Sy \eV
Like
.Sq \ev ,
.Sy \ev ,
but more verbose.
.It Li \ew
.It Sy \ew
The current working directory.
.Dv $HOME
is abbreviated as
.Sq ~ .
.It Li \eW
.It Sy \eW
The basename of
the current working directory.
.Dv $HOME
is abbreviated as
.Sq ~ .
.It Li \e!
.It Sy \e!
The current history number.
An unescaped
.Ql !\&
.Sq Sy !\&
will produce the current history number too,
as per the POSIX specification.
A literal
.Ql \&!
can be put in the prompt by placing
.Ql !!
.Sq Sy !!
in
.Ev PS1 .
.It Li \e#
.It Sy \e#
The current command number.
This could be different to the current history number,
if
.Ev HISTFILE
contains a history list from a previous session.
.It Li \e$
.It Sy \e$
The default prompt character i.e.\&
.Sq #
if the effective UID is 0,
Expand All @@ -1640,15 +1640,15 @@ Since the shell interprets
as a special character within double quotes,
it is safer in this case to escape the backslash
than to try quoting it.
.It Li \e Ns Ar nnn
.It Sy \e Ns Ar nnn
The octal character
.Ar nnn .
.It Li \e\e
.It Sy \e\e
Insert a single backslash character.
.It Li \e[
.It Sy \e[
Normally the shell keeps track of the number of characters in the prompt.
Use of this sequence turns off that count.
.It Li \e]
.It Sy \e]
Use of this sequence turns the count back on.
.El
.Pp
Expand Down Expand Up @@ -2337,13 +2337,13 @@ syntax or the Bourne/POSIX shell
.Ar function-name Ns ()
syntax (see below for the difference between the two forms).
Functions are like
.Li .-scripts
.Ic \&. Ns -scripts
(i.e. scripts sourced using the
.Sq \&.
built-in)
.Sq Ic \&.
built-in command)
in that they are executed in the current environment.
However, unlike
.Li .-scripts ,
.Ic \&. Ns -scripts,
shell arguments (i.e. positional parameters $1, $2, etc.)\&
are never visible inside them.
When the shell is determining the location of a command, functions
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ main(int argc, char *argv[])
#ifndef SMALL
/* setstr can't fail here */
setstr(global(version_param), ksh_version, KSH_RETURN_ERROR);
setstr(global("OKSH_VERSION"), "oksh 7.3", KSH_RETURN_ERROR);
setstr(global("OKSH_VERSION"), "oksh 7.4", KSH_RETURN_ERROR);
#endif /* SMALL */

/* execute initialization statements */
Expand Down

0 comments on commit 4253ca8

Please sign in to comment.