diff --git a/README.md b/README.md index 1432c1af548d..eb64776bce12 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,39 @@ and click on commit messages for full details. For all fixes, see [the commit log](https://github.com/ksh93/ksh/commits/1.0). For known issues in the current release, see [TODO](https://github.com/ksh93/ksh/blob/1.0/TODO). -## Build +## Table of contents ## + +* [Installing from source](#user-content-installing-from-source) + * [Prepare](#user-content-prepare) + * [Build](#user-content-build) + * [Test](#user-content-test) + * [Install](#user-content-install) +* [What is ksh93?](#user-content-what-is-ksh93) + +## Installing from source + +You can download a [release](releases) tarball, +or clone the current code from the 1.0 branch: +`git clone -b 1.0 https://github.com/ksh93/ksh` + +### Prepare + +The build system requires only a basic POSIX-compatible shell, utilities and +compiler environment. The `cc`, `ar` and `getconf` commands are needed at +build time. The `tput` and `getconf` commands are used at runtime if +available (for multiline editing and to complete the `getconf` built-in, +respectively). Not all systems come with all of these preinstalled. Here are +system-specific instructions for making them available: + +* **Android/[Termux](https://termux.dev/):** + install dependencies using `pkg install`. + * Build dependencies: `clang`, `binutils`, `getconf` + * Runtime dependencies (optional): `ncurses-utils`, `getconf` +* **macOS:** + install the Xcode Command Line Tools: + `xcode-select --install` + +### Build To build ksh with a custom configuration of features, edit [`src/cmd/ksh93/SHOPT.sh`](https://github.com/ksh93/ksh/blob/1.0/src/cmd/ksh93/SHOPT.sh). @@ -27,7 +59,7 @@ To build ksh with a custom configuration of features, edit On systems such as NetBSD and OpenBSD, where `/bin/ksh` is not ksh93 and the preinstalled `/etc/ksh.kshrc` profile script is incompatible with ksh93, you'll want to disable `SHOPT_SYSRC` to avoid loading it on startup -- unless you can -edit it to make it compatible with ksh93. This geneerally involves differences +edit it to make it compatible with ksh93. This generally involves differences in the declaration and usage of local variables in functions. Then `cd` to the top directory and run: @@ -37,6 +69,7 @@ bin/package make ``` To suppress compiler output, use `quiet make` instead of `make`. + In some non-POSIX shells you might need to prepend `sh` to all calls to `bin/package`. Parallel building is supported by appending `-j` followed by the diff --git a/src/cmd/INIT/README-mamake.md b/src/cmd/INIT/README-mamake.md index d76a3594f21b..089f2eb3f638 100644 --- a/src/cmd/INIT/README-mamake.md +++ b/src/cmd/INIT/README-mamake.md @@ -136,7 +136,7 @@ written as a separate line to its standard input. The value of the expansion is the output of *s* with each newline changed back into a space, except that a terminating newline (if any) is discarded. This mechanism allows easy editing of variable values containing multiple -pathnames using line-oriented utilities thet read from standard input, +pathnames using line-oriented utilities that read from standard input, such as `sed`(1) or `grep`(1). For example, if the automatic variable `%{^}` (see below) contains `foo.c bar.c baz.c`, then `%{^|sed 's/\.c$//'}` yields `foo bar baz`. @@ -169,7 +169,7 @@ previously processed or referenced prerequisites. `%{?}` is a space-separate list of the current rule's previously processed prerequisites that have been updated by a shell action (see `exec` below) -during the current `mamake` run. Prequisites that were already up to date, +during the current `mamake` run. Prerequisites that were already up to date, or prerequisites that do not contain a shell action, are not included. ## Commands ## @@ -340,7 +340,7 @@ of the line in the rule. After MAM variable expansion, *viewpathing* is applied. The first colon-separated element of `%{VPATH}` is considered the object code directory and the second the source code directory; -viewpathing provides the first with a vew to the second. +viewpathing provides the first with a view to the second. Viewpathing applies two transformations. The first is *prerequisite replacement*. @@ -375,7 +375,7 @@ in the following format is written to standard error: # path/to/Mamfile: startline-endline: rule -During script execution, shell action comands are traced using the +During script execution, shell action commands are traced using the shell's xtrace option, unless the rule has the `notrace` attribute. #### Strict level 2+ change #### diff --git a/src/cmd/INIT/mamake.c b/src/cmd/INIT/mamake.c index be7cc4d9b41c..c5b8b09c6c9b 100644 --- a/src/cmd/INIT/mamake.c +++ b/src/cmd/INIT/mamake.c @@ -1663,7 +1663,7 @@ static void run(Rule_t *r, char *s) if (x && state.shim) { /* Also subject the user-set shim to viewpathing - * (plus other code preprended above, but it should not contain anything viewpathable) */ + * (plus other code prepended above, but it should not contain anything viewpathable) */ char *pre = use(buf); size_t n = strlen(pre); if (!(tofree = malloc(n + strlen(s) + 1))) @@ -2233,7 +2233,7 @@ static void make(Rule_t *r, Makestate_t *parentstate) { /* loop block done */ if (*t) - error_out("superflous arguments", u); + error_out("syntax error", u); break; } /* make block done */ diff --git a/src/cmd/ksh93/features/externs b/src/cmd/ksh93/features/externs index e844a2cfb609..e1dd716da921 100644 --- a/src/cmd/ksh93/features/externs +++ b/src/cmd/ksh93/features/externs @@ -188,7 +188,7 @@ tst note{ determining size of PID variables }end output{ exit 1 }end -# execve(3) breakage on Android/Termux (as of API 35) +# execve(3) breakage on Android/Termux (early versions of API 35) tst execve_ignores_argv0 note{ does execve(3) ignore the specified argv[0] }end output{ #include #include @@ -201,7 +201,7 @@ tst execve_ignores_argv0 note{ does execve(3) ignore the specified argv[0] }end sprintf(b,"_KSH_EXECVE_TEST_%d=y",(int)getpid()); newenv[0] = b; newenv[1] = NULL; - /* check if we've alreay been re-exec'ed */ + /* check if we've already been re-exec'ed */ for (i = 0; environ[i]; i++) if (strcmp(environ[i],newenv[0])==0) return !(strcmp(argv[0],"TEST_OK")!=0); diff --git a/src/cmd/ksh93/kshrc.sh b/src/cmd/ksh93/kshrc.sh index 6e7061331451..659a013d2caf 100644 --- a/src/cmd/ksh93/kshrc.sh +++ b/src/cmd/ksh93/kshrc.sh @@ -37,7 +37,7 @@ typeset .rc .rc.tty=${.rc.tty#/dev/} if [[ -v INSTALLROOT ]] -then # do not intefere with the regular ksh history +then # do not interfere with the regular ksh history [[ -d $INSTALLROOT/var ]] || mkdir -p "$INSTALLROOT/var" HISTFILE=$INSTALLROOT/var/sh_history_${.rc.tty//\//_} fi diff --git a/src/cmd/ksh93/sh/parse.c b/src/cmd/ksh93/sh/parse.c index 6100a8b43b12..27e1959563d2 100644 --- a/src/cmd/ksh93/sh/parse.c +++ b/src/cmd/ksh93/sh/parse.c @@ -252,7 +252,7 @@ static void check_typedef(struct comnod *tp, char intypeset) * Hack to avoid an inconsistent state if a 'typeset -T' or 'enum' declaration is parsed but not executed: * * The parser needs to know about to-be-created type built-ins before their declarations are executed, - * otherwise assignment-arguments with parenteses -- e.g., Type_t foo=(bar baz) -- are a syntax error if + * otherwise assignment-arguments with parentheses -- e.g., Type_t foo=(bar baz) -- are a syntax error if * parsed within the same pass as the 'typeset -T Type_t=(...)' declaration. This would be especially bad * in dot scripts, which are completely parsed in one single sh_parse() call before execution. * diff --git a/src/lib/libast/Mamfile b/src/lib/libast/Mamfile index ee6f8cf8d266..deafb3230b3c 100644 --- a/src/lib/libast/Mamfile +++ b/src/lib/libast/Mamfile @@ -81,7 +81,7 @@ make install virtual note * note * The standards test influences all subsequent iffe feature tests, so must be made first - note * Block parallellisation here by nesting FEATURE/standards in ast_standards.h + note * Block parallelisation here by nesting FEATURE/standards in ast_standards.h make ast_standards.h make FEATURE/standards makp features/standards