Giter Club home page Giter Club logo

oksh's Introduction

oksh

Portable OpenBSD ksh(1). Not an official OpenBSD project.

Why?

Because all operating systems deserve a good shell.

Unlike other ports of OpenBSD ksh, this port is entirely self-contained and aims to be maximally portable across operating systems and C compilers. We are always looking for new combinations to add support for.

Supported systems

oksh is known to run on the following Operating Systems:

  • OpenBSD
  • FreeBSD
  • DragonFly BSD
  • NetBSD
  • HardenedBSD
  • SoloBSD (as the default shell)
  • Mac OS X (port originally by @geoff-nixon)
  • Linux (glibc and musl)
  • Cygwin
  • Android (via Termux)
  • AIX (with major thanks to @tssva and @NattyNarwhal)
  • IBM i PASE
  • Solaris
  • Illumos
  • midipix
  • WSL
  • WSL2
  • Unixware 7
  • Haiku
  • HP-UX (gcc only)
  • SerenityOS
  • MSYS2

Running on a system not listed here? Add it and send a pull request!

Believed working

We believe that oksh will work on the following platforms, but testing is needed. Help is greatly appreciated and encouraged!

  • Irix

Supported compilers

oksh is known to build with the following C compilers:

Building with a compiler not listed here? Add it and send a pull request!

Packages

oksh is included in some package systems.

Packaging status

In addition, there are some unofficial packages:

Using a package not listed here? Add it and send a pull request!

Dependencies

A C99 compiler is the easiest way to ensure that oksh will build correctly. Please see the list of C compilers above for a list of known working compilers.

Though not required, the ncurses library will be used for screen clearing routines if the library is found during the configure stage. This can be turned off by the user by passing the --disable-curses flag to configure.

A configure script that produces a POSIX Makefile is provided to ease building and installation and can be run by:

$ ./configure
$ make && sudo make install

Out-of-tree builds

The configure script will detect out-of-tree builds if you prefer to build out-of-tree. In order for this to work, the VPATH make extension is used. While not POSIX, VPATH is known to work with BSD make and GNU make. In-tree builds create a fully POSIX Makefile.

Cross compiling

Cross compiling can be achieved by running configure as follows:

CC=/path/to/cross/cc CFLAGS="any needed cflags" LDFLAGS="any needed ldflags" ./configure --no-thanks

This will skip all configure checks and write out a generic Makefile and pconfig.h with nearly no options turned on. If using a cross gcc or clang, this very well may just work (with all compat compiled in). You can edit these files to reflect your system before running make.

All environment variables and configure flags are respected when using --no-thanks. Further specifying --no-link after --no-thanks will only compile the source files into object files, to be transfered onto the target machine and linked there.

The --no-thanks flag can also be used to compile a native oksh with all the compatibility functions compiled in, rather than relying on the system's version of those functions.

Submitting patches

Patches that add new platforms and improve support for existing platforms are always welcome.

Patches that cause oksh to deviate from upstream OpenBSD ksh behavior are better suited to be sent to the OpenBSD tech@ mailing list. Please make sure to test your patch on an OpenBSD machine first before submitting it to tech@. I will sync with the upstream OpenBSD code once your patch is accepted. If you'd like to open an issue here to track progress of your patch on tech@, that's fine.

License

The main Korn shell files are public domain (see LEGAL). Portability files are BSD or ISC licensed; see individual file headers for details.

Get a tarball

See releases tab. The latest release is oksh-7.5, which matches the ksh(1) from OpenBSD 7.5, released April 5, 2024.

oksh's People

Contributors

0xmf avatar akacase avatar alisonatwork avatar coypoop avatar dressupgeekout avatar geoff-nixon avatar ibara avatar jaywilliams avatar larryhynes avatar matijaskala avatar nattynarwhal avatar orbea avatar redfoxymoon avatar roryrjb avatar sham1 avatar sirn avatar tssva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oksh's Issues

down-history: difference with bash/ksh

This is a feature request.

On one of my systems I switched from bash to oksh as an interactive shell.
However, there are a number of annoying differences between bash/zsh and oksh.
One is a difference in how "down-history" command works.
On bash and zsh running "up-history" and then "down-history" commands bash/ksh switches to an empty line.
In oksh running "up-history" and then "down-history" commands remains previous history line for editing.
I hope idea is clear.

What do you think about implementing something like "down-history-or-empty" for compatibility with bash/ksh?

Build errors on Haiku

Hey, I was just investigating compiling on Haiku for a couple of simple projects I am working on and it doesn't seem straightforward from a lib point of view. Anyway I tried oksh and there are some errors and as you may have the interest and patience (as per #39) I thought I'd share my initial findings and maybe we can somehow figure this out together.

Here's the first issue:

~/Repos/oksh> cc -DEMACS -DVI -w   -c -o edit.o edit.c
edit.c: In function 'x_mode':
edit.c:176:28: error: 'VWERASE' undeclared (first use in this function); did you mean 'VERASE'?
   edchars.werase = cb.c_cc[VWERASE];
                            ^~~~~~~
                            VERASE
edit.c:176:28: note: each undeclared identifier is reported only once for each function it appears in
edit.c:180:11: error: 'VLNEXT' undeclared (first use in this function); did you mean 'LEXIT'?
   cb.c_cc[VLNEXT] = _POSIX_VDISABLE;
           ^~~~~~
           LEXIT
edit.c:182:11: error: 'VDISCARD' undeclared (first use in this function); did you mean 'S_ISCHR'?
   cb.c_cc[VDISCARD] = _POSIX_VDISABLE;
           ^~~~~~~~
           S_ISCHR

...and here's the compiler:

~/Repos/oksh> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/7.3.0/lto-wrapper
Target: x86_64-unknown-haiku
Configured with: /sources/gcc-7.3.0/configure --build=x86_64-unknown-haiku --prefix=/packages/gcc-7.3.0_2018_05_01-3/.self/develop/tools --libexecdir=/packages/gcc-7.3.0_2018_05_01-3/.self/develop/tools/lib --mandir=/packages/gcc-7.3.0_2018_05_01-3/.self/documentation/man --docdir=/packages/gcc-7.3.0_2018_05_01-3/.self/documentation/packages/gcc --enable-threads=posix --disable-nls --enable-shared --with-gnu-ld --with-gnu-as --enable-version-specific-runtime-libs --enable-languages=c,c++,fortran --enable-lto --enable-frame-pointer --with-pkgversion=2018_05_01 --enable-__cxa-atexit --with-system-zlib --enable-checking=release --with-bug-url=http://dev.haiku-os.org/ --with-default-libstdcxx-abi=gcc4-compatible --enable-libssp --disable-multilib
Thread model: posix
gcc version 7.3.0 (2018_05_01)

Feature request: bashism "<<<"

This is a feature request.

There is very interesting bash extension for interactive use: "<<<".
For example, I often use oneliners like the following

$ bc <<< 2+2
4
$

instead of

$ echo '2+2' | bc
4
$

What do you think about implementing this in oksh (OpenBSD /bin/sh)?

=~

The following works on any shell I have, except oksh:
if [[ "$var" =~ "string" ]]; then echo "1"; else echo "0"; fi

It fails on oksh because oksh does not implement "=~" correctly.

Therefore, for portability, one has to re-write the above as follows:
if [[ "$( echo "$var" | grep "string" )" != "" ]]; then echo "1"; else echo "0"; fi

Scripts may fail when executed under oksh, and rewriting them is demotivating, especially if you have many of them.

Please add "=~" to oksh, and possibly port it back to mainstream sh in OpenBSD.

$RANDOM within scripts returns the same value

running 'print $RANDOM' works as expected, but once it is put inside a script it returns the same value every time the script is run.

issue reproduced in 7.1 on FreeBSD 13.1 both from ports and when compiled with clang.

Duplicate "Please add oksh to /etc/shells" from Makefile

Hi

make (on my machine, MacOS, GNU Make 3.8.1) automatically echoes the lines under install: in the Makefile, which means that the line about adding oksh to /etc/shells is printed twice:

[master] ~/src/oksh $ make install
install -d /Users/larry/local/bin
install -d /Users/larry/local/share/man/man1
install -c -s -m 755 oksh /Users/larry/local/bin
install -c -m 644 oksh.1 /Users/larry/local/share/man/man1/oksh.1
echo "Please add /Users/larry/local/bin/oksh to /etc/shells"
Please add /Users/larry/local/bin/oksh to /etc/shells

According to the GNU make documentation, prefacing the echo ... with @ will suppress the double output, which it does:

[master] ~/src/oksh $ make install
install -d /Users/larry/local/bin
install -d /Users/larry/local/share/man/man1
install -c -s -m 755 oksh /Users/larry/local/bin
install -c -m 644 oksh.1 /Users/larry/local/share/man/man1/oksh.1
Please add /Users/larry/local/bin/oksh to /etc/shells

There may be other ways around this, and you might be trying to cover portability bases that make this "fix" unworkable. It's not A Big Deal, but I thought it was worth mentioning.

Build errors on HP-UX

Hi,

Fellow OpenBSD user here, with access to an Itanium HP-UX 11.31i server. I gave this a try, inspired by your call for HP-UX testing in README.md.

Have tried to build this with both the C and aC++ compilers (the latter can also compile ANSI-C if invoked with -Ae).

Versions used:

$ cc -V
cc: HP C/aC++ B3910B A.06.27 [May 22 2012]
$ aCC -V
aCC: HP C/aC++ B3910B A.06.27 [May 22 2012]
$ ./configure
checking for C compiler... cc
checking if C compiler can compile C99 without -std=c99... yes
checking for -w compiler flag... yes
checking for OS... HP-UX
checking for __dead... no
checking for __dead2... no
checking for asprintf... no
checking for confstr... yes
checking for curses library... curses.h
checking for issetugid... no
checking for pledge... no
checking for reallocarray... no
checking for setresgid... yes
checking for setresuid... yes
checking for sig_t... no
checking for srand_deterministic... no
checking for st_mtim... no
checking for st_mtimespec... no
checking for stravis... no
checking for strlcat... no
checking for strlcpy... no
checking for strtonum... no
checking for strunvis... no
checking for sys_siglist... no
checking for sys_signame... no
checking for timeradd... no
checking for timersub... no
creating Makefile... done
$ make
        cc -DEMACS -DVI -w -c c_sh.c
"c_sh.c", line 735: error #2020: identifier "CLOCK_MONOTONIC" is undefined
        clock_gettime(CLOCK_MONOTONIC, &ts0);
                      ^

1 error detected in the compilation of "c_sh.c".
*** Error exit code 2

Stop.
$ export CC="aCC -Ae"
$ ./configure
checking for C compiler... aCC -Ae
checking if C compiler can compile C99 without -std=c99... yes
checking for -w compiler flag... yes
checking for OS... HP-UX
checking for __dead... no
checking for __dead2... no
checking for asprintf... no
checking for confstr... yes
checking for curses library... curses.h
checking for issetugid... no
checking for pledge... no
checking for reallocarray... no
checking for setresgid... yes
checking for setresuid... yes
checking for sig_t... no
checking for srand_deterministic... no
checking for st_mtim... no
checking for st_mtimespec... no
checking for stravis... no
checking for strlcat... no
checking for strlcpy... no
checking for strtonum... no
checking for strunvis... no
checking for sys_siglist... no
checking for sys_signame... no
checking for timeradd... no
checking for timersub... no
creating Makefile... done
$ make
        aCC -Ae -DEMACS -DVI -w -c alloc.c
        aCC -Ae -DEMACS -DVI -w -c asprintf.c
        aCC -Ae -DEMACS -DVI -w -c c_ksh.c
        aCC -Ae -DEMACS -DVI -w -c c_sh.c
"c_sh.c", line 735: error #2020: identifier "CLOCK_MONOTONIC" is undefined
        clock_gettime(CLOCK_MONOTONIC, &ts0);
                      ^

1 error detected in the compilation of "c_sh.c".
*** Error exit code 2

Stop.

Man Path on macOS

By default, when you install oksh on macOS, it places the man page under /usr/local/man/man1/.

This location isn't used by macOS and therefore doesn't resolve when you type man oksh in your terminal. Ideally, the output path on macOS would be /usr/local/share/man/man1/. As a side note, this is also the location where Homebrew symlinks all man documentation for their packages.

command variable assignment exports for function

If no command name results [from processing the command line], or if the command name is a special built-in or function, variable assignments shall affect the current execution environment. Otherwise, the variable assignments shall be exported for the execution environment of the command and shall not affect the current execution environment except as a side-effect of the expansions performed [while doing tilde expansion and other stuff to get the command line]

$ type true
true is a shell builtin
$ FOO=bar /bin/true
$ echo $FOO

$ FOO=bar true      
$ echo $FOO

$ true() builtin true
$ FOO=bar true        
$ echo $FOO
bar
$ 

Support for set -euo pipefail?

Which debugging flags to the set command does oksh support? Can administrators run set -euo pipefail in oksh scripts, in order to code defensively?

older Linux: undefined reference to `clock_gettime'

Hi,

I'm trying to install oksh on an older Debian 6 ARM linux (on a machine that cannot run a newer linux because of custom kernel. But I like the machine and would like to keep it running).

I install via pkgsrc. However the issue seems to be a oksh issue, not with pkgsrc.

The linking step fails with

cc -O2 -D_FORTIFY_SOURCE=2 -DEMACS -DVI -w -D_GNU_SOURCE  -c vis.c
cc -Wl,-R/usr/pkg/lib -o oksh alloc.o asprintf.o c_ksh.o c_sh.o c_test.o c_ulimit.o edit.o  emacs.o eval.o exec.o expr.o history.o io.o jobs.o lex.o mail.o  main.o misc.o path.o shf.o syn.o table.o trap.o tree.o tty.o var.o  version.o vi.o confstr.o reallocarray.o siglist.o signame.o  strlcat.o strlcpy.o strtonum.o unvis.o vis.o -lcurses
c_sh.o: In function `timex':
c_sh.c:(.text+0x18b8): undefined reference to `clock_gettime'
c_sh.c:(.text+0x1928): undefined reference to `clock_gettime'
c_sh.c:(.text+0x1acc): undefined reference to `clock_gettime'
mail.o: In function `mcheck':
mail.c:(.text+0x27c): undefined reference to `clock_gettime'
var.o: In function `setspec':
var.c:(.text+0x1130): undefined reference to `clock_gettime'
var.o:var.c:(.text+0x156c): more undefined references to `clock_gettime' follow
collect2: ld returned 1 exit status

This can be fixed by linking with "librt"

${PROG}: ${OBJS}        ${CC} ${LDFLAGS} -o ${PROG} ${OBJS} -lcurses -lrt

Maybe this can be detected in the configure script and added if needed.

set -A no longer works

Hello,

I updated oksh to version 6.8 this morning and set doesn't seem to work anymore.
Here are the details of my .kshrc :

set -A complete_sftp -- $_SSH_HOSTS

But when I launch my shell I get this error:

sh: set: -A: invalid option
set: usage: set [-abefhkmkmnptuvxBCHP] [-o option-name] [--] [arg ...] [arg ...]

As if the -A option didn't exist anymore.
Thanks for your help.

How to use bind for vi mode?

i am using set -o vi

i need "^L" to clear the screen. In emacs mode, it works by default, but in vi mode, it doesn't do that.

in bash, i would do bind "\C-l":'clear-screen' and it would work, but in oksh it only works in emacs mode.

^L in vi mode prints the prompt incorrecty when PS1 is more than one line

Hi and many thanks for your work regarding this port.

I recently updated from 6.7.1 to current master and I can see that in vi editing mode
now Ctrl+l clears the screen and prints the prompt (almost).

The issue that occured to me is that I am using a multiline PS1 and that Ctrl+l only
redraws the last line of that.

The prompt as it is normally:

[5:34:32] 1 ~
>

After hitting ^L:

> 

What I don't know is if this is a bug or if it is supposed to behave like that.

This patch seems to make it work as I expected:

diff --git a/vi.c b/vi.c
index d8e9722..1680cae 100644
--- a/vi.c
+++ b/vi.c
@@ -59,7 +59,7 @@ static int	Endword(int);
 static int	grabhist(int, int);
 static int	grabsearch(int, int, int, char *);
 static void	do_clear_screen(void);
-static void	redraw_line(int);
+static void	redraw_line(int, int);
 static void	refresh_line(int);
 static int	outofwin(void);
 static void	rewindow(void);
@@ -723,7 +723,7 @@ vi_cmd(int argcnt, const char *cmd)
 			break;
 
 		case CTRL('r'):
-			redraw_line(1);
+			redraw_line(1, 0);
 			break;
 
 		case '@':
@@ -1741,18 +1741,18 @@ do_clear_screen(void)
 			neednl = 0;
 	}
 #endif
-	redraw_line(neednl);
+	redraw_line(neednl, 1);
 }
 
 static void
-redraw_line(int neednl)
+redraw_line(int neednl, int full)
 {
 	(void) memset(wbuf[win], ' ', wbuf_len);
 	if (neednl) {
 		x_putc('\r');
 		x_putc('\n');
 	}
-	vi_pprompt(0);
+	vi_pprompt(full);
 	cur_col = pwidth;
 	morec = ' ';
 }
@@ -2113,7 +2113,7 @@ complete_word(int command, int count)
 			vi_error();
 			x_print_expansions(nwords, words, is_command);
 			x_free_words(nwords, words);
-			redraw_line(0);
+			redraw_line(0, 0);
 			return -1;
 		}
 		/*
@@ -2187,7 +2187,7 @@ print_expansions(struct edstate *e)
 	}
 	x_print_expansions(nwords, words, is_command);
 	x_free_words(nwords, words);
-	redraw_line(0);
+	redraw_line(0, 0);
 	return 0;
 }
 

I could submit a Pull Request if that could help.

Is it possible to release a new tarball?

Hey there, and thanks for your hard work.

After the changes that you've made (enabling cross compilation for oksh), would it be possible for you to release a new tarball for 6.7?

doesn't build on FreeBSD 10.4 after eb2e0676cd162af963a3cb2fad48ba3f458b4c4c

Hi there,

I can build this with FreeBSD 10.4 at commit eb2e067 but only with gmake, as make doesn't know how to build the man pages.

After that commit I see an error about missing charclass.h or with gmake an undefined reference to stravis, respectively:

misc.c:16:10: fatal error: 'charclass.h' file not found

history.o: In function histsave': history.c:(.text+0x1610): undefined reference to stravis'
history.o: In function history_write': history.c:(.text+0x18ee): undefined reference to stravis'

Unfortunately I don't know how to suggest fixing it. I'm just an amateur to BSDs but I really liked this shell when I was trying out OpenBSD.

Thanks,
Tod

wrong configure option inside termux

Hi,

I was trying to get this shell running inside Termux on Android but ./configure && make && ./ksh
kept giving me a segmentation fault.

After using gdb, it turned out that reallocarray isn't available though ./configure says it is.
So I recompiled it after I had removed the #define HAVE_REALLOCARRAY from pconfig.h and the shell now runs with no problem.

And it seems to me that you may want to know, so here I am reporting it.

Actually the main problem is that compiling this

#include <stdlib.h>
int main(void){reallocarray(NULL, 0, 0);return 0;}

returns 0, while generating only a warning:
warning: implicit declaration of function 'reallocarray' is invalid in C99 [-Wimplicit-function-decleration]

6 errors

/usr/bin/gnumake 
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/usr/local/include  -c -o c_ksh.o c_ksh.c
c_ksh.c:518:13: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
                        shprintf(newline);
                                 ^~~~~~~
c_ksh.c:518:13: note: treat the string as an argument to avoid this
                        shprintf(newline);
                                 ^
                                 "%s", 
c_ksh.c:819:16: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
                                                shprintf(newline);
                                                         ^~~~~~~
c_ksh.c:819:16: note: treat the string as an argument to avoid this
                                                shprintf(newline);
                                                         ^
                                                         "%s", 
c_ksh.c:909:14: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
                                shprintf(newline);
                                         ^~~~~~~
c_ksh.c:909:14: note: treat the string as an argument to avoid this
                                shprintf(newline);
                                         ^
                                         "%s", 
c_ksh.c:933:14: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
                                shprintf(newline);
                                         ^~~~~~~
c_ksh.c:933:14: note: treat the string as an argument to avoid this
                                shprintf(newline);
                                         ^
                                         "%s", 
c_ksh.c:1169:13: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
                bi_errorf(null);
                          ^~~~
c_ksh.c:1169:13: note: treat the string as an argument to avoid this
                bi_errorf(null);
                          ^
                          "%s", 
c_ksh.c:1190:13: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
                        shprintf(newline);
                                 ^~~~~~~
c_ksh.c:1190:13: note: treat the string as an argument to avoid this
                        shprintf(newline);
                                 ^
                                 "%s", 
6 errors generated.
gnumake: *** [c_ksh.o] Error 1

Does oksh support cross compilation?

I'm attempting to cross compile oksh to a x86-64 architecture targeting musl libc (CC=x86_64-linux-musl-gcc), and I'm receiving the following error:

checking for C compiler... ./configure: line 43: ./conftest: No such file or directory
could not build working executables
Please ensure your C compiler is a native compiler

Does oksh support cross compilation at all?

warnings

/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o alloc.o alloc.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o c_ksh.o c_ksh.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o c_sh.o c_sh.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o c_test.o c_test.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o c_ulimit.o c_ulimit.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o edit.o edit.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o emacs.o emacs.c
emacs.c:862:15: warning: passing 'unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
                if (!strcmp(k->seq, line))
                            ^~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:77:25: note: passing argument to parameter '__s1' here
int      strcmp(const char *__s1, const char *__s2);
                            ^
emacs.c:1343:10: warning: passing 'unsigned char *' to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
        strlcpy(k->seq, str, count + 1);
                ^~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/secure/_string.h:105:28: note: expanded from macro 'strlcpy'
  __builtin___strlcpy_chk (dest, src, len, __darwin_obsz (dest))
                           ^~~~
emacs.c:1376:17: warning: passing 'unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
                    kb_decode(k->seq), k->ftab->xf_name);
                              ^~~~~~
emacs.c:1271:23: note: passing argument to parameter 's' here
kb_decode(const char *s)
                      ^
emacs.c:1378:31: warning: passing 'unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
                shprintf("%s = ", kb_decode(k->seq));
                                            ^~~~~~
emacs.c:1271:23: note: passing argument to parameter 's' here
kb_decode(const char *s)
                      ^
emacs.c:1420:16: warning: passing 'unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
                        if (!strcmp(k->seq, in)) {
                                    ^~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:77:25: note: passing argument to parameter '__s1' here
int      strcmp(const char *__s1, const char *__s2);
                            ^
emacs.c:1431:16: warning: passing 'unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
                        if (!strcmp(k->seq, in)) {
                                    ^~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:77:25: note: passing argument to parameter '__s1' here
int      strcmp(const char *__s1, const char *__s2);
                            ^
emacs.c:1442:16: warning: passing 'unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
                        if (!strcmp(k->seq, in)) {
                                    ^~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:77:25: note: passing argument to parameter '__s1' here
int      strcmp(const char *__s1, const char *__s2);
                            ^
emacs.c:1457:17: warning: passing 'unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
                                if (!strcmp(k->seq, in)) {
                                            ^~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:77:25: note: passing argument to parameter '__s1' here
int      strcmp(const char *__s1, const char *__s2);
                            ^
8 warnings generated.
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o eval.o eval.c
eval.c:322:19: warning: implicit conversion from 'int' to 'char' changes value from 192 to -64 [-Wconstant-conversion]
                                                *dp++ = '@' + 0x80;
                                                      ~ ~~~~^~~~~~
1 warning generated.
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o exec.o exec.c
exec.c:1256:8: warning: implicit declaration of function 'strtonum' is invalid in C99 [-Wimplicit-function-declaration]
                        i = strtonum(s, 1, argct, &errstr);
                            ^
1 warning generated.
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o expr.o expr.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o history.o history.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o io.o io.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o jobs.o jobs.c
jobs.c:1436:9: warning: implicit declaration of function 'strtonum' is invalid in C99 [-Wimplicit-function-declaration]
                job = strtonum(cp, 1, INT_MAX, &errstr);
                      ^
1 warning generated.
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o lex.o lex.c
lex.c:1227:5: warning: implicit declaration of function 'time' is invalid in C99 [-Wimplicit-function-declaration]
                                time(&t);
                                ^
lex.c:1228:10: warning: implicit declaration of function 'localtime' is invalid in C99 [-Wimplicit-function-declaration]
                                tm = localtime(&t);
                                     ^
lex.c:1228:8: warning: incompatible integer to pointer conversion assigning to 'struct tm *' from 'int' [-Wint-conversion]
                                tm = localtime(&t);
                                   ^ ~~~~~~~~~~~~~
lex.c:1229:5: warning: implicit declaration of function 'strftime' is invalid in C99 [-Wimplicit-function-declaration]
                                strftime(strbuf, sizeof strbuf, "%a %b %d", tm);
                                ^
lex.c:1243:8: warning: incompatible integer to pointer conversion assigning to 'struct tm *' from 'int' [-Wint-conversion]
                                tm = localtime(&t);
                                   ^ ~~~~~~~~~~~~~
lex.c:1292:8: warning: incompatible integer to pointer conversion assigning to 'struct tm *' from 'int' [-Wint-conversion]
                                tm = localtime(&t);
                                   ^ ~~~~~~~~~~~~~
lex.c:1297:8: warning: incompatible integer to pointer conversion assigning to 'struct tm *' from 'int' [-Wint-conversion]
                                tm = localtime(&t);
                                   ^ ~~~~~~~~~~~~~
lex.c:1302:8: warning: incompatible integer to pointer conversion assigning to 'struct tm *' from 'int' [-Wint-conversion]
                                tm = localtime(&t);
                                   ^ ~~~~~~~~~~~~~
lex.c:1307:8: warning: incompatible integer to pointer conversion assigning to 'struct tm *' from 'int' [-Wint-conversion]
                                tm = localtime(&t);
                                   ^ ~~~~~~~~~~~~~
9 warnings generated.
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o mail.o mail.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o main.o main.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o mknod.o mknod.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o misc.o misc.c
misc.c:718:22: warning: passing 'const unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
        if ((colon = strchr(pattern, ':')) == NULL || colon[1] != MAGIC) {
                            ^~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:76:26: note: passing argument to parameter '__s' here
char    *strchr(const char *__s, int __c);
                            ^
misc.c:718:13: warning: assigning to 'const unsigned char *' from 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
        if ((colon = strchr(pattern, ':')) == NULL || colon[1] != MAGIC) {
                   ^ ~~~~~~~~~~~~~~~~~~~~
misc.c:726:16: warning: passing 'const unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
                if (!strncmp(pattern, cc->name, len) && cc->name[len] == '\0') {
                             ^~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:84:26: note: passing argument to parameter '__s1' here
int      strncmp(const char *__s1, const char *__s2, size_t __n);
                             ^
misc.c:751:17: warning: initializing 'const char *' with an expression of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
                                const char *pp = p + (*p == MAGIC) + 2;
                                            ^    ~~~~~~~~~~~~~~~~~~~~~
misc.c:752:23: warning: passing 'const char *' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
                                rv = posix_cclass(pp, sub, &p);
                                                  ^~
misc.c:711:35: note: passing argument to parameter 'pattern' here
posix_cclass(const unsigned char *pattern, int test, const unsigned char **ep)
                                  ^
5 warnings generated.
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o path.o path.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o shf.o shf.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o syn.o syn.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o table.o table.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o trap.o trap.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o tree.o tree.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o tty.o tty.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o var.o var.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o version.o version.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o vi.o vi.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o portable/common/reallocarray.o portable/common/reallocarray.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -D_FORTIFY_SOURCE=2 -I/opt/org.OpenServer/share/libtool/include -I/opt/org.OpenServer/share/libressl/include -I/opt/org.OpenServer/share/libsodium/include -I/opt/org.OpenServer/share/libcurl/include -I/opt/org.OpenServer/share/libpcre/include -I/opt/org.OpenServer/share/libz/include -I/opt/org.OpenServer/share/libbz2/include -I/opt/org.OpenServer/share/liblzma/include -I/opt/org.OpenServer/share/libiconv/include -I/opt/org.OpenServer/share/libmilter/include -I/opt/org.OpenServer/port-53/include -I/opt/org.OpenServer/share/ldns/include -I/opt/org.OpenServer/share/geoip/include -I/opt/org.OpenServer/share/expat/include -I/opt/org.OpenServer/share/db/include -I/opt/org.OpenServer/share/jansson/include -I/usr/local/include -I/opt/org.OpenServer/port-514/include/eventlog  -c -o portable/common/strtonum.o portable/common/strtonum.c
/opt/llvm/bin/clang  -g -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -fstack-protector-all  -fPIE -fPIC -O2 -Wformat -Wformat-security -Werror=format-security -Wall  -fstack-protector-all -fPIC -pie  -L/opt/org.OpenServer/share/libtool/lib  -L/opt/org.OpenServer/share/libressl/lib  -L/opt/org.OpenServer/share/libsodium/lib  -L/opt/org.OpenServer/share/libcurl/lib  -L/opt/org.OpenServer/share/libpcre/lib  -L/opt/org.OpenServer/share/libz/lib  -L/opt/org.OpenServer/share/libbz2/lib  -L/opt/org.OpenServer/share/liblzma/lib  -L/opt/org.OpenServer/share/libiconv/lib  -L/opt/org.OpenServer/share/libmilter/lib  -L/opt/org.OpenServer/port-53/lib  -L/opt/org.OpenServer/share/ldns/lib  -L/opt/org.OpenServer/share/geoip/lib  -L/opt/org.OpenServer/share/expat/lib  -L/opt/org.OpenServer/share/db/lib  -L/opt/org.OpenServer/share/jansson/lib  -L/usr/local/lib  -L/opt/org.OpenServer/port-514/lib -o oksh alloc.o c_ksh.o c_sh.o c_test.o c_ulimit.o edit.o emacs.o eval.o exec.o expr.o history.o io.o jobs.o lex.o mail.o main.o mknod.o misc.o path.o shf.o syn.o table.o trap.o tree.o tty.o var.o version.o vi.o portable/common/reallocarray.o portable/common/strtonum.o
clang-4.0: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]

`./configure --enable-ksh` stills installs manual as `oksh`

Hi again,
I am using this shell as ksh so I also install its manual page as ksh.

Currently ./configure --enable-ksh only makes the executable named ksh instead of oksh
but the manual is installed as oksh.1.

Another weird thing I noticed is that oksh.1 has a lot missing from ksh.1
(e.g. pipefail is not mentioned once in oksh.1.)

Beside that it seems to me that ./configure --enable-ksh should also install the manual as ksh.1,
so I report it in case you didn't want that explicitly.

Thank you.

releases lack NEWS

Users benefit from a brief description of user-visible changes in a release, such as API/ABI breaks, new features, etc. I am referring to what the GNU coding standards expects in NEWS. At least some packaging systems ask that this be included with update commits. In considering an update to 2.8 for pkgsrc, I did not find NEWS or something that had NEWS-like contents, and the github release page didn't have it either.

AIX support

God help me.

diff of portable.h

diff --git a/portable.h b/portable.h
index 7781376..5806de4 100644
--- a/portable.h
+++ b/portable.h
@@ -123,6 +123,13 @@
         } while (0)
 #endif /* !__OpenBSD__ */

+#ifdef _AIX
+typedef       void (*sig_t)(int);
+
+#define VWERASE VWERSE
+#define VDISCARD VDISCRD
+#endif
+
 /*
  * Prototypes
  */

current error

$ gmake
gcc -DEMACS -DVI -w   -c -o edit.o edit.c
gcc -DEMACS -DVI -w   -c -o emacs.o emacs.c
emacs.c:78:27: error: invalid initializer
 struct kb_list   kblist = TAILQ_HEAD_INITIALIZER(kblist);
                           ^~~~~~~~~~~~~~~~~~~~~~
emacs.c: In function 'x_emacs':
emacs.c:332:30: error: 'entry' undeclared (first use in this function)
    TAILQ_FOREACH(k, &kblist, entry) {
                              ^~~~~
emacs.c:332:30: note: each undeclared identifier is reported only once for each function it appears in
emacs.c:332:37: error: expected ';' before '{' token
    TAILQ_FOREACH(k, &kblist, entry) {
                                     ^
emacs.c: In function 'kb_find_hist_func':
emacs.c:867:28: error: 'entry' undeclared (first use in this function)
  TAILQ_FOREACH(k, &kblist, entry)
                            ^~~~~
emacs.c:868:3: error: expected ';' before 'if'
   if (!strcmp(k->seq, line))
   ^~
emacs.c: In function 'kb_match':
emacs.c:1275:28: error: 'entry' undeclared (first use in this function)
  TAILQ_FOREACH(k, &kblist, entry) {
                            ^~~~~
emacs.c:1275:35: error: expected ';' before '{' token
  TAILQ_FOREACH(k, &kblist, entry) {
                                   ^
emacs.c: In function 'x_bind':
emacs.c:1390:29: error: 'entry' undeclared (first use in this function)
   TAILQ_FOREACH(k, &kblist, entry)
                             ^~~~~
emacs.c:1391:4: error: expected ';' before 'kb_print'
    kb_print(k);
    ^~~~~~~~
emacs.c:1399:4: error: expected ';' before 'if'
    if (!strcmp(k->seq, in)) {
    ^~
emacs.c:1410:4: error: expected ';' before 'if'
    if (!strcmp(k->seq, in)) {
    ^~
emacs.c:1421:4: error: expected ';' before 'if'
    if (!strcmp(k->seq, in)) {
    ^~
emacs.c:1436:5: error: expected ';' before 'if'
     if (!strcmp(k->seq, in)) {
     ^~
gmake: *** [<builtin>: emacs.o] Error 1

system

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/freeware/libexec/gcc/powerpc-ibm-aix6.1.0.0/6.4.0/lto-wrapper
Target: powerpc-ibm-aix6.1.0.0
Configured with: ../gcc-6.4.0/configure --prefix=/opt/freeware --mandir=/opt/freeware/man --infodir=/opt/freeware/info --with-local-prefix=/opt/freeware --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=c,c++,fortran,objc,obj-c++ --enable-version-specific-runtime-libs --disable-nls --enable-decimal-float=dpd --with-cloog=no --with-ppl=no --disable-libstdcxx-pch --enable-__cxa_atexit --host=powerpc-ibm-aix6.1.0.0
Thread model: aix
gcc version 6.4.0 (GCC)
$ uname -rvs
AIX 1 6

[question] similar projects for other BSDs shells?

Hi,

First, thanks for maintaining this. It's very useful for testing OpenBSD shell behavior on linux.

I'm interested in writing practically portable shell scripts (see shcmp), and I'm generally familiar with shells history, but not so much in the BSD world.

I was wondering if you're familiar with projects similar to this one but for default shells on other BSDs (I'd think mainly FreeBSD and NetBSD, but possibly dragonfly too). I am familiar with loksh, though it's basically the same as this project except maybe for portability scope (and indeed I don't recall cases where shcmp produced different results for oksh and loksh).

Additionally, maybe you know a bit about the relations between the default shells on different BSDs? I know OpenBSD [k]sh is based originally on pdksh, and I think FreeBSD sh is a rewrite or evolution of ash, and its closest cousine on linux is likely dash, though I'd guess they've diverged enough to not assume identity. I don't know about other BSDs.

Thanks in advance.

command wrapping too early

on a stock build of suckless's st, the command wrapping begins very early (this has been extremely annoying for me, and i wish i can fucking disable this), and i'm not sure why.

on a OpenBSD system, using the same terminal, this issue does not occur.

Latest code fails to build on OSX (Yosemite) due to clock_gettime / CLOCK_MONOTONIC

Hi

I don't think any version of OSX / MacOS has clock_gettime; Yosemite certainly doesn't, so the latest update won't build:

$ make
cc -O2 -pipe -Wall -DEMACS -DVI   -c -o alloc.o alloc.c
cc -O2 -pipe -Wall -DEMACS -DVI   -c -o c_ksh.o c_ksh.c
cc -O2 -pipe -Wall -DEMACS -DVI   -c -o c_sh.o c_sh.c
c_sh.c:735:2: warning: implicit declaration of function 'clock_gettime' is invalid in C99
      [-Wimplicit-function-declaration]
        clock_gettime(CLOCK_MONOTONIC, &ts0);
        ^
c_sh.c:735:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
        clock_gettime(CLOCK_MONOTONIC, &ts0);
                      ^
c_sh.c:752:17: error: use of undeclared identifier 'CLOCK_MONOTONIC'
                clock_gettime(CLOCK_MONOTONIC, &ts1);
                              ^
1 warning and 2 errors generated.
make: *** [c_sh.o] Error 1

Compiling oksh against netbsd-curses

I am trying to compile oksh by replacing ncurses with netbsd-curses, however, during the configuration process it does not detect the curses library even though it's correctly installed in /usr/lib and /usr/include.
The configuration arguments I use are --enable-curses --enable-ksh --enable-static

~/void-packages שׂ master
-> $ ./xbps-src -f pkg -C oksh
=> oksh-7.1_2: cleaning build directory...
=> oksh: removing files from destdir...
=> xbps-src: updating repositories for host (x86_64-musl)...
[*] Updating repository `https://alpha.de.repo.voidlinux.org/current/musl/x86_64-musl-repodata' ...
[*] Updating repository `https://alpha.de.repo.voidlinux.org/current/musl/nonfree/x86_64-musl-repodata' ...
[*] Updating repository `https://alpha.de.repo.voidlinux.org/current/musl/debug/x86_64-musl-repodata' ...
=> xbps-src: updating software in / masterdir...
=> xbps-src: cleaning up / masterdir...
=> oksh-7.1_2: building [gnu-configure] for x86_64-musl...
   [host] pkgconf-1.8.0_1: found (https://alpha.de.repo.voidlinux.org/current/musl)
   [target] netbsd-curses-devel-0.3.2_1: found (/host/binpkgs)
=> oksh-7.1_2: installing host dependencies: pkgconf-1.8.0_1 ...
=> oksh-7.1_2: installing target dependencies: netbsd-curses-devel-0.3.2_1 ...
=> oksh-7.1_2: running do-fetch hook: 00-distfiles ...
=> oksh-7.1_2: running do-extract hook: 00-distfiles ...
=> oksh-7.1_2: extracting distfile(s), please wait...
=> oksh-7.1_2: running do-patch hook: 00-patches ...
=> oksh-7.1_2: patching: cross.patch.
=> oksh-7.1_2: running pre-configure hook: 00-gnu-configure-asneeded ...
=> oksh-7.1_2: running pre-configure hook: 01-override-config ...
=> oksh-7.1_2: running pre-configure hook: 02-script-wrapper ...
=> oksh-7.1_2: running do_configure ...
checking for C compiler... cc
checking if the compiler can compile C99 without -std=c99... yes
checking for -w compiler flag... yes
checking for OS... Linux
checking for -flto compiler flag... not enabled
checking for __dead... no
checking for __dead2... no
checking for __attribute__((__noreturn__))... yes
checking for asprintf... yes
checking for clock_gettime in libc... yes
checking for confstr... yes
checking for curses library... not found
oksh will be built without screen clearing support
checking for issetugid... yes
checking for pledge... no
checking for reallocarray... yes
checking for setresgid... yes
checking for setresuid... yes
checking for sig_t... yes
checking for srand_deterministic... no
checking for st_mtim... yes
checking for st_mtimespec... no
checking for stravis... no
checking for strlcat... yes
checking for strlcpy... yes
checking for strtonum... no
checking for strunvis... no
checking for sys_siglist... no
checking for sys_signame... no
checking for timeradd... yes
checking for timerclear... yes
checking for timersub... yes
checking for out-of-tree build... no
creating Makefile... done
=> oksh-7.1_2: running pre-build hook: 02-script-wrapper ...
=> oksh-7.1_2: running do_build ...
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o alloc.o alloc.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o asprintf.o asprintf.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o c_ksh.o c_ksh.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o c_sh.o c_sh.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o c_test.o c_test.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o c_ulimit.o c_ulimit.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o edit.o edit.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o emacs.o emacs.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o eval.o eval.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o exec.o exec.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o expr.o expr.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o history.o history.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o io.o io.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o jobs.o jobs.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o lex.o lex.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o mail.o mail.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o main.o main.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o misc.o misc.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o path.o path.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o shf.o shf.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o syn.o syn.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o table.o table.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o trap.o trap.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o tree.o tree.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o tty.o tty.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o var.o var.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o version.o version.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o vi.o vi.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o confstr.o confstr.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o reallocarray.o reallocarray.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o siglist.o siglist.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o signame.o signame.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o strlcat.o strlcat.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o strlcpy.o strlcpy.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o strtonum.o strtonum.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o unvis.o unvis.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o vis.o vis.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o issetugid.o issetugid.c
cc -Wl,-z,relro -Wl,-z,now -Wl,--as-needed  -march=native -O2 -pipe   -static -o ksh alloc.o asprintf.o c_ksh.o c_sh.o c_test.o c_ulimit.o edit.o emacs.o eval.o exec.o expr.o history.o io.o jobs.o lex.o mail.o main.o misc.o path.o shf.o syn.o table.o trap.o tree.o tty.o var.o version.o vi.o confstr.o reallocarray.o siglist.o signame.o strlcat.o strlcpy.o strtonum.o unvis.o vis.o issetugid.o  
=> oksh-7.1_2: skipping check (XBPS_CHECK_PKGS is disabled) ...
=> oksh-7.1_2: running pre-install hook: 00-libdir ...
=> oksh-7.1_2: running pre-install hook: 02-script-wrapper ...
=> oksh-7.1_2: running pre-install hook: 98-fixup-gir-path ...
=> oksh-7.1_2: running do_install ...
install -d /destdir//oksh-7.1/usr/bin
install -d /destdir//oksh-7.1/usr/share/man/man1
install -c -s -m 755 ksh /destdir//oksh-7.1/usr/bin
install-wrapper: overriding call to strip(1).
install -c -m 644 ksh.1 /destdir//oksh-7.1/usr/share/man/man1
Please add /usr/bin/ksh to /etc/shells
=> oksh-7.1_2: running post-install hook: 00-compress-info-files ...
=> oksh-7.1_2: running post-install hook: 00-fixup-gir-path ...
=> oksh-7.1_2: running post-install hook: 00-libdir ...
=> oksh-7.1_2: running post-install hook: 00-uncompress-manpages ...
=> oksh-7.1_2: running post-install hook: 01-remove-misc ...
=> oksh-7.1_2: running post-install hook: 02-remove-libtool-archives ...
=> oksh-7.1_2: running post-install hook: 02-remove-perl-files ...
=> oksh-7.1_2: running post-install hook: 02-remove-python-bytecode-files ...
=> oksh-7.1_2: running post-install hook: 03-remove-empty-dirs ...
=> WARNING: oksh-7.1_2: removed empty dir: /usr/lib
=> oksh-7.1_2: running post-install hook: 04-create-xbps-metadata-scripts ...
   Added trigger 'register-shell' for the 'INSTALL' script.
   Added trigger 'register-shell' for the 'REMOVE' script.
=> oksh-7.1_2: running post-install hook: 05-generate-gitrevs ...
=> oksh-7.1_2: running post-install hook: 06-strip-and-debug-pkgs ...
   Stripped static executable: /usr/bin/ksh
=> oksh-7.1_2: running post-install hook: 10-pkglint-devel-paths ...
=> oksh-7.1_2: running post-install hook: 11-pkglint-elf-in-usrshare ...
=> oksh-7.1_2: running post-install hook: 12-rename-python3-c-bindings ...
=> oksh-7.1_2: running post-install hook: 13-pkg-config-clean-xbps-cross-base-ref ...
=> oksh-7.1_2: running post-install hook: 14-fix-permissions ...
=> oksh-7.1_2: running post-install hook: 99-pkglint-warn-cross-cruft ...
=> oksh-7.1_2: running pre-pkg hook: 03-rewrite-python-shebang ...
=> oksh-7.1_2: running pre-pkg hook: 04-generate-runtime-deps ...
=> oksh-7.1_2: running pre-pkg hook: 05-prepare-32bit ...
=> oksh-7.1_2: running pre-pkg hook: 06-shlib-provides ...
=> oksh-7.1_2: running pre-pkg hook: 90-set-timestamps ...
=> oksh-7.1_2: setting mtimes to Mon May  9 21:47:24 UTC 2022
=> oksh-7.1_2: running pre-pkg hook: 99-pkglint-subpkgs ...
=> oksh-7.1_2: running pre-pkg hook: 99-pkglint ...
=> oksh-7.1_2: running pre-pkg hook: 999-collected-rdeps ...
=> oksh-7.1_2: running do-pkg hook: 00-gen-pkg ...
=> Creating oksh-7.1_2.x86_64-musl.xbps for repository /host/binpkgs ...
=> oksh-7.1_2: running post-pkg hook: 00-register-pkg ...
=> Registering new packages to /host/binpkgs
index: added `oksh-7.1_2' (x86_64-musl).
index: 183 packages registered.

Doing a search in the chroot jail it can be corroborated that the libraries are indeed available:

~/void-packages שׂ master
-> $ find masterdir/usr/include -name term.h -o -name *curses*
masterdir/usr/include/term.h
masterdir/usr/include/curses.h
masterdir/usr/include/ncurses.h
~/void-packages שׂ master
-> $ find masterdir/usr/lib -name *curses.a   
masterdir/usr/lib/libncurses.a
masterdir/usr/lib/libcurses.a

Is there any way for the configuration script to detect netbsd-curses?

What is correct value for TERM to ^L=clear-screen on Linux?

Hello,

Thanks for your efforts porting oksh. Would you happen to know what I should set as the correct value for TERM to ^L=clear-screen on Linux?

I'm on Alpine Linux and ^L does not clear the screen, only enters a newline reprints current input.

This is the same on console with TERM=linux and in X11 with st(1) and TERM=st-256color. I checked my OpenBSD VPS and it has TERM=xterm but that does not seem to work either. I get the same in tmux(1) too.

I have ncurses-terminfo installed, and ncurses provides /usr/bin/clear which successfully clears the console and terminal so it seems like the console and terminals can clear, they're just not receiving the correct escape strings?

Thanks in advance.

oksh.1 is out of sync with ksh.1

Hi

When installing as oksh, oksh.1 gets installed in mandir.

oksh.1 seems to have been generated on Sep 17, 2017 with e3fc9d2 ; consequently, there are some updates to ksh.1 that are not being included in oksh.1. (See diff, below.)

--- oksh.1	2017-09-17 22:27:07.000000000 +0100
+++ ksh.1	2019-04-06 18:43:17.000000000 +0100
@@ -1,16 +1,16 @@
-.\"	$OpenBSD: ksh.1,v 1.195 2017/08/30 17:08:45 jca Exp $
+.\"	$OpenBSD: ksh.1,v 1.203 2019/04/03 14:55:12 jca Exp $
 .\"
 .\"	Public Domain
 .\"
-.Dd $Mdocdate: August 30 2017 $
-.Dt OKSH 1
+.Dd $Mdocdate: April 3 2019 $
+.Dt KSH 1
 .Os
 .Sh NAME
-.Nm oksh ,
+.Nm ksh ,
 .Nm rksh
 .Nd public domain Korn shell
 .Sh SYNOPSIS
-.Nm oksh
+.Nm ksh
 .Bk -words
 .Op Fl +abCefhiklmnpruvXx
 .Op Fl +o Ar option
@@ -540,7 +540,7 @@
 .Ar list
 is executed, the exit status is zero.
 .It Xo Ic for Ar name
-.Oo Cm in Ar word No ... Oc ;
+.Op Cm in Op Ar word ... ;
 .Cm do Ar list ; Cm done
 .Xc
 For each
@@ -564,10 +564,10 @@
 The exit status of a
 .Ic for
 statement is the last exit status of
-.Ar list ;
-if
+.Ar list .
+If there are no items,
 .Ar list
-is never executed, the exit status is zero.
+is not executed and the exit status is zero.
 .It Xo Ic if Ar list ;
 .Cm then Ar list ;
 .Oo Cm elif Ar list ;
@@ -858,8 +858,6 @@
 .Ic r Ns ='fc -s'
 .It
 .Ic stop Ns ='kill -STOP'
-.It
-.Ic type Ns ='whence -v'
 .El
 .Pp
 Tracked aliases allow the shell to remember where it found a particular
@@ -1539,7 +1537,7 @@
 this hack; it's in the original
 .Nm .
 .Pp
-The default prompt is
+The default prompt is the first part of the hostname, followed by
 .Sq $\ \&
 for non-root users,
 .Sq #\ \&
@@ -1719,6 +1717,10 @@
 The number of seconds since the shell started or, if the parameter has been
 assigned an integer value, the number of seconds since the assignment plus the
 value that was assigned.
+.It Ev TERM
+The user's terminal type.
+If set, it will be used to determine the escape sequence used to
+clear the screen.
 .It Ev TMOUT
 If set to a positive integer in an interactive shell, it specifies the maximum
 number of seconds the shell will wait for input after printing the primary
@@ -2788,11 +2790,16 @@
 .Ar string Ns = Ns Op Ar editing-command
 .Ar ...
 .Xc
-The specified editing command is bound to the given
+In
+.Sx Emacs editing mode ,
+the specified editing command is bound to the given
 .Ar string .
 Future input of the
 .Ar string
 will cause the editing command to be immediately invoked.
+Bindings have no effect in
+.Sx Vi editing mode .
+.Pp
 If the
 .Fl m
 flag is given, the specified input
@@ -4070,6 +4077,11 @@
 .It Ic true
 A command that exits with a zero value.
 .Pp
+.It Ic type
+Short form of
+.Ic command Fl V
+(see above).
+.Pp
 .It Xo
 .Ic typeset
 .Oo
@@ -4656,7 +4668,7 @@
 Most ordinary characters are bound to this.
 .It Xo backward-char:
 .Op Ar n
-.No ^B , ^XD
+.No ^B , ^X^D
 .Xc
 Moves the cursor backward
 .Ar n
@@ -4682,6 +4694,11 @@
 Uppercase the first character in the next
 .Ar n
 words, leaving the cursor past the end of the last word.
+.It clear-screen: ^L
+Clears the screen if the
+.Ev TERM
+parameter is set and the terminal supports clearing the screen, then
+reprints the prompt string and the current input line.
 .It comment: ^[#
 If the current line does not begin with a comment character, one is added at
 the beginning of the line and the line is entered (as if return had been
@@ -4749,7 +4766,7 @@
 characters after the cursor.
 .It Xo delete-word-backward:
 .Op Ar n
-.No ERASE , ^[^? , ^[^H , ^[h
+.No WERASE , ^[ERASE , ^W, ^[^? , ^[^H , ^[h
 .Xc
 Deletes
 .Ar n
@@ -4758,9 +4775,9 @@
 .Op Ar n
 .No ^[d
 .Xc
-Deletes characters after the cursor up to the end of
+Deletes
 .Ar n
-words.
+words after the cursor.
 .It Xo down-history:
 .Op Ar n
 .No ^N , ^XB
@@ -4830,8 +4847,6 @@
 .Ar n .
 .It kill-line: KILL
 Deletes the entire input line.
-.It kill-region: ^W
-Deletes the input between the cursor and the mark.
 .It Xo kill-to-eol:
 .Op Ar n
 .No ^K
@@ -4876,7 +4891,7 @@
 word of the previous command is inserted at the cursor.
 .It quote: ^^
 The following character is taken literally rather than as an editing command.
-.It redraw: ^L
+.It redraw:
 Reprints the prompt string and the current input line.
 .It Xo search-character-backward:
 .Op Ar n
@@ -4938,6 +4953,14 @@
 .Ic yank ,
 replaces the inserted text string with the next previously killed text string.
 .El
+.Pp
+The following editing commands lack default bindings but can be used with the
+.Ic bind
+command:
+.Bl -tag -width Ds
+.It kill-region
+Deletes the input between the cursor and the mark.
+.El
 .Ss Vi editing mode
 The vi command-line editor in
 .Nm

oksh not compliant with ksh88 vi-editing mode?

I have tested oksh on a couple of OpenBSD systems as well as this port on Debian (Devuan) and I am having a problem.
I am wondering if it is user error. I thought I might ask here before heading upstream.

Example:

$ oksh

$ set -o vi ; set -o viraw ; set -o posix

$ for I in a b c

do
echo $I
done
a
b
c

So far so good, but:

^[k
$ done

This behavior is unusual, per ksh88, ksh93, and each "commercial POSIX" implementation I have noticed (AIX, HP-UX).
oksh is actually similar to the way GNU Bash works in this case.

$ fc -l
1 set -o vi ; set -o viraw ; set -o posix
2 for I in a b c
3 do
4 echo $I
5 done

Notice how the for loop in history is "split"; each command is on 1 line instead of together.

Compare to the common/classic behavior:

$ for I in a b c

do
echo $I
done
a
b
c

^[k
$ for I in a b c^Jdo^Jecho $I^Jdone

This allows direct command editing and execution of the entire loop within vi, by pressing "v".

$ fc -l
1 set -o vi ; set -o viraw ; set -o posix
2 for I in a b c
do
echo $I
done

Is this "splitting" the "expected" behavior in oksh? If so, is there a way to get the "classic" behavior of ksh88's vi-mode or should I just use a different shell?

Thanks

"Illegal instruction" error after compiling oksh with `zig cc` and `--no-thanks` flag

I compiled oksh using the Zig CC compiler (clang wrapper with cross-compilation support and ubsan) once with the --no-thanks flag and once without. The binary compiled with --no-thanks causes an "Illegal instruction" error when attempting to compile other programs, meaning that undefined behavior was detected.

Here's an example:

mkdir -p /tmp/test && cd /tmp/test
wget https://github.com/ibara/oksh/releases/download/oksh-7.3/oksh-7.3.tar.gz
wget https://invisible-island.net/archives/byacc/byacc-20230521.tgz

# compile oksh with `--no-thanks` using zig cc
tar xf oksh-7.3.tar.gz && cd oksh-7.3
CC="zig cc -target x86_64-linux-musl" ./configure --no-thanks
make

# configure byacc using oksh as shell
cd /tmp/test
tar xf byacc-20230521.tgz && cd byacc-20230521
sed -i -e 's_/bin/sh_/tmp/test/oksh-7.3/oksh_' configure
./configure --help # Illegal instruction

update to latest code in src

Leaving this here to merge changes from latest upstream into master. I'll prepare a commit with the updates unless anyone objects?

Slow performance on multiple `printf`

First of all thanks for a great port! 🖤

Second, I found some performance deviations compared to other shells,
so please let me know if the following is in scope or just mere curiosity.

I've been trying using loops to generate printf color escape sequences, so instead of writing something like this.
They're generated by a for loop as in here.

To benchmark these, run:

$ hyperfine -w32 -r64 -N --sort mean-time --export-markdown - \
    ./bg_for.sh ./bg_printf.sh ./bg_while.sh

Output

Summary
  ./bg_printf.sh ran
    3.48 ± 0.16 times faster than ./bg_for.sh
    3.52 ± 0.16 times faster than ./bg_while.sh
* Benchmarks can be reproduced with time. This issue is stored as a separate repo: pdksh-perf.

So, things slow down by a factor of 3X, but with a more detailed table, execution gets down to 110X times slower.
These benchmarks can be reproduced in last oksh and mksh, maybe because both come originally from pksh.
Is the slower performance of loops in pdksh-derived shells for this case normal and to be expected?

Thanks in advance, keep rocking! 🚀

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.