Initial revision
This commit is contained in:
parent
20c2ca1817
commit
d8e4d937ba
330
Makefile.in
Normal file
330
Makefile.in
Normal file
@ -0,0 +1,330 @@
|
|||||||
|
#
|
||||||
|
# @configure_input@
|
||||||
|
#
|
||||||
|
|
||||||
|
srcdir = @srcdir@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
|
||||||
|
CC = @CC@
|
||||||
|
CPP = @CPP@
|
||||||
|
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
|
||||||
|
DEFS = @DEFS@
|
||||||
|
LIBS = @LIBS@
|
||||||
|
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
CFLAGS = @CFLAGS@
|
||||||
|
LDSTATIC = @LDSTATIC@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
|
||||||
|
SHELL_PROG = @SHELL_PROG@
|
||||||
|
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
transform=@program_transform_name@
|
||||||
|
|
||||||
|
bindir = $(exec_prefix)/bin
|
||||||
|
mandir = $(prefix)/man/man$(manext)
|
||||||
|
manext = 1
|
||||||
|
|
||||||
|
# Suffix for executables: nothing for unix, .exe for os/2.
|
||||||
|
exe_suffix=@ac_exe_suffix@
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
|
SRCS = alloc.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c emacs.c \
|
||||||
|
eval.c exec.c expr.c history.c io.c jobs.c lex.c mail.c \
|
||||||
|
main.c misc.c missing.c path.c shf.c sigact.c syn.c table.c trap.c \
|
||||||
|
tree.c tty.c var.c version.c vi.c
|
||||||
|
OBJS = 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 misc.o missing.o path.o shf.o sigact.o syn.o table.o trap.o \
|
||||||
|
tree.o tty.o var.o version.o vi.o
|
||||||
|
HDRS = c_test.h edit.h expand.h ksh_dir.h ksh_limval.h ksh_stat.h ksh_time.h \
|
||||||
|
ksh_times.h ksh_wait.h lex.h proto.h sh.h shf.h sigact.h \
|
||||||
|
table.h tree.h tty.h
|
||||||
|
DISTFILES = $(SRCS) $(HDRS) ksh.Man Makefile.in configure.in \
|
||||||
|
config.h.in conf-end.h acconfig.h aclocal.m4 emacs-gen.sh \
|
||||||
|
mkinstalldirs install-sh new-version.sh siglist.in siglist.sh mkman \
|
||||||
|
check-fd.c check-pgrp.c check-sigs.c \
|
||||||
|
README NEWS CONTRIBUTORS LEGAL PROJECTS INSTALL NOTES BUG-REPORTS \
|
||||||
|
IAFA-PACKAGE ChangeLog ChangeLog.0 configure stamp-h.in
|
||||||
|
# ETCFILES also disted, but handled differently
|
||||||
|
ETCFILES = etc/ksh.kshrc etc/profile etc/sys_config.sh
|
||||||
|
# MISCFILES also disted, but handled differently
|
||||||
|
MISCFILES = misc/ChangeLog.sjg misc/Changes.jrm misc/Changes.mlj \
|
||||||
|
misc/Changes.pc misc/README.sjg misc/ReadMe.eg misc/ReadMe.emacs \
|
||||||
|
misc/ReadMe.jrm misc/Bugs
|
||||||
|
# TESTFILES also disted, but handled differently
|
||||||
|
TESTFILES = tests/README tests/th tests/th-sh tests/alias.t tests/arith.t \
|
||||||
|
tests/bksl-nl.t tests/brkcont.t tests/cdhist.t tests/eglob.t \
|
||||||
|
tests/glob.t tests/heredoc.t tests/history.t tests/ifs.t \
|
||||||
|
tests/integer.t tests/lineno.t tests/read.t tests/regress.t \
|
||||||
|
tests/syntax.t tests/unclass1.t tests/unclass2.t \
|
||||||
|
tests/version.t
|
||||||
|
# OS2FILES also disted, but handled differently
|
||||||
|
OS2FILES = os2/Makefile os2/config.h os2/config.status os2/configure.cmd \
|
||||||
|
os2/emacs.out os2/kshrc.ksh os2/make.sed os2/os2.c os2/os2siglist.out \
|
||||||
|
os2/README.os2 os2/NEWS.os2 os2/os2bugs os2/th.cmd os2/config.cache
|
||||||
|
|
||||||
|
all: $(SHELL_PROG)$(exe_suffix) $(SHELL_PROG).1
|
||||||
|
|
||||||
|
# This shouldn't be first - some makes don't know about PRECIOUS and assume it
|
||||||
|
# is the default target.
|
||||||
|
.PRECIOUS: configure config.h.in Makefile config.status
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(DEFS) -I. -I$(srcdir) $(CFLAGS) $<
|
||||||
|
|
||||||
|
install: installdirs all
|
||||||
|
$(INSTALL_PROGRAM) $(SHELL_PROG)$(exe_suffix) $(bindir)/`echo $(SHELL_PROG)|sed '$(transform)'`$(exe_suffix)
|
||||||
|
-$(INSTALL_DATA) $(SHELL_PROG).1 $(mandir)/`echo $(SHELL_PROG)|sed '$(transform)'`.$(manext)
|
||||||
|
-@prog=$(bindir)/`echo $(SHELL_PROG)|sed '$(transform)'`$(exe_suffix);\
|
||||||
|
test -f /etc/shells \
|
||||||
|
&& (grep "^$$prog\$$" /etc/shells > /dev/null \
|
||||||
|
|| echo \
|
||||||
|
"NOTE: /etc/shells does not contain $$prog \
|
||||||
|
you should add it if you want to set your shell to $(SHELL_PROG)")
|
||||||
|
|
||||||
|
installdirs:
|
||||||
|
$(srcdir)/mkinstalldirs $(bindir) $(mandir)
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(bindir)/`echo $(SHELL_PROG)|sed '$(transform)'`$(exe_suffix)
|
||||||
|
rm -f $(mandir)/`echo $(SHELL_PROG)|sed '$(transform)'`.$(manext)
|
||||||
|
|
||||||
|
check test:
|
||||||
|
$(srcdir)/tests/th-sh $(srcdir)/tests/th -s $(srcdir)/tests -p ./$(SHELL_PROG)$(exe_suffix) -C pdksh,sh,ksh,posix,posix-upu $(TESTARGS)
|
||||||
|
|
||||||
|
$(SHELL_PROG)$(exe_suffix): $(OBJS)
|
||||||
|
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||||
|
|
||||||
|
# two steps to prevent the creation of a bogus tmpksh.1
|
||||||
|
$(SHELL_PROG).1: $(srcdir)/ksh.Man
|
||||||
|
$(srcdir)/mkman $(SHELL_PROG) $(srcdir)/ksh.Man > tmpksh.1
|
||||||
|
mv tmpksh.1 $(SHELL_PROG).1
|
||||||
|
|
||||||
|
info:
|
||||||
|
@echo "No info (yet)"
|
||||||
|
|
||||||
|
dvi:
|
||||||
|
|
||||||
|
$(srcdir)/configure: configure.in aclocal.m4
|
||||||
|
cd $(srcdir) && autoconf
|
||||||
|
|
||||||
|
$(srcdir)/config.h.in: stamp-h.in
|
||||||
|
$(srcdir)/stamp-h.in: configure.in aclocal.m4 acconfig.h
|
||||||
|
cd $(srcdir) && autoheader
|
||||||
|
date > $(srcdir)/stamp-h.in
|
||||||
|
|
||||||
|
config.h: stamp-h
|
||||||
|
stamp-h: config.h.in config.status
|
||||||
|
CONFIG_FILES="" CONFIG_HEADERS=config.h ./config.status
|
||||||
|
date > stamp-h
|
||||||
|
|
||||||
|
Makefile: Makefile.in config.status
|
||||||
|
CONFIG_FILES=Makefile CONFIG_HEADERS= ./config.status
|
||||||
|
|
||||||
|
config.status: configure
|
||||||
|
LDSTATIC="$(LDSTATIC)" ./config.status --recheck
|
||||||
|
|
||||||
|
# two steps to prevent the creation of a bogus siglist.out
|
||||||
|
siglist.out: config.h sh.h siglist.in siglist.sh
|
||||||
|
$(srcdir)/siglist.sh "$(CPP) $(CPPFLAGS) $(DEFS) -I. -I$(srcdir)" < $(srcdir)/siglist.in > tmpsiglist.out
|
||||||
|
mv tmpsiglist.out siglist.out
|
||||||
|
|
||||||
|
# two steps to prevent the creation of a bogus emacs.out
|
||||||
|
emacs.out: emacs.c
|
||||||
|
$(srcdir)/emacs-gen.sh $(srcdir)/emacs.c > tmpemacs.out
|
||||||
|
mv tmpemacs.out emacs.out
|
||||||
|
|
||||||
|
debugtools: check-fd$(exe_suffix) check-sigs$(exe_suffix) \
|
||||||
|
check-pgrp$(exe_suffix)
|
||||||
|
|
||||||
|
check-fd.o check-pgrp.o check-sigs.o: config.h
|
||||||
|
check-fd$(exe_suffix): check-fd.o
|
||||||
|
$(CC) $(LDFLAGS) -o $@ check-fd.o $(LIBS)
|
||||||
|
|
||||||
|
check-pgrp$(exe_suffix): check-pgrp.o
|
||||||
|
$(CC) $(LDFLAGS) -o $@ check-pgrp.o $(LIBS)
|
||||||
|
|
||||||
|
check-sigs$(exe_suffix): check-sigs.o
|
||||||
|
$(CC) $(LDFLAGS) -o $@ check-sigs.o $(LIBS)
|
||||||
|
|
||||||
|
TAGS: $(SRCS) $(HDRS)
|
||||||
|
cd $(srcdir) && etags $(SRCS) $(HDRS)
|
||||||
|
|
||||||
|
tags: $(SRCS) $(HDRS)
|
||||||
|
cd $(srcdir) && ctags -wt $(SRCS) $(HDRS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f ksh$(exe_suffix) sh$(exe_suffix) ksh.1 sh.1 $(OBJS) siglist.out \
|
||||||
|
emacs.out core a.out mon.out gmon.out \
|
||||||
|
version.c.bak Makefile.bak Makefile.tmp check-fd$(exe_suffix) \
|
||||||
|
check-pgrp$(exe_suffix) check-sigs$(exe_suffix)
|
||||||
|
|
||||||
|
mostlyclean: clean
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
rm -f Makefile config.h stamp-h config.status config.log config.cache \
|
||||||
|
tags TAGS *~
|
||||||
|
|
||||||
|
realclean: distclean
|
||||||
|
|
||||||
|
dist: $(DISTFILES) $(ETCFILES) $(MISCFILES) $(TESTFILES) $(OS2FILES)
|
||||||
|
cd $(srcdir) && \
|
||||||
|
{ \
|
||||||
|
./new-version.sh; \
|
||||||
|
FNAME=pdksh-`sed -e '/"@(.)/!d' \
|
||||||
|
-e 's/[^0-9]*\([0-9.]*\).*/\1/' -e q version.c`; \
|
||||||
|
if test `echo $$FNAME|tr . ' '|wc -w|sed 's/[ ]*//g'` -gt 3; \
|
||||||
|
then \
|
||||||
|
FNAME=`echo $$FNAME | sed 's/pdksh-/pdksh-unstable-/'`; \
|
||||||
|
fi; \
|
||||||
|
echo Creating version $$FNAME; \
|
||||||
|
rm -rf $$FNAME; \
|
||||||
|
mkdir $$FNAME $$FNAME/etc $$FNAME/misc $$FNAME/tests $$FNAME/os2; \
|
||||||
|
cp -p $(DISTFILES) $$FNAME; \
|
||||||
|
cp -p $(ETCFILES) $$FNAME/etc; \
|
||||||
|
cp -p $(MISCFILES) $$FNAME/misc; \
|
||||||
|
cp -p $(TESTFILES) $$FNAME/tests; \
|
||||||
|
cp -p $(OS2FILES) $$FNAME/os2; \
|
||||||
|
./emacs-gen.sh emacs.c > os2/emacs.out; \
|
||||||
|
test -x ./Dist-fixup && ./Dist-fixup $$FNAME; \
|
||||||
|
sed -f os2/make.sed < $$FNAME/Makefile.in > $$FNAME/os2/Makefile; \
|
||||||
|
chmod -R a+rX,u+w,og-w $$FNAME; \
|
||||||
|
tar chzf $$FNAME.tar.gz $$FNAME; \
|
||||||
|
find $$FNAME -print | xargs pathchk -p; \
|
||||||
|
}
|
||||||
|
|
||||||
|
depend: $(SRCS)
|
||||||
|
sed -n '1,/[ ]PUT ANYTHING BELOW THIS LINE/p' < Makefile > Makefile.tmp
|
||||||
|
srcs=; for i in $(SRCS) ; do srcs="$$srcs $(srcdir)/$$i"; done; \
|
||||||
|
$(CC) -M $(DEFS) -I. -I$(srcdir) $(CFLAGS) $$srcs | \
|
||||||
|
sed -e 's?[ ]/[^ ]*??g' -e 's?[ ]./? ?g' \
|
||||||
|
-e 's?[ ]$(srcdir)//*? ?g' -e 's?^$(srcdir)//*??' \
|
||||||
|
-e '/^[ ]*\\[ ]*$$/d' -e '/^[^:]*:[ ]*$$/d' \
|
||||||
|
-e 's/^\([ ]*\)$$/ sh.h/' \
|
||||||
|
>> Makefile.tmp
|
||||||
|
mv Makefile.tmp Makefile
|
||||||
|
@echo 'Make depend done (stopping make)'; false
|
||||||
|
|
||||||
|
# DON'T PUT ANYTHING BELOW THIS LINE (and don't delete it - its for make depend)
|
||||||
|
alloc.o: alloc.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h
|
||||||
|
c_ksh.o: c_ksh.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h \
|
||||||
|
sh.h
|
||||||
|
c_sh.o: c_sh.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h ksh_time.h \
|
||||||
|
ksh_times.h \
|
||||||
|
sh.h
|
||||||
|
c_test.o: c_test.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h c_test.h
|
||||||
|
c_ulimit.o: c_ulimit.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_time.h \
|
||||||
|
sh.h
|
||||||
|
edit.o: edit.c config.h conf-end.h sh.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h tty.h \
|
||||||
|
edit.h \
|
||||||
|
ksh_stat.h
|
||||||
|
emacs.o: emacs.c config.h conf-end.h sh.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h ksh_dir.h \
|
||||||
|
edit.h emacs.out
|
||||||
|
eval.o: eval.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h \
|
||||||
|
ksh_dir.h \
|
||||||
|
ksh_stat.h
|
||||||
|
exec.o: exec.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h c_test.h \
|
||||||
|
ksh_stat.h
|
||||||
|
expr.o: expr.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h \
|
||||||
|
sh.h
|
||||||
|
history.o: history.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h
|
||||||
|
io.o: io.c \
|
||||||
|
sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h
|
||||||
|
jobs.o: jobs.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h ksh_wait.h \
|
||||||
|
ksh_times.h ksh_time.h \
|
||||||
|
tty.h \
|
||||||
|
sh.h
|
||||||
|
lex.o: lex.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h \
|
||||||
|
sh.h
|
||||||
|
mail.o: mail.c config.h conf-end.h sh.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h ksh_time.h \
|
||||||
|
sh.h
|
||||||
|
main.o: main.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h ksh_time.h \
|
||||||
|
sh.h
|
||||||
|
misc.o: misc.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h \
|
||||||
|
sh.h
|
||||||
|
missing.o: missing.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h ksh_dir.h \
|
||||||
|
ksh_time.h \
|
||||||
|
ksh_times.h \
|
||||||
|
sh.h
|
||||||
|
path.o: path.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h
|
||||||
|
shf.o: shf.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h ksh_limval.h \
|
||||||
|
sh.h
|
||||||
|
sigact.o: sigact.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h
|
||||||
|
syn.o: syn.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h c_test.h
|
||||||
|
table.o: table.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h
|
||||||
|
trap.o: trap.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h siglist.out
|
||||||
|
tree.o: tree.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h
|
||||||
|
tty.o: tty.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h tty.h \
|
||||||
|
sh.h
|
||||||
|
var.o: var.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_time.h \
|
||||||
|
ksh_limval.h \
|
||||||
|
ksh_stat.h \
|
||||||
|
sh.h
|
||||||
|
version.o: version.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h
|
||||||
|
vi.o: vi.c config.h conf-end.h sh.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h \
|
||||||
|
ksh_stat.h edit.h
|
185
acconfig.h
Normal file
185
acconfig.h
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
/*
|
||||||
|
* This file, acconfig.h, which is a part of pdksh (the public domain ksh),
|
||||||
|
* is placed in the public domain. It comes with no licence, warranty
|
||||||
|
* or guarantee of any kind (i.e., at your own risk).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
@TOP@
|
||||||
|
|
||||||
|
/* Define if your kernal doesn't handle scripts starting with #! */
|
||||||
|
#undef SHARPBANG
|
||||||
|
|
||||||
|
/* Define if dup2() preserves the close-on-exec flag (ultrix does this) */
|
||||||
|
#undef DUP2_BROKEN
|
||||||
|
|
||||||
|
/* Define as the return value of signal handlers (0 or ). */
|
||||||
|
#undef RETSIGVAL
|
||||||
|
|
||||||
|
/* Define if you have posix signal routines (sigaction(), et. al.) */
|
||||||
|
#undef POSIX_SIGNALS
|
||||||
|
|
||||||
|
/* Define if you have BSD4.2 signal routines (sigsetmask(), et. al.) */
|
||||||
|
#undef BSD42_SIGNALS
|
||||||
|
|
||||||
|
/* Define if you have BSD4.1 signal routines (sigset(), et. al.) */
|
||||||
|
#undef BSD41_SIGNALS
|
||||||
|
|
||||||
|
/* Define if you have v7 signal routines (signal(), signal reset on delivery) */
|
||||||
|
#undef V7_SIGNALS
|
||||||
|
|
||||||
|
/* Define to use the fake posix signal routines (sigact.[ch]) */
|
||||||
|
#undef USE_FAKE_SIGACT
|
||||||
|
|
||||||
|
/* Define if signals don't interrupt read() */
|
||||||
|
#undef SIGNALS_DONT_INTERRUPT
|
||||||
|
|
||||||
|
/* Define if you have bsd versions of the setpgrp() and getpgrp() routines */
|
||||||
|
#undef BSD_PGRP
|
||||||
|
|
||||||
|
/* Define if you have POSIX versions of the setpgid() and getpgrp() routines */
|
||||||
|
#undef POSIX_PGRP
|
||||||
|
|
||||||
|
/* Define if you have sysV versions of the setpgrp() and getpgrp() routines */
|
||||||
|
#undef SYSV_PGRP
|
||||||
|
|
||||||
|
/* Define if you don't have setpgrp(), setpgid() or getpgrp() routines */
|
||||||
|
#undef NO_PGRP
|
||||||
|
|
||||||
|
/* Define to char if your compiler doesn't like the void keyword */
|
||||||
|
#undef void
|
||||||
|
|
||||||
|
/* Define to nothing if compiler doesn't like the volatile keyword */
|
||||||
|
#undef volatile
|
||||||
|
|
||||||
|
/* Define if C compiler groks function prototypes */
|
||||||
|
#undef HAVE_PROTOTYPES
|
||||||
|
|
||||||
|
/* Define if C compiler groks __attribute__((...)) (const, noreturn, format) */
|
||||||
|
#undef HAVE_GCC_FUNC_ATTR
|
||||||
|
|
||||||
|
/* Define to 32-bit signed integer type */
|
||||||
|
#undef INT32
|
||||||
|
|
||||||
|
/* Define to 32-bit signed integer type if <sys/types.h> doesn't define */
|
||||||
|
#undef clock_t
|
||||||
|
|
||||||
|
/* Define to the type of struct rlimit fields if the rlim_t type is missing */
|
||||||
|
#undef rlim_t
|
||||||
|
|
||||||
|
/* Define if time() is declared in <time.h> */
|
||||||
|
#undef TIME_DECLARED
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <signal.h> doesn't define */
|
||||||
|
#undef sigset_t
|
||||||
|
|
||||||
|
/* Define if sys_errlist[] and sys_nerr are in the C library */
|
||||||
|
#undef HAVE_SYS_ERRLIST
|
||||||
|
|
||||||
|
/* Define if sys_errlist[] and sys_nerr are defined in <errno.h> */
|
||||||
|
#undef SYS_ERRLIST_DECLARED
|
||||||
|
|
||||||
|
/* Define if sys_siglist[] is in the C library */
|
||||||
|
#undef HAVE_SYS_SIGLIST
|
||||||
|
|
||||||
|
/* Define if you have a sane <termios.h> header file */
|
||||||
|
#undef HAVE_TERMIOS_H
|
||||||
|
|
||||||
|
/* Define if you can include <sys/ioctl.h> with <termios.h> */
|
||||||
|
#undef SYS_IOCTL_WITH_TERMIOS
|
||||||
|
|
||||||
|
/* Define if you can include <sys/ioctl.h> with <termio.h> */
|
||||||
|
#undef SYS_IOCTL_WITH_TERMIO
|
||||||
|
|
||||||
|
/* Define if you have a memset() function in your C library */
|
||||||
|
#undef HAVE_MEMSET
|
||||||
|
|
||||||
|
/* Define if you have a memmove() function in your C library */
|
||||||
|
#undef HAVE_MEMMOVE
|
||||||
|
|
||||||
|
/* Define if you have a bcopy() function in your C library */
|
||||||
|
#undef HAVE_BCOPY
|
||||||
|
|
||||||
|
/* Define if you have a lstat() function in your C library */
|
||||||
|
#undef HAVE_LSTAT
|
||||||
|
|
||||||
|
/* Define if you have a sane <termio.h> header file */
|
||||||
|
#undef HAVE_TERMIO_H
|
||||||
|
|
||||||
|
/* Define if you don't have times() or if it always returns 0 */
|
||||||
|
#undef TIMES_BROKEN
|
||||||
|
|
||||||
|
/* Define if opendir() will open non-directory files */
|
||||||
|
#undef OPENDIR_DOES_NONDIR
|
||||||
|
|
||||||
|
/* Define if the pgrp of setpgrp() can't be the pid of a zombie process */
|
||||||
|
#undef NEED_PGRP_SYNC
|
||||||
|
|
||||||
|
/* Define if you arg running SCO unix */
|
||||||
|
#undef OS_SCO
|
||||||
|
|
||||||
|
/* Define if you arg running ISC unix */
|
||||||
|
#undef OS_ISC
|
||||||
|
|
||||||
|
/* Define if you arg running OS2 with the EMX library */
|
||||||
|
#undef OS2
|
||||||
|
|
||||||
|
/* Define if you have a POSIX.1 compatiable <sys/wait.h> */
|
||||||
|
#undef POSIX_SYS_WAIT
|
||||||
|
|
||||||
|
/* Define if your OS maps references to /dev/fd/n to file descriptor n */
|
||||||
|
#undef HAVE_DEV_FD
|
||||||
|
|
||||||
|
/* Define if your C library's getwd/getcwd function dumps core in unreadable
|
||||||
|
* directories. */
|
||||||
|
#undef HPUX_GETWD_BUG
|
||||||
|
|
||||||
|
/* ------- ------ ----- ---- --- -- - - -- --- ---- ----- ------ ------- */
|
||||||
|
/* Defines from here on down are enable/disable options to configure */
|
||||||
|
|
||||||
|
/* Default PATH (see comments in configure.in for more details) */
|
||||||
|
#undef DEFAULT_PATH
|
||||||
|
|
||||||
|
/* Include ksh features? (see comments in configure.in for more details) */
|
||||||
|
#undef KSH
|
||||||
|
|
||||||
|
/* Include emacs editing? (see comments in configure.in for more details) */
|
||||||
|
#undef EMACS
|
||||||
|
|
||||||
|
/* Include vi editing? (see comments in configure.in for more details) */
|
||||||
|
#undef VI
|
||||||
|
|
||||||
|
/* Include job control? (see comments in configure.in for more details) */
|
||||||
|
#undef JOBS
|
||||||
|
|
||||||
|
/* Include brace-expansion? (see comments in configure.in for more details) */
|
||||||
|
#undef BRACE_EXPAND
|
||||||
|
|
||||||
|
/* Include any history? (see comments in configure.in for more details) */
|
||||||
|
#undef HISTORY
|
||||||
|
|
||||||
|
/* Include complex history? (see comments in configure.in for more details) */
|
||||||
|
#undef COMPLEX_HISTORY
|
||||||
|
|
||||||
|
/* Strict POSIX behaviour? (see comments in configure.in for more details) */
|
||||||
|
#undef POSIXLY_CORRECT
|
||||||
|
|
||||||
|
/* Specify default $ENV? (see comments in configure.in for more details) */
|
||||||
|
#undef DEFAULT_ENV
|
||||||
|
|
||||||
|
/* Include shl(1) support? (see comments in configure.in for more details) */
|
||||||
|
#undef SWTCH
|
||||||
|
|
||||||
|
/* Include game-of-life? (see comments in configure.in for more details) */
|
||||||
|
#undef SILLY
|
||||||
|
|
||||||
|
@BOTTOM@
|
||||||
|
|
||||||
|
/* Need to use a separate file to keep the configure script from commenting
|
||||||
|
* out the undefs....
|
||||||
|
*/
|
||||||
|
#include "conf-end.h"
|
||||||
|
|
||||||
|
#endif /* CONFIG_H */
|
1365
aclocal.m4
vendored
Normal file
1365
aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
89
check-fd.c
Normal file
89
check-fd.c
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
/* A simple program to check which file descriptors are open and
|
||||||
|
* print some info about them.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
|
# include <stdlib.h>
|
||||||
|
#endif /* HAVE_STDLIB_H */
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif /* HAVE_UNISTD_H */
|
||||||
|
#ifdef HAVE_FCNTL_H
|
||||||
|
# include <fcntl.h>
|
||||||
|
#else /* HAVE_FCNTL_H */
|
||||||
|
# include <sys/file.h>
|
||||||
|
#endif /* HAVE_FCNTL_H */
|
||||||
|
#include "ksh_stat.h"
|
||||||
|
|
||||||
|
int usage();
|
||||||
|
|
||||||
|
char *progname = "check-fd";
|
||||||
|
|
||||||
|
#define MAXFD 256 /* a somewhat arbitrary number */
|
||||||
|
|
||||||
|
int
|
||||||
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
|
{
|
||||||
|
extern int optind;
|
||||||
|
|
||||||
|
int opt;
|
||||||
|
int do_close = 0;
|
||||||
|
struct stat statb;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (argc > 0 && argv[0] && *argv[0])
|
||||||
|
progname = argv[0];
|
||||||
|
|
||||||
|
while ((opt = getopt(argc, argv, "c")) != EOF) {
|
||||||
|
switch (opt) {
|
||||||
|
case 'c':
|
||||||
|
do_close = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
usage(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optind != argc) {
|
||||||
|
fprintf(stderr, "%s: too many arguments\n", progname);
|
||||||
|
usage(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (do_close) {
|
||||||
|
for (i = 0; i < MAXFD; i++)
|
||||||
|
if (i == 1)
|
||||||
|
printf("(can't check 1)\n");
|
||||||
|
else if (close(i) >= 0)
|
||||||
|
printf("%d was open\n", i);
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < MAXFD; i++)
|
||||||
|
if (fstat(i, &statb) == 0)
|
||||||
|
printf(
|
||||||
|
"%d is open (dev/inode %hd/%ld, flags 0x%x)\n",
|
||||||
|
i, statb.st_dev, statb.st_ino,
|
||||||
|
fcntl(i, F_GETFL, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
usage(verbose)
|
||||||
|
int verbose;
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Usage: %s [-?c]\n", progname);
|
||||||
|
if (verbose)
|
||||||
|
fprintf(stderr, "\
|
||||||
|
-c use close(2) instead of fstat(2) to check for open fds\n\
|
||||||
|
(prints dev, inode and fcntl(F_GETFL) flags)\n\
|
||||||
|
");
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
return 0;
|
||||||
|
}
|
101
check-pgrp.c
Normal file
101
check-pgrp.c
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/* A simple program to print information about process groups */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
|
# include <stdlib.h>
|
||||||
|
#endif /* HAVE_STDLIB_H */
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif /* HAVE_UNISTD_H */
|
||||||
|
#ifdef HAVE_FCNTL_H
|
||||||
|
# include <fcntl.h>
|
||||||
|
#else /* HAVE_FCNTL_H */
|
||||||
|
# include <sys/file.h>
|
||||||
|
#endif /* HAVE_FCNTL_H */
|
||||||
|
|
||||||
|
#ifdef BSD_PGRP
|
||||||
|
# include <sys/ioctl.h>
|
||||||
|
int
|
||||||
|
tcgetpgrp(fd)
|
||||||
|
int fd;
|
||||||
|
{
|
||||||
|
int r, grp;
|
||||||
|
|
||||||
|
if ((r = ioctl(fd, TIOCGPGRP, &grp)) < 0)
|
||||||
|
return r;
|
||||||
|
return grp;
|
||||||
|
}
|
||||||
|
# define getPGRP() getpgrp(0)
|
||||||
|
#else /* BSD_PGRP */
|
||||||
|
# define getPGRP() getpgrp()
|
||||||
|
#endif /* BSD_PGRP */
|
||||||
|
|
||||||
|
int usage();
|
||||||
|
|
||||||
|
char *progname = "check-pgrp";
|
||||||
|
|
||||||
|
int
|
||||||
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
|
{
|
||||||
|
extern int optind;
|
||||||
|
extern char *optarg;
|
||||||
|
|
||||||
|
int opt;
|
||||||
|
int ttyfd = 0;
|
||||||
|
int my_pgrp, my_pid, my_ppid, tty_pgrp;
|
||||||
|
char *tty_name;
|
||||||
|
char *e;
|
||||||
|
|
||||||
|
if (argc > 0 && argv[0] && *argv[0])
|
||||||
|
progname = argv[0];
|
||||||
|
|
||||||
|
while ((opt = getopt(argc, argv, "u:")) != EOF) {
|
||||||
|
switch (opt) {
|
||||||
|
case 'u':
|
||||||
|
ttyfd = atoi(optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
usage(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optind != argc) {
|
||||||
|
fprintf(stderr, "%s: too many arguments\n", progname);
|
||||||
|
usage(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
my_pid = getpid();
|
||||||
|
my_ppid = getppid();
|
||||||
|
my_pgrp = getPGRP();
|
||||||
|
tty_pgrp = tcgetpgrp(ttyfd);
|
||||||
|
tty_name = ttyname(ttyfd);
|
||||||
|
|
||||||
|
printf("in %s pgrp\ntty %s (%s)\npid %d, ppid %d, pgrp %d, tty_pgrp %d\n",
|
||||||
|
my_pgrp == my_pid ? "my own"
|
||||||
|
: (my_pgrp == my_ppid ? "parent's" : "unknown"),
|
||||||
|
tty_name ? tty_name : "(none)",
|
||||||
|
tty_pgrp == my_pgrp ? "mine"
|
||||||
|
: (tty_pgrp == my_ppid ? "parent's" : "unknown"),
|
||||||
|
my_pid, my_ppid, my_pgrp, tty_pgrp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
usage(verbose)
|
||||||
|
int verbose;
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Usage: %s [-?] [-u fd]\n", progname);
|
||||||
|
if (verbose)
|
||||||
|
fprintf(stderr, "\
|
||||||
|
-u fd use fd as tty fd (default is 0)\n\
|
||||||
|
");
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
return 0;
|
||||||
|
}
|
255
check-sigs.c
Normal file
255
check-sigs.c
Normal file
@ -0,0 +1,255 @@
|
|||||||
|
/* A simple program to print information about signal handlers */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
#else
|
||||||
|
# include <strings.h>
|
||||||
|
# define strchr index
|
||||||
|
# define strrchr rindex
|
||||||
|
#endif /* HAVE_STRING_H */
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
|
# include <stdlib.h>
|
||||||
|
#endif /* HAVE_STDLIB_H */
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif /* HAVE_UNISTD_H */
|
||||||
|
|
||||||
|
#ifndef SIG_ERR
|
||||||
|
# define SIG_ERR ((RETSIGTYPE (*)()) -1)
|
||||||
|
#endif /* SIG_ERR */
|
||||||
|
|
||||||
|
/* must be similar to struct Trap in sh.h */
|
||||||
|
struct signal_info {
|
||||||
|
int signal;
|
||||||
|
char *name;
|
||||||
|
char *mess;
|
||||||
|
};
|
||||||
|
struct signal_info siginfo[] = {
|
||||||
|
{ 0, "0", "Signal 0" },
|
||||||
|
#include "siglist.out"
|
||||||
|
{ 0, (char *) 0, (char *)0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
int usage();
|
||||||
|
#if 0
|
||||||
|
RETSIGTYPE sig_catcher();
|
||||||
|
#endif /* 0 */
|
||||||
|
char *signal_name();
|
||||||
|
#ifndef HAVE_STRERROR
|
||||||
|
char *strerror(int);
|
||||||
|
#endif /* !HAVE_STRERROR */
|
||||||
|
|
||||||
|
char *progname = "check-sigs";
|
||||||
|
int caught_sigs;
|
||||||
|
|
||||||
|
int
|
||||||
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
|
{
|
||||||
|
extern int optind;
|
||||||
|
extern char *optarg;
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
int opt;
|
||||||
|
int i;
|
||||||
|
int eno;
|
||||||
|
int report_all = 0;
|
||||||
|
RETSIGTYPE (*f)();
|
||||||
|
char *ofile = (char *) 0;
|
||||||
|
char *s;
|
||||||
|
int wait_forever = 0;
|
||||||
|
|
||||||
|
if (argc > 0 && argv[0] && *argv[0])
|
||||||
|
progname = argv[0];
|
||||||
|
|
||||||
|
while ((opt = getopt(argc, argv, "ao:w")) != EOF) {
|
||||||
|
switch (opt) {
|
||||||
|
case 'a':
|
||||||
|
report_all = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'o':
|
||||||
|
ofile = optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'w':
|
||||||
|
wait_forever = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
usage(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc != optind)
|
||||||
|
usage(0);
|
||||||
|
|
||||||
|
if (ofile && freopen(ofile, "w", stdout) == (FILE *) 0) {
|
||||||
|
fprintf(stderr, "%s: Couldn't open output file `%s' - %s\n",
|
||||||
|
progname, ofile, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!wait_forever) {
|
||||||
|
char *blocked = "";
|
||||||
|
#ifdef POSIX_SIGNALS
|
||||||
|
sigset_t mask;
|
||||||
|
|
||||||
|
sigprocmask(SIG_BLOCK, (sigset_t *) 0, &mask);
|
||||||
|
#endif /* POSIX_SIGNALS */
|
||||||
|
#ifdef BSD42_SIGNALS
|
||||||
|
int mask;
|
||||||
|
|
||||||
|
mask = sigblock(0);
|
||||||
|
#endif /* BSD42_SIGNALS */
|
||||||
|
for (i = 1; i < NSIG; i++) {
|
||||||
|
f = signal(i, SIG_DFL);
|
||||||
|
eno = errno;
|
||||||
|
#ifdef BSD42_SIGNALS
|
||||||
|
blocked = (mask & sigmask(i)) ? "blocked" : "";
|
||||||
|
#endif /* BSD42_SIGNALS */
|
||||||
|
#ifdef POSIX_SIGNALS
|
||||||
|
blocked = sigismember(&mask, i) ? "blocked" : "";
|
||||||
|
#endif /* POSIX_SIGNALS */
|
||||||
|
if (f == SIG_DFL && !report_all && !*blocked)
|
||||||
|
continue;
|
||||||
|
printf("%3d: %7s %30s: ",
|
||||||
|
i, blocked, (s = signal_name(i)) ? s : "");
|
||||||
|
if (f == SIG_IGN)
|
||||||
|
printf("ignored\n");
|
||||||
|
else if (f == SIG_ERR)
|
||||||
|
printf("error - %s\n", strerror(eno));
|
||||||
|
else if (f != SIG_DFL)
|
||||||
|
printf("caught - function address %lx\n",
|
||||||
|
(long) f);
|
||||||
|
else if (report_all)
|
||||||
|
printf("default\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0 /* code assumes BSD signals - not worth posixizing */
|
||||||
|
if (wait_forever) {
|
||||||
|
printf("pid is %d\n", getpid());
|
||||||
|
sigsetmask(-1L);
|
||||||
|
for (i = 0; i < NSIG; i++)
|
||||||
|
(void) signal(i, sig_catcher);
|
||||||
|
while (1) {
|
||||||
|
sigpause(0L);
|
||||||
|
for (i = 1; i < NSIG; i++)
|
||||||
|
if (caught_sigs & sigmask(i))
|
||||||
|
printf("received signal %d - %s\n",
|
||||||
|
i,
|
||||||
|
(s = signal_name(i)) ? s
|
||||||
|
: "");
|
||||||
|
caught_sigs = 0L;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
usage(verbose)
|
||||||
|
int verbose;
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Usage: %s [-?aw] [-o file]\n", progname);
|
||||||
|
if (verbose)
|
||||||
|
fprintf(stderr, "\
|
||||||
|
-a report on all signals - instead of just non-default signals\n\
|
||||||
|
-o f redirect standard output to file f\n\
|
||||||
|
-w wait forever, reporting all signals sent\n\
|
||||||
|
");
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
RETSIGTYPE
|
||||||
|
sig_catcher(sig)
|
||||||
|
int sig;
|
||||||
|
{
|
||||||
|
caught_sigs |= sigmask(sig);
|
||||||
|
return RETSIGVAL;
|
||||||
|
}
|
||||||
|
#endif /* 0 */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char *
|
||||||
|
signal_name(sig)
|
||||||
|
int sig;
|
||||||
|
{
|
||||||
|
static char buf[1024];
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_SIGLIST
|
||||||
|
# ifndef SYS_SIGLIST_DECLARED
|
||||||
|
extern char *sys_siglist[];
|
||||||
|
# endif
|
||||||
|
/* Use system description, if available... */
|
||||||
|
if (sys_siglist[sig] && sys_siglist[sig][0])
|
||||||
|
return sys_siglist[sig];
|
||||||
|
#endif /* HAVE_SYS_SIGLIST */
|
||||||
|
|
||||||
|
|
||||||
|
if (sig > 0 && sig < sizeof(siginfo) / sizeof(siginfo[0]) - 1) {
|
||||||
|
sprintf(buf, "SIG%s (%s)",
|
||||||
|
siginfo[sig].name, siginfo[sig].mess);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (char *) 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_STRERROR
|
||||||
|
char *
|
||||||
|
strerror(err)
|
||||||
|
int err;
|
||||||
|
{
|
||||||
|
static char buf[64];
|
||||||
|
# ifdef HAVE_SYS_ERRLIST
|
||||||
|
# ifndef SYS_ERRLIST_DECLARED
|
||||||
|
extern int sys_nerr;
|
||||||
|
extern char *sys_errlist[];
|
||||||
|
# endif
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
if (err < 0 || err >= sys_nerr)
|
||||||
|
sprintf(p = buf, "Unknown system error %d", err);
|
||||||
|
else
|
||||||
|
p = sys_errlist[err];
|
||||||
|
return p;
|
||||||
|
# else /* HAVE_SYS_ERRLIST */
|
||||||
|
switch (err) {
|
||||||
|
case EINVAL:
|
||||||
|
return "Invalid argument";
|
||||||
|
case EACCES:
|
||||||
|
return "Permission denied";
|
||||||
|
case ESRCH:
|
||||||
|
return "No such process";
|
||||||
|
case EPERM:
|
||||||
|
return "Not owner";
|
||||||
|
case ENOENT:
|
||||||
|
return "No such file or directory";
|
||||||
|
case ENOTDIR:
|
||||||
|
return "Not a directory";
|
||||||
|
case ENOEXEC:
|
||||||
|
return "Exec format error";
|
||||||
|
case ENOMEM:
|
||||||
|
return "Not enough memory";
|
||||||
|
case E2BIG:
|
||||||
|
return "Argument list too long";
|
||||||
|
default:
|
||||||
|
sprintf(buf, "Unknown system error %d", err);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
# endif /* HAVE_SYS_ERRLIST */
|
||||||
|
}
|
||||||
|
#endif /* !HAVE_STRERROR */
|
360
config.h.in
Normal file
360
config.h.in
Normal file
@ -0,0 +1,360 @@
|
|||||||
|
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||||
|
/*
|
||||||
|
* This file, acconfig.h, which is a part of pdksh (the public domain ksh),
|
||||||
|
* is placed in the public domain. It comes with no licence, warranty
|
||||||
|
* or guarantee of any kind (i.e., at your own risk).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
|
||||||
|
/* Define if on AIX 3.
|
||||||
|
System headers sometimes define this.
|
||||||
|
We just want to avoid a redefinition error message. */
|
||||||
|
#ifndef _ALL_SOURCE
|
||||||
|
#undef _ALL_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if the closedir function returns void instead of int. */
|
||||||
|
#undef CLOSEDIR_VOID
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
#undef const
|
||||||
|
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
#undef gid_t
|
||||||
|
|
||||||
|
/* Define if you have a working `mmap' system call. */
|
||||||
|
#undef HAVE_MMAP
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#undef HAVE_ST_RDEV
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#undef HAVE_SYS_WAIT_H
|
||||||
|
|
||||||
|
/* Define if you have <unistd.h>. */
|
||||||
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
/* Define if on MINIX. */
|
||||||
|
#undef _MINIX
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
#undef mode_t
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
#undef off_t
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
#undef pid_t
|
||||||
|
|
||||||
|
/* Define if the system does not provide POSIX.1 features except
|
||||||
|
with this defined. */
|
||||||
|
#undef _POSIX_1_SOURCE
|
||||||
|
|
||||||
|
/* Define if you need to in order for stat and other things to work. */
|
||||||
|
#undef _POSIX_SOURCE
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#undef RETSIGTYPE
|
||||||
|
|
||||||
|
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
|
||||||
|
#undef STAT_MACROS_BROKEN
|
||||||
|
|
||||||
|
/* Define if `sys_siglist' is declared by <signal.h>. */
|
||||||
|
#undef SYS_SIGLIST_DECLARED
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#undef TIME_WITH_SYS_TIME
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
#undef uid_t
|
||||||
|
|
||||||
|
/* Define if the closedir function returns void instead of int. */
|
||||||
|
#undef VOID_CLOSEDIR
|
||||||
|
|
||||||
|
/* Define if your kernal doesn't handle scripts starting with #! */
|
||||||
|
#undef SHARPBANG
|
||||||
|
|
||||||
|
/* Define if dup2() preserves the close-on-exec flag (ultrix does this) */
|
||||||
|
#undef DUP2_BROKEN
|
||||||
|
|
||||||
|
/* Define as the return value of signal handlers (0 or ). */
|
||||||
|
#undef RETSIGVAL
|
||||||
|
|
||||||
|
/* Define if you have posix signal routines (sigaction(), et. al.) */
|
||||||
|
#undef POSIX_SIGNALS
|
||||||
|
|
||||||
|
/* Define if you have BSD4.2 signal routines (sigsetmask(), et. al.) */
|
||||||
|
#undef BSD42_SIGNALS
|
||||||
|
|
||||||
|
/* Define if you have BSD4.1 signal routines (sigset(), et. al.) */
|
||||||
|
#undef BSD41_SIGNALS
|
||||||
|
|
||||||
|
/* Define if you have v7 signal routines (signal(), signal reset on delivery) */
|
||||||
|
#undef V7_SIGNALS
|
||||||
|
|
||||||
|
/* Define to use the fake posix signal routines (sigact.[ch]) */
|
||||||
|
#undef USE_FAKE_SIGACT
|
||||||
|
|
||||||
|
/* Define if signals don't interrupt read() */
|
||||||
|
#undef SIGNALS_DONT_INTERRUPT
|
||||||
|
|
||||||
|
/* Define if you have bsd versions of the setpgrp() and getpgrp() routines */
|
||||||
|
#undef BSD_PGRP
|
||||||
|
|
||||||
|
/* Define if you have POSIX versions of the setpgid() and getpgrp() routines */
|
||||||
|
#undef POSIX_PGRP
|
||||||
|
|
||||||
|
/* Define if you have sysV versions of the setpgrp() and getpgrp() routines */
|
||||||
|
#undef SYSV_PGRP
|
||||||
|
|
||||||
|
/* Define if you don't have setpgrp(), setpgid() or getpgrp() routines */
|
||||||
|
#undef NO_PGRP
|
||||||
|
|
||||||
|
/* Define to char if your compiler doesn't like the void keyword */
|
||||||
|
#undef void
|
||||||
|
|
||||||
|
/* Define to nothing if compiler doesn't like the volatile keyword */
|
||||||
|
#undef volatile
|
||||||
|
|
||||||
|
/* Define if C compiler groks function prototypes */
|
||||||
|
#undef HAVE_PROTOTYPES
|
||||||
|
|
||||||
|
/* Define if C compiler groks __attribute__((...)) (const, noreturn, format) */
|
||||||
|
#undef HAVE_GCC_FUNC_ATTR
|
||||||
|
|
||||||
|
/* Define to 32-bit signed integer type if <sys/types.h> doesn't define */
|
||||||
|
#undef clock_t
|
||||||
|
|
||||||
|
/* Define to the type of struct rlimit fields if the rlim_t type is missing */
|
||||||
|
#undef rlim_t
|
||||||
|
|
||||||
|
/* Define if time() is declared in <time.h> */
|
||||||
|
#undef TIME_DECLARED
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <signal.h> doesn't define */
|
||||||
|
#undef sigset_t
|
||||||
|
|
||||||
|
/* Define if sys_errlist[] and sys_nerr are in the C library */
|
||||||
|
#undef HAVE_SYS_ERRLIST
|
||||||
|
|
||||||
|
/* Define if sys_errlist[] and sys_nerr are defined in <errno.h> */
|
||||||
|
#undef SYS_ERRLIST_DECLARED
|
||||||
|
|
||||||
|
/* Define if sys_siglist[] is in the C library */
|
||||||
|
#undef HAVE_SYS_SIGLIST
|
||||||
|
|
||||||
|
/* Define if you have a sane <termios.h> header file */
|
||||||
|
#undef HAVE_TERMIOS_H
|
||||||
|
|
||||||
|
/* Define if you have a memset() function in your C library */
|
||||||
|
#undef HAVE_MEMSET
|
||||||
|
|
||||||
|
/* Define if you have a memmove() function in your C library */
|
||||||
|
#undef HAVE_MEMMOVE
|
||||||
|
|
||||||
|
/* Define if you have a bcopy() function in your C library */
|
||||||
|
#undef HAVE_BCOPY
|
||||||
|
|
||||||
|
/* Define if you have a lstat() function in your C library */
|
||||||
|
#undef HAVE_LSTAT
|
||||||
|
|
||||||
|
/* Define if you have a sane <termio.h> header file */
|
||||||
|
#undef HAVE_TERMIO_H
|
||||||
|
|
||||||
|
/* Define if you don't have times() or if it always returns 0 */
|
||||||
|
#undef TIMES_BROKEN
|
||||||
|
|
||||||
|
/* Define if opendir() will open non-directory files */
|
||||||
|
#undef OPENDIR_DOES_NONDIR
|
||||||
|
|
||||||
|
/* Define if the pgrp of setpgrp() can't be the pid of a zombie process */
|
||||||
|
#undef NEED_PGRP_SYNC
|
||||||
|
|
||||||
|
/* Define if you arg running SCO unix */
|
||||||
|
#undef OS_SCO
|
||||||
|
|
||||||
|
/* Define if you arg running ISC unix */
|
||||||
|
#undef OS_ISC
|
||||||
|
|
||||||
|
/* Define if you arg running OS2 with the EMX library */
|
||||||
|
#undef OS2
|
||||||
|
|
||||||
|
/* Define if you have a POSIX.1 compatiable <sys/wait.h> */
|
||||||
|
#undef POSIX_SYS_WAIT
|
||||||
|
|
||||||
|
/* Define if your OS maps references to /dev/fd/n to file descriptor n */
|
||||||
|
#undef HAVE_DEV_FD
|
||||||
|
|
||||||
|
/* Define if your C library's getwd/getcwd function dumps core in unreadable
|
||||||
|
* directories. */
|
||||||
|
#undef HPUX_GETWD_BUG
|
||||||
|
|
||||||
|
/* Default PATH (see comments in configure.in for more details) */
|
||||||
|
#undef DEFAULT_PATH
|
||||||
|
|
||||||
|
/* Include ksh features? (see comments in configure.in for more details) */
|
||||||
|
#undef KSH
|
||||||
|
|
||||||
|
/* Include emacs editing? (see comments in configure.in for more details) */
|
||||||
|
#undef EMACS
|
||||||
|
|
||||||
|
/* Include vi editing? (see comments in configure.in for more details) */
|
||||||
|
#undef VI
|
||||||
|
|
||||||
|
/* Include job control? (see comments in configure.in for more details) */
|
||||||
|
#undef JOBS
|
||||||
|
|
||||||
|
/* Include brace-expansion? (see comments in configure.in for more details) */
|
||||||
|
#undef BRACE_EXPAND
|
||||||
|
|
||||||
|
/* Include any history? (see comments in configure.in for more details) */
|
||||||
|
#undef HISTORY
|
||||||
|
|
||||||
|
/* Include complex history? (see comments in configure.in for more details) */
|
||||||
|
#undef COMPLEX_HISTORY
|
||||||
|
|
||||||
|
/* Strict POSIX behaviour? (see comments in configure.in for more details) */
|
||||||
|
#undef POSIXLY_CORRECT
|
||||||
|
|
||||||
|
/* Specify default $ENV? (see comments in configure.in for more details) */
|
||||||
|
#undef DEFAULT_ENV
|
||||||
|
|
||||||
|
/* Include shl(1) support? (see comments in configure.in for more details) */
|
||||||
|
#undef SWTCH
|
||||||
|
|
||||||
|
/* Include game-of-life? (see comments in configure.in for more details) */
|
||||||
|
#undef SILLY
|
||||||
|
|
||||||
|
/* The number of bytes in a int. */
|
||||||
|
#undef SIZEOF_INT
|
||||||
|
|
||||||
|
/* The number of bytes in a long. */
|
||||||
|
#undef SIZEOF_LONG
|
||||||
|
|
||||||
|
/* Define if you have the _setjmp function. */
|
||||||
|
#undef HAVE__SETJMP
|
||||||
|
|
||||||
|
/* Define if you have the confstr function. */
|
||||||
|
#undef HAVE_CONFSTR
|
||||||
|
|
||||||
|
/* Define if you have the dup2 function. */
|
||||||
|
#undef HAVE_DUP2
|
||||||
|
|
||||||
|
/* Define if you have the flock function. */
|
||||||
|
#undef HAVE_FLOCK
|
||||||
|
|
||||||
|
/* Define if you have the getcwd function. */
|
||||||
|
#undef HAVE_GETCWD
|
||||||
|
|
||||||
|
/* Define if you have the getgroups function. */
|
||||||
|
#undef HAVE_GETGROUPS
|
||||||
|
|
||||||
|
/* Define if you have the getpagesize function. */
|
||||||
|
#undef HAVE_GETPAGESIZE
|
||||||
|
|
||||||
|
/* Define if you have the getrusage function. */
|
||||||
|
#undef HAVE_GETRUSAGE
|
||||||
|
|
||||||
|
/* Define if you have the getwd function. */
|
||||||
|
#undef HAVE_GETWD
|
||||||
|
|
||||||
|
/* Define if you have the killpg function. */
|
||||||
|
#undef HAVE_KILLPG
|
||||||
|
|
||||||
|
/* Define if you have the nice function. */
|
||||||
|
#undef HAVE_NICE
|
||||||
|
|
||||||
|
/* Define if you have the setrlimit function. */
|
||||||
|
#undef HAVE_SETRLIMIT
|
||||||
|
|
||||||
|
/* Define if you have the sigsetjmp function. */
|
||||||
|
#undef HAVE_SIGSETJMP
|
||||||
|
|
||||||
|
/* Define if you have the strcasecmp function. */
|
||||||
|
#undef HAVE_STRCASECMP
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#undef HAVE_STRERROR
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#undef HAVE_STRSTR
|
||||||
|
|
||||||
|
/* Define if you have the sysconf function. */
|
||||||
|
#undef HAVE_SYSCONF
|
||||||
|
|
||||||
|
/* Define if you have the tcsetpgrp function. */
|
||||||
|
#undef HAVE_TCSETPGRP
|
||||||
|
|
||||||
|
/* Define if you have the ulimit function. */
|
||||||
|
#undef HAVE_ULIMIT
|
||||||
|
|
||||||
|
/* Define if you have the valloc function. */
|
||||||
|
#undef HAVE_VALLOC
|
||||||
|
|
||||||
|
/* Define if you have the wait3 function. */
|
||||||
|
#undef HAVE_WAIT3
|
||||||
|
|
||||||
|
/* Define if you have the waitpid function. */
|
||||||
|
#undef HAVE_WAITPID
|
||||||
|
|
||||||
|
/* Define if you have the <dirent.h> header file. */
|
||||||
|
#undef HAVE_DIRENT_H
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#undef HAVE_FCNTL_H
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#undef HAVE_LIMITS_H
|
||||||
|
|
||||||
|
/* Define if you have the <memory.h> header file. */
|
||||||
|
#undef HAVE_MEMORY_H
|
||||||
|
|
||||||
|
/* Define if you have the <ndir.h> header file. */
|
||||||
|
#undef HAVE_NDIR_H
|
||||||
|
|
||||||
|
/* Define if you have the <paths.h> header file. */
|
||||||
|
#undef HAVE_PATHS_H
|
||||||
|
|
||||||
|
/* Define if you have the <stddef.h> header file. */
|
||||||
|
#undef HAVE_STDDEF_H
|
||||||
|
|
||||||
|
/* Define if you have the <stdlib.h> header file. */
|
||||||
|
#undef HAVE_STDLIB_H
|
||||||
|
|
||||||
|
/* Define if you have the <string.h> header file. */
|
||||||
|
#undef HAVE_STRING_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/dir.h> header file. */
|
||||||
|
#undef HAVE_SYS_DIR_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ndir.h> header file. */
|
||||||
|
#undef HAVE_SYS_NDIR_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#undef HAVE_SYS_PARAM_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/resource.h> header file. */
|
||||||
|
#undef HAVE_SYS_RESOURCE_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#undef HAVE_SYS_TIME_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/wait.h> header file. */
|
||||||
|
#undef HAVE_SYS_WAIT_H
|
||||||
|
|
||||||
|
/* Define if you have the <ulimit.h> header file. */
|
||||||
|
#undef HAVE_ULIMIT_H
|
||||||
|
|
||||||
|
/* Define if you have the <values.h> header file. */
|
||||||
|
#undef HAVE_VALUES_H
|
||||||
|
|
||||||
|
/* Need to use a separate file to keep the configure script from commenting
|
||||||
|
* out the undefs....
|
||||||
|
*/
|
||||||
|
#include "conf-end.h"
|
||||||
|
|
||||||
|
#endif /* CONFIG_H */
|
328
configure.in
Normal file
328
configure.in
Normal file
@ -0,0 +1,328 @@
|
|||||||
|
dnl
|
||||||
|
dnl This file, configure.in, which is a part of pdksh (the public domain ksh),
|
||||||
|
dnl is placed in the public domain. It comes with no licence, warranty
|
||||||
|
dnl or guarantee of any kind (i.e., at your own risk).
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl Process this file with autoconf to produce a configure script
|
||||||
|
dnl
|
||||||
|
AC_INIT(c_ksh.c)
|
||||||
|
AC_CONFIG_HEADER(config.h)
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl Set up command line options (--enable/--disable)
|
||||||
|
dnl
|
||||||
|
def_path_unix="/bin:/usr/bin:/usr/ucb"
|
||||||
|
def_path_os2="c:/usr/bin;c:/os2;/os2"
|
||||||
|
AC_ARG_ENABLE(path,
|
||||||
|
[ --enable-path=PaTh (NOTE: this value isn't used if confstr() and _CS_PATH
|
||||||
|
are available, or if <paths.h> defines _PATH_DEFPATH)
|
||||||
|
Use PaTh if PATH isn't specified in the environment
|
||||||
|
when the shell starts. A value without . in it is
|
||||||
|
safest.
|
||||||
|
The default value is \"/bin:/usr/bin:/usr/ucb\".],,
|
||||||
|
enable_path=default)
|
||||||
|
case $enable_path:$ksh_cv_os_type in
|
||||||
|
default:OS2_EMX) enable_path="$def_path_os2" ;;
|
||||||
|
default:*) enable_path="$def_path_unix" ;;
|
||||||
|
esac
|
||||||
|
case $enable_path in
|
||||||
|
\"*\") ;;
|
||||||
|
*)
|
||||||
|
enable_path="\"$enable_path\""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
AC_DEFINE_UNQUOTED(DEFAULT_PATH, $enable_path)
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl Specify what kind of shell we are to build. Options are ksh and sh.
|
||||||
|
dnl This must be before most other options, as it controls their default
|
||||||
|
dnl behaviour.
|
||||||
|
dnl
|
||||||
|
AC_ARG_ENABLE(shell,
|
||||||
|
[ --enable-shell={sh,ksh} Specify the kind of shell that is to be built (the
|
||||||
|
default is ksh). Specifiying sh compiles out:
|
||||||
|
command line editing (emacs/vi), history,
|
||||||
|
a bunch of aliases, [[ .. ]], select, let,
|
||||||
|
brace-expansion, extended globing (*(..|..), etc.),
|
||||||
|
co-processes, some special environment variables
|
||||||
|
(ie, MAIL, MAILCHECK, MAILPATH, RANDOM, SECONDS,
|
||||||
|
TMOUT).],,
|
||||||
|
enable_shell=ksh)
|
||||||
|
case $enable_shell in
|
||||||
|
ksh) AC_DEFINE(KSH) ;;
|
||||||
|
sh) ;;
|
||||||
|
*)
|
||||||
|
AC_MSG_ERROR(bad --enable-shell: must be one of sh or ksh)
|
||||||
|
esac
|
||||||
|
SHELL_PROG=$enable_shell
|
||||||
|
AC_SUBST(SHELL_PROG)
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
AC_ARG_ENABLE(emacs,
|
||||||
|
[ --disable-emacs Compile out emacs command line editing (by default,
|
||||||
|
this is compiled in for ksh, compiled out for sh).])
|
||||||
|
case $enable_emacs:$enable_shell in
|
||||||
|
yes:*|:ksh) enable_emacs=yes; AC_DEFINE(EMACS) ;;
|
||||||
|
no:*|:sh) enable_emacs=no;;
|
||||||
|
*) AC_MSG_ERROR(bad --enable-emacs argument)
|
||||||
|
esac
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
AC_ARG_ENABLE(vi,
|
||||||
|
[ --disable-vi Compile out vi command line editing (by default,
|
||||||
|
this is compiled in for ksh, compiled out for sh).])
|
||||||
|
case $enable_vi:$enable_shell in
|
||||||
|
yes:*|:ksh) enable_vi=yes; AC_DEFINE(VI) ;;
|
||||||
|
no:*|:sh) enable_vi=no;;
|
||||||
|
*) AC_MSG_ERROR(bad --enable-vi argument)
|
||||||
|
esac
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
AC_ARG_ENABLE(jobs,
|
||||||
|
[ --disable-jobs Compile out job control support. If your system
|
||||||
|
doesn't support job control, this will automatically
|
||||||
|
be compiled out.])
|
||||||
|
case $enable_jobs in
|
||||||
|
yes|'') enable_jobs=yes; AC_DEFINE(JOBS) ;;
|
||||||
|
no) enable_jobs=no;;
|
||||||
|
*) AC_MSG_ERROR(bad --enable-jobs argument)
|
||||||
|
esac
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
AC_ARG_ENABLE(brace-expand,
|
||||||
|
[ --disable-brace-expand Compile out brace expansion code (a{b,c} -> ab ac)
|
||||||
|
(by default, this is compiled in for ksh, compiled
|
||||||
|
out for sh). Brace expansion can also be disabled
|
||||||
|
at run time (see set +o braceexpand).])
|
||||||
|
case $enable_brace_expand:$enable_shell in
|
||||||
|
yes:*|:ksh) enable_brace_expand=yes; AC_DEFINE(BRACE_EXPAND) ;;
|
||||||
|
no:*|:sh) enable_brace_expand=no;;
|
||||||
|
*) AC_MSG_ERROR(bad --enable-brace-expand argument)
|
||||||
|
esac
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
AC_ARG_ENABLE(history,
|
||||||
|
[ --enable-history={no,simple,complex} By default, simple history is used for
|
||||||
|
ksh, no history is used for sh. \`simple' means
|
||||||
|
history file is read on start-up, written when shell
|
||||||
|
exists. \`complex' means history files are updated
|
||||||
|
after each command so concurrent shells read each
|
||||||
|
other's commands. Note: \`complex' history doesn't
|
||||||
|
work well across NFS; also, it requires the mmap()
|
||||||
|
and flock() functions - if these aren't available,
|
||||||
|
\`simple' history is automatically used.])
|
||||||
|
case $enable_history:$enable_shell in
|
||||||
|
simple:*|:ksh) enable_history=simple; ;;
|
||||||
|
complex:*) enable_history=complex; AC_DEFINE(COMPLEX_HISTORY) ;;
|
||||||
|
no:*|:sh)
|
||||||
|
case $enable_history:$enable_vi:$enable_emacs in
|
||||||
|
no:yes:*|no:*:yes)
|
||||||
|
AC_MSG_ERROR(can't disable history when vi or emacs is enabled) ;;
|
||||||
|
:yes:*|:*:yes)
|
||||||
|
enable_history=yes;;
|
||||||
|
*)
|
||||||
|
enable_history=no;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*) AC_MSG_ERROR(bad --enable-history argument)
|
||||||
|
esac
|
||||||
|
test X"$enable_history" != Xno && AC_DEFINE(HISTORY)
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
AC_ARG_ENABLE(posixly_correct,
|
||||||
|
[ --enable-posixly-correct Enable if you want POSIX behavior by default
|
||||||
|
(otherwise, posix behavior is only turned on if the
|
||||||
|
environment variable POSIXLY_CORRECT is present or by
|
||||||
|
using \"set -o posix\"; it can be turned off with
|
||||||
|
\"set +o posix\"). See the POSIX Mode section in the
|
||||||
|
man page for details on what this option affects.
|
||||||
|
NOTE: posix mode is not compatable with some bourne
|
||||||
|
sh/at&t ksh scripts.])
|
||||||
|
case $enable_posixly_correct:$enable_shell in
|
||||||
|
yes:*) enable_posixly_correct=yes; AC_DEFINE(POSIXLY_CORRECT) ;;
|
||||||
|
no:*|:*) enable_posixly_correct=no;;
|
||||||
|
*) AC_MSG_ERROR(bad --enable-posixly_correct argument)
|
||||||
|
esac
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
AC_ARG_ENABLE(default-env,
|
||||||
|
[ --enable-default-env=FILE Include FILE if ENV parameter is not set when
|
||||||
|
the shell starts. This can be useful when used with
|
||||||
|
rsh(1), which creates a non-login shell (ie, profile
|
||||||
|
isn't read, so there is no opertunity to set ENV).
|
||||||
|
Setting ENV to null disables the inclusion of
|
||||||
|
DEFAULT_ENV. NOTE: This is a non-standard feature
|
||||||
|
(ie, at&t ksh has no default environment).],,
|
||||||
|
enable_default_env=no)
|
||||||
|
if test X"$enable_default_env" != Xno; then
|
||||||
|
# The [a-zA-Z]:/ is for os2 types...
|
||||||
|
case $enable_default_env in
|
||||||
|
/*|[[a-zA-Z]]:/*)
|
||||||
|
enable_default_env="\"$enable_default_env\""
|
||||||
|
;;
|
||||||
|
\"/*\"|\"[[a-zA-Z]]:/*\")
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
AC_MSG_ERROR(--enable-default-env argument must be an absolute path (was $enable_default_env))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
AC_DEFINE_UNQUOTED(DEFAULT_ENV, $enable_default_env)
|
||||||
|
fi
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl Don't want silly documented - its silly
|
||||||
|
AC_ARG_ENABLE(silly,[ --enable-silly [A silly option]])
|
||||||
|
case $enable_silly:$enable_shell in
|
||||||
|
yes:*) enable_silly=yes; AC_DEFINE(SILLY) ;;
|
||||||
|
no:*|:*) enable_silly=no;;
|
||||||
|
*) AC_MSG_ERROR(bad --enable-silly argument)
|
||||||
|
esac
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl don't want swtch documented - its ancient and probably doesn't work
|
||||||
|
AC_ARG_ENABLE(swtch,
|
||||||
|
[ --enable-swtch For use with shell layers (shl(1)). This has not
|
||||||
|
been tested for some time.])
|
||||||
|
case $enable_swtch:$enable_shell in
|
||||||
|
yes:*) enable_swtch=yes; AC_DEFINE(SWTCH) ;;
|
||||||
|
no:*|:*) enable_swtch=no;;
|
||||||
|
*) AC_MSG_ERROR(bad --enable-swtch argument)
|
||||||
|
esac
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl Start of auto-configuration stuff...
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
AC_PROG_CC
|
||||||
|
AC_PROG_CPP
|
||||||
|
AC_PROG_GCC_TRADITIONAL
|
||||||
|
dnl A hack to turn on warning messages for gcc - Warn-flags is not in
|
||||||
|
dnl the distribution since not everyone wants to see this stuff.
|
||||||
|
dnl (Warn-flags contains: -Wall)
|
||||||
|
if test X"$GCC" = Xyes && test -f $srcdir/Warn-flags; then
|
||||||
|
CFLAGS="${CFLAGS+$CFLAGS }`cat $srcdir/Warn-flags`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl If LDSTATIC set in environment, pass it on to the Makefile and use it when
|
||||||
|
dnl doing compile checks to ensure we are checking the right thing.
|
||||||
|
AC_SUBST(LDSTATIC)LDSTATIC=${LDSTATIC-}
|
||||||
|
test X"$LDSTATIC" != X && LDFLAGS="${LDFLAGS+$LDFLAGS }$LDSTATIC"
|
||||||
|
dnl
|
||||||
|
dnl Executable suffix - normally empty; .exe on os2.
|
||||||
|
AC_SUBST(ac_exe_suffix)dnl
|
||||||
|
|
||||||
|
dnl this incorperates AC_AIX, AC_ISC_POSIX and AC_MINIX tests and does others
|
||||||
|
KSH_OS_TYPE
|
||||||
|
dnl
|
||||||
|
dnl Program name munging stuff (prefix, suffix, transform)
|
||||||
|
AC_ARG_PROGRAM
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl Headers
|
||||||
|
dnl
|
||||||
|
AC_HEADER_DIRENT
|
||||||
|
KSH_UNISTD_H
|
||||||
|
KSH_TERM_CHECK
|
||||||
|
AC_CHECK_HEADERS(stddef.h stdlib.h string.h memory.h fcntl.h limits.h paths.h \
|
||||||
|
sys/param.h sys/resource.h values.h ulimit.h sys/time.h)
|
||||||
|
AC_HEADER_TIME
|
||||||
|
KSH_HEADER_SYS_WAIT
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl Typedefs
|
||||||
|
dnl
|
||||||
|
dnl (don't use AC_TYPE_XXX() 'cause it doesn't check word boundaries)
|
||||||
|
KSH_CHECK_H_TYPE(off_t, for off_t in sys/types.h, , long)
|
||||||
|
KSH_CHECK_H_TYPE(mode_t, for mode_t in sys/types.h, , short)
|
||||||
|
KSH_CHECK_H_TYPE(pid_t, for pid_t in sys/types.h, , int)
|
||||||
|
KSH_CHECK_H_TYPE(uid_t, for uid_t in sys/types.h, , int)
|
||||||
|
if test $ac_cv_type_uid_t = no; then
|
||||||
|
AC_DEFINE(gid_t, int)
|
||||||
|
fi
|
||||||
|
define([AC_PROVIDE_AC_TYPE_UID_T],)
|
||||||
|
AC_TYPE_SIGNAL
|
||||||
|
case $ac_cv_type_signal in
|
||||||
|
int) ksh_cv_signal_retval=0 ;;
|
||||||
|
void) ksh_cv_signal_retval= ;;
|
||||||
|
*)
|
||||||
|
AC_MSG_ERROR(Internal erorr: unknown signal return type: $ac_cv_type_signal)
|
||||||
|
esac
|
||||||
|
AC_DEFINE_UNQUOTED(RETSIGVAL, $ksh_cv_signal_retval)
|
||||||
|
AC_CHECK_SIZEOF(int)
|
||||||
|
AC_CHECK_SIZEOF(long)
|
||||||
|
dnl sh.h sets INT32 to int or long as appropriate. Some burnt systems, such
|
||||||
|
dnl as NeXT's, clock_t is in sys/time.h (in non-posix mode).
|
||||||
|
KSH_CHECK_H_TYPE(clock_t, [[for clock_t in any of <sys/types.h>, <sys/times.h> and <sys/time.h>]],
|
||||||
|
[
|
||||||
|
#ifdef HAVE_SYS_TIME_H
|
||||||
|
#include <sys/time.h>
|
||||||
|
#endif /* HAVE_SYS_TIME_H */
|
||||||
|
#include <sys/times.h>
|
||||||
|
], INT32)
|
||||||
|
KSH_CHECK_H_TYPE(sigset_t, for sigset_t in <sys/types.h> and <signal.h>,
|
||||||
|
[#include <signal.h>], unsigned)
|
||||||
|
KSH_RLIM_CHECK
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl Library functions
|
||||||
|
dnl
|
||||||
|
KSH_MEMMOVE
|
||||||
|
KSH_MEMSET
|
||||||
|
AC_CHECK_FUNCS(confstr dup2 flock getcwd getwd killpg nice \
|
||||||
|
setrlimit strerror strcasecmp strstr sysconf tcsetpgrp \
|
||||||
|
ulimit waitpid wait3)
|
||||||
|
AC_CHECK_FUNCS(sigsetjmp _setjmp, break)
|
||||||
|
AC_FUNC_MMAP
|
||||||
|
KSH_FUNC_LSTAT
|
||||||
|
KSH_SYS_ERRLIST
|
||||||
|
KSH_SYS_SIGLIST
|
||||||
|
KSH_TIME_DECLARED
|
||||||
|
KSH_TIMES_CHECK
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl Structures
|
||||||
|
dnl
|
||||||
|
AC_HEADER_STAT
|
||||||
|
AC_STRUCT_ST_RDEV
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl Compiler characteristics
|
||||||
|
dnl
|
||||||
|
AC_C_CONST
|
||||||
|
KSH_C_VOID
|
||||||
|
KSH_C_VOLATILE
|
||||||
|
KSH_C_PROTOTYPES
|
||||||
|
KSH_C_FUNC_ATTR
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl System services
|
||||||
|
dnl
|
||||||
|
AC_SYS_INTERPRETER
|
||||||
|
if test $ac_cv_sys_interpreter = no;
|
||||||
|
then AC_DEFINE(SHARPBANG)
|
||||||
|
fi
|
||||||
|
AC_PROG_INSTALL
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl Misc ksh tests
|
||||||
|
dnl
|
||||||
|
KSH_DUP2_CLEXEC_CHECK
|
||||||
|
KSH_SIGNAL_CHECK
|
||||||
|
KSH_PGRP_CHECK
|
||||||
|
KSH_PGRP_SYNC
|
||||||
|
KSH_OPENDIR_CHECK
|
||||||
|
KSH_DEV_FD
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl Take replace value of LDSTATIC in LDFLAGS with reference to make variable
|
||||||
|
if test X"$LDSTATIC" != X; then
|
||||||
|
LDFLAGS=`echo -- "$LDFLAGS" | sed -e 's/^-- //' -e 's?$LDSTATIC?\$(LDSTATIC)?'`
|
||||||
|
fi
|
||||||
|
dnl
|
||||||
|
AC_OUTPUT(Makefile)
|
209
etc/ksh.kshrc
Normal file
209
etc/ksh.kshrc
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
:
|
||||||
|
# NAME:
|
||||||
|
# ksh.kshrc - global initialization for ksh
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# Each invocation of /bin/ksh processes the file pointed
|
||||||
|
# to by $ENV (usually $HOME/.kshrc).
|
||||||
|
# This file is intended as a global .kshrc file for the
|
||||||
|
# Korn shell. A user's $HOME/.kshrc file simply requires
|
||||||
|
# the line:
|
||||||
|
# . /etc/ksh.kshrc
|
||||||
|
# at or near the start to pick up the defaults in this
|
||||||
|
# file which can then be overridden as desired.
|
||||||
|
#
|
||||||
|
# SEE ALSO:
|
||||||
|
# $HOME/.kshrc
|
||||||
|
#
|
||||||
|
|
||||||
|
# RCSid:
|
||||||
|
# $Id: ksh.kshrc,v 1.1 2004/03/21 00:34:32 tg Exp $
|
||||||
|
#
|
||||||
|
# @(#)Copyright (c) 1991 Simon J. Gerraty
|
||||||
|
#
|
||||||
|
# This file is provided in the hope that it will
|
||||||
|
# be of use. There is absolutely NO WARRANTY.
|
||||||
|
# Permission to copy, redistribute or otherwise
|
||||||
|
# use this file is hereby granted provided that
|
||||||
|
# the above copyright notice and this notice are
|
||||||
|
# left intact.
|
||||||
|
|
||||||
|
case "$-" in
|
||||||
|
*i*) # we are interactive
|
||||||
|
# we may have su'ed so reset these
|
||||||
|
# NOTE: SCO-UNIX doesn't have whoami,
|
||||||
|
# install whoami.sh
|
||||||
|
USER=`whoami 2>/dev/null`
|
||||||
|
USER=${USER:-`id | sed 's/^[^(]*(\([^)]*\)).*/\1/'`}
|
||||||
|
case $UID in
|
||||||
|
0) PS1S='# ';;
|
||||||
|
esac
|
||||||
|
PS1S=${PS1S:-'$ '}
|
||||||
|
HOSTNAME=${HOSTNAME:-`uname -n`}
|
||||||
|
HOST=${HOSTNAME%%.*}
|
||||||
|
|
||||||
|
PROMPT="$USER:!$PS1S"
|
||||||
|
#PROMPT="<$USER@$HOST:!>$PS1S"
|
||||||
|
PPROMPT='$USER:$PWD:!'"$PS1S"
|
||||||
|
#PPROMPT='<$USER@$HOST:$PWD:!>'"$PS1S"
|
||||||
|
PS1=$PPROMPT
|
||||||
|
# $TTY is the tty we logged in on,
|
||||||
|
# $tty is that which we are in now (might by pty)
|
||||||
|
tty=`tty`
|
||||||
|
tty=`basename $tty`
|
||||||
|
TTY=${TTY:-$tty}
|
||||||
|
|
||||||
|
set -o emacs
|
||||||
|
|
||||||
|
alias ls='ls -CF'
|
||||||
|
alias h='fc -l | more'
|
||||||
|
_cd() { "cd" $*; }
|
||||||
|
# the PD ksh is not 100% compatible
|
||||||
|
case "$KSH_VERSION" in
|
||||||
|
*PD*) # PD ksh
|
||||||
|
case "$TERM" in
|
||||||
|
pc3|xterm*)
|
||||||
|
# bind arrow keys
|
||||||
|
bind '^[['=prefix-2
|
||||||
|
bind '^XA'=up-history
|
||||||
|
bind '^XB'=down-history
|
||||||
|
bind '^XC'=forward-char
|
||||||
|
bind '^XD'=backward-char
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*) # real ksh ?
|
||||||
|
[ -r $HOME/.functions ] && . $HOME/.functions
|
||||||
|
set -o trackall
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
case "$TERM" in
|
||||||
|
sun*)
|
||||||
|
# these are not as neat as their csh equivalents
|
||||||
|
if [ "$tty" != console ]; then
|
||||||
|
# ilabel
|
||||||
|
ILS='\033]L'; ILE='\033\\'
|
||||||
|
# window title bar
|
||||||
|
WLS='\033]l'; WLE='\033\\'
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
xterm*)
|
||||||
|
ILS='\033]1;'; ILE='\007'
|
||||||
|
WLS='\033]2;'; WLE='\007'
|
||||||
|
parent="`ps -ax 2>/dev/null | grep $PPID | grep -v grep`"
|
||||||
|
case "$parent" in
|
||||||
|
*telnet*)
|
||||||
|
export TERM=xterms;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
# do we want window decorations?
|
||||||
|
if [ "$ILS" ]; then
|
||||||
|
ilabel () { print -n "${ILS}$*${ILE}"; }
|
||||||
|
label () { print -n "${WLS}$*${WLE}"; }
|
||||||
|
|
||||||
|
alias stripe='label "$USER@$HOST ($tty) - $PWD"'
|
||||||
|
alias istripe='ilabel "$USER@$HOST ($tty)"'
|
||||||
|
|
||||||
|
wftp () { ilabel "ftp $*"; "ftp" $*; eval istripe; }
|
||||||
|
wcd () { _cd $*; eval stripe; }
|
||||||
|
wtelnet ()
|
||||||
|
{
|
||||||
|
"telnet" "$@"
|
||||||
|
eval istripe
|
||||||
|
eval stripe
|
||||||
|
}
|
||||||
|
wrlogin ()
|
||||||
|
{
|
||||||
|
"rlogin" "$@"
|
||||||
|
eval istripe
|
||||||
|
eval stripe
|
||||||
|
}
|
||||||
|
wsu ()
|
||||||
|
{
|
||||||
|
"su" "$@"
|
||||||
|
eval istripe
|
||||||
|
eval stripe
|
||||||
|
}
|
||||||
|
alias su=wsu
|
||||||
|
alias cd=wcd
|
||||||
|
alias ftp=wftp
|
||||||
|
alias telnet=wtelnet
|
||||||
|
alias rlogin=wrlogin
|
||||||
|
eval stripe
|
||||||
|
eval istripe
|
||||||
|
PS1=$PROMPT
|
||||||
|
fi
|
||||||
|
alias quit=exit
|
||||||
|
alias cls=clear
|
||||||
|
alias logout=exit
|
||||||
|
alias bye=exit
|
||||||
|
alias p='ps -l'
|
||||||
|
alias j=jobs
|
||||||
|
alias o='fg %-'
|
||||||
|
alias ls='ls -gCF'
|
||||||
|
|
||||||
|
# add your favourite aliases here
|
||||||
|
OS=${OS:-`uname -s`}
|
||||||
|
case $OS in
|
||||||
|
HP-UX)
|
||||||
|
alias ls='ls -CF'
|
||||||
|
;;
|
||||||
|
*BSD)
|
||||||
|
alias df='df -k'
|
||||||
|
alias du='du -k'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
alias rsize='eval `/usr/bin/X11/resize`'
|
||||||
|
|
||||||
|
case "$TERM" in
|
||||||
|
sun*|xterm*)
|
||||||
|
case $tty in
|
||||||
|
tty[p-w]*)
|
||||||
|
case "$DISPLAY" in
|
||||||
|
"")
|
||||||
|
DISPLAY="`who | grep $TTY | sed -n 's/.*(\([^:)]*\)[:)].*/\1/p' | sed 's/\([a-zA-Z][^.]*\).*/\1/'`:0"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
case "$DISPLAY" in
|
||||||
|
ozen*|:*)
|
||||||
|
stty erase "^?"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
stty erase "^h"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
export DISPLAY
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
;;
|
||||||
|
*) # non-interactive
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# commands for both interactive and non-interactive shells
|
||||||
|
|
||||||
|
# is $1 missing from $2 (or PATH) ?
|
||||||
|
no_path () {
|
||||||
|
eval _v="\$${2:-PATH}"
|
||||||
|
case :$_v: in
|
||||||
|
*:$1:*) return 1;; # no we have it
|
||||||
|
esac
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
# if $1 exists and is not in path, append it
|
||||||
|
add_path () {
|
||||||
|
[ -d ${1:-.} ] && no_path $* && eval ${2:-PATH}="\$${2:-PATH}:$1"
|
||||||
|
}
|
||||||
|
# if $1 exists and is not in path, prepend it
|
||||||
|
pre_path () {
|
||||||
|
[ -d ${1:-.} ] && no_path $* && eval ${2:-PATH}="$1:\$${2:-PATH}"
|
||||||
|
}
|
||||||
|
# if $1 is in path, remove it
|
||||||
|
del_path () {
|
||||||
|
no_path $* || eval ${2:-PATH}=`eval echo :'$'${2:-PATH}: |
|
||||||
|
sed -e "s;:$1:;:;g" -e "s;^:;;" -e "s;:\$;;"`
|
||||||
|
}
|
310
etc/profile
Normal file
310
etc/profile
Normal file
@ -0,0 +1,310 @@
|
|||||||
|
:
|
||||||
|
# NAME:
|
||||||
|
# profile - global initialization for sh,ksh
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# This file is processed during login by /bin/sh
|
||||||
|
# and /bin/ksh. It is used to setup the default user
|
||||||
|
# environment.
|
||||||
|
#
|
||||||
|
# SEE ALSO:
|
||||||
|
# $HOME/.profile
|
||||||
|
# /etc/ksh.kshrc
|
||||||
|
|
||||||
|
# RCSid:
|
||||||
|
# $Id: profile,v 1.1 2004/03/21 00:34:32 tg Exp $
|
||||||
|
#
|
||||||
|
# @(#)Copyright (c) 1991 Simon J. Gerraty
|
||||||
|
#
|
||||||
|
# This file is provided in the hope that it will
|
||||||
|
# be of use. There is absolutely NO WARRANTY.
|
||||||
|
# Permission to copy, redistribute or otherwise
|
||||||
|
# use this file is hereby granted provided that
|
||||||
|
# the above copyright notice and this notice are
|
||||||
|
# left intact.
|
||||||
|
|
||||||
|
sigs="2 3"
|
||||||
|
trap "" $sigs # don't interrupt us
|
||||||
|
|
||||||
|
# simple versions. See ksh.kshrc for the clever ones
|
||||||
|
add_path () { [ -d $1 ] && eval ${2:-PATH}="\$${2:-PATH}:$1"; }
|
||||||
|
pre_path () { [ -d $1 ] && eval ${2:-PATH}="$1:\$${2:-PATH}"; }
|
||||||
|
del_path () { eval ${2:-PATH}=`eval echo :'$'${2:-PATH}: |
|
||||||
|
sed -e "s;:$1:;:;g" -e "s;^:;;" -e "s;:\$;;"`; }
|
||||||
|
|
||||||
|
case "$_INIT_" in
|
||||||
|
*env*) ;;
|
||||||
|
*) # do these once
|
||||||
|
_INIT_="$_INIT_"env
|
||||||
|
export _INIT_
|
||||||
|
case `echo -n ""` in
|
||||||
|
-n*)
|
||||||
|
N=""; C="\c";;
|
||||||
|
*)
|
||||||
|
N="-n"; C="";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -f /unix ]; then
|
||||||
|
# System V
|
||||||
|
[ -z "$TZ" -a -f /etc/TIMEZONE ] && . /etc/TIMEZONE
|
||||||
|
|
||||||
|
set -- `who -r`
|
||||||
|
case "$3" in
|
||||||
|
S|5|0) SINGLE=y;;
|
||||||
|
*) SINGLE=n;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
SINGLE=n # doesn't matter so much
|
||||||
|
fi
|
||||||
|
|
||||||
|
OS=${OS:-`uname -s`}
|
||||||
|
ARCH=${ARCH:-`uname -m`}
|
||||||
|
HOSTNAME=`hostname 2>/dev/null`
|
||||||
|
HOSTNAME=${HOSTNAME:-`uname -n`}
|
||||||
|
export OS ARCH HOSTNAME
|
||||||
|
|
||||||
|
# pick one of the following for the default umask
|
||||||
|
umask 002 # relaxed -rwxrwxr-x
|
||||||
|
# umask 022 # cautious -rwxr-xr-x
|
||||||
|
# umask 027 # uptight -rwxr-x---
|
||||||
|
# umask 077 # paranoid -rwx------
|
||||||
|
# you can override the default umask
|
||||||
|
# for specific groups later...
|
||||||
|
|
||||||
|
if [ -d /local ]; then
|
||||||
|
LOCAL=/local
|
||||||
|
else
|
||||||
|
LOCAL=/usr/local
|
||||||
|
fi
|
||||||
|
|
||||||
|
# defaults (might be reset below)
|
||||||
|
PATH=/bin:/usr/bin
|
||||||
|
MANPATH=/usr/man
|
||||||
|
SPOOL=/usr/spool
|
||||||
|
defterm=vt220
|
||||||
|
|
||||||
|
# set system specific things,
|
||||||
|
# eg. set PATH,MANPATH
|
||||||
|
# override default ulimit if desired.
|
||||||
|
# defult ulmit is unlimited on SunOS
|
||||||
|
# and 4Mb for most System V
|
||||||
|
case $OS in
|
||||||
|
SunOS)
|
||||||
|
# On sun's /bin -> /usr/bin so leave it out!
|
||||||
|
PATH=/usr/bin:/usr/ucb:/usr/5bin:/usr/etc
|
||||||
|
SPOOL=/var/spool
|
||||||
|
LD_LIBRARY_PATH=/usr/lib
|
||||||
|
add_path /usr/snm/lib LD_LIBRARY_PATH
|
||||||
|
add_path /usr/X11R5/lib LD_LIBRARY_PATH
|
||||||
|
add_path /usr/openwin/lib LD_LIBRARY_PATH
|
||||||
|
export LD_LIBRARY_PATH
|
||||||
|
;;
|
||||||
|
SCO-UNIX)
|
||||||
|
defterm=ansi
|
||||||
|
;;
|
||||||
|
B.O.S.)
|
||||||
|
MANPATH=/usr/catman
|
||||||
|
SRC_COMPAT=_SYSV
|
||||||
|
export SRC_COMPAT
|
||||||
|
;;
|
||||||
|
NetBSD|386bsd)
|
||||||
|
MACHINE_ARCH=`uname -m`
|
||||||
|
MANPATH=/usr/share/man
|
||||||
|
add_path /usr/X386/man MANPATH
|
||||||
|
MAILDIR=/var/mail
|
||||||
|
SPOOL=/var/spool
|
||||||
|
export MACHINE_ARCH
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# add_path only adds them if they exist
|
||||||
|
add_path /sbin
|
||||||
|
add_path /usr/sbin
|
||||||
|
add_path /usr/distbin
|
||||||
|
add_path /usr/ucb
|
||||||
|
add_path /usr/lbin
|
||||||
|
add_path /usr/dbin
|
||||||
|
add_path /usr/ldbin
|
||||||
|
add_path ${LOCAL}/bin
|
||||||
|
add_path /usr/bin/X11
|
||||||
|
add_path /usr/X11R5/bin
|
||||||
|
add_path /usr/openwin/bin
|
||||||
|
# ensure . is at end
|
||||||
|
PATH=$PATH:.
|
||||||
|
|
||||||
|
case "$HOME" in
|
||||||
|
/) ;;
|
||||||
|
""|/tmp)
|
||||||
|
echo "Using /tmp for HOME"
|
||||||
|
HOME=/tmp; export HOME
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
pre_path $HOME/bin
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
add_path /usr/X11R5/man MANPATH
|
||||||
|
add_path ${LOCAL}/man MANPATH
|
||||||
|
|
||||||
|
# make sure these are set at least once
|
||||||
|
LOGNAME=${LOGNAME:-`logname`}
|
||||||
|
USER=${USER:-$LOGNAME}
|
||||||
|
|
||||||
|
# NOTE: set up $GROUPDIR such that users cannot modify/install
|
||||||
|
# their own $GROUPDIR/profile
|
||||||
|
GROUPDIR=`dirname $HOME`
|
||||||
|
[ "$GROUPDIR" != /etc -a -f $GROUPDIR/profile ] && . $GROUPDIR/profile
|
||||||
|
|
||||||
|
export LOCAL TTY PATH LOGNAME USER
|
||||||
|
|
||||||
|
if [ -t 1 ]; then
|
||||||
|
# we are interactive
|
||||||
|
TTY=`tty`
|
||||||
|
TTY=`basename $TTY`
|
||||||
|
if [ -f /etc/organization ]; then
|
||||||
|
ORGANIZATION="`cat /etc/organization`"
|
||||||
|
COPYRIGHT="Copyright (c) `date +19%y` $ORGANIZATION"
|
||||||
|
export ORGANIZATION COPYRIGHT
|
||||||
|
fi
|
||||||
|
# set up some env variables
|
||||||
|
MAIL=${MAILDIR:-$SPOOL/mail}/$USER
|
||||||
|
MAILPATH=$MAIL:/etc/motd
|
||||||
|
EMACSDIR=${LOCAL}/lib/emacs
|
||||||
|
PAGER=${PAGER:-more}
|
||||||
|
export MAIL EMACSDIR MANPATH MAILPATH PAGER
|
||||||
|
|
||||||
|
CVSROOT=${LOCAL}/src/master
|
||||||
|
EDITOR=vi
|
||||||
|
VISUAL=vi
|
||||||
|
FCEDIT=$EDITOR
|
||||||
|
export CVSROOT FCEDIT EDITOR VISUAL
|
||||||
|
case $UID in
|
||||||
|
0) PS1S='# ';;
|
||||||
|
esac
|
||||||
|
PS1S=${PS1S:-'$ '}
|
||||||
|
PROMPT="<$LOGNAME@$HOSTNAME>$PS1S"
|
||||||
|
[ -f /etc/profile.TeX ] && . /etc/profile.TeX
|
||||||
|
else
|
||||||
|
TTY=none
|
||||||
|
fi
|
||||||
|
|
||||||
|
# test (and setup if we are Korn shell)
|
||||||
|
if [ "$RANDOM" != "$RANDOM" ]; then
|
||||||
|
# we are Korn shell
|
||||||
|
SHELL=/bin/ksh
|
||||||
|
ENV=${HOME%/}/.kshrc
|
||||||
|
if [ ! -f $ENV ]; then
|
||||||
|
ENV=/etc/ksh.kshrc
|
||||||
|
fi
|
||||||
|
HISTFILE=${HOME%/}/.ksh_hist
|
||||||
|
PROMPT="<$LOGNAME@$HOSTNAME:!>$PS1S"
|
||||||
|
export HISTSIZE HISTFILE ENV
|
||||||
|
CDPATH=.:$HOME
|
||||||
|
if [ "$TMOUT" ]; then
|
||||||
|
typeset -r TMOUT
|
||||||
|
fi
|
||||||
|
set -o emacs # biased :-)
|
||||||
|
else
|
||||||
|
SHELL=/bin/sh
|
||||||
|
fi
|
||||||
|
PS1=$PROMPT
|
||||||
|
export SHELL PS1 EDITOR PATH PROMPT HOSTNAME CDPATH
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# login time initialization
|
||||||
|
case "$_INIT_" in
|
||||||
|
*log*) ;;
|
||||||
|
*) _INIT_="$_INIT_"log
|
||||||
|
case "$SINGLE" in
|
||||||
|
y) ;;
|
||||||
|
*)
|
||||||
|
if [ TTY != none -a "$0" != "-su" -a "$LOGNAME" = "`logname`" ]
|
||||||
|
then
|
||||||
|
case $TTY in
|
||||||
|
tty0*)
|
||||||
|
echo "`date '+%b %d %H:%M:%S'` $LOGNAME logged in on $TTY" > /dev/console;;
|
||||||
|
esac
|
||||||
|
stty sane # usually a good idea :-)
|
||||||
|
if [ ! -f ~/.hushlogin ]; then
|
||||||
|
# ensure known state
|
||||||
|
case $OS in
|
||||||
|
SunOS|*BSD) ;;
|
||||||
|
*)
|
||||||
|
stty isig icanon intr '^c' erase '^h' kill '^u' eof '^d'
|
||||||
|
mesg y
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $TERM in
|
||||||
|
network|unknown|dialup|"")
|
||||||
|
echo ${N} "Enter terminal type [$defterm]: ${C}" 1>&2
|
||||||
|
read tmpterm
|
||||||
|
TERM=${tmpterm:-$defterm}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
case "$TERM" in
|
||||||
|
pc3|xterm)
|
||||||
|
stty erase ^?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# not all of the following are appropriate at all sites
|
||||||
|
# Sun's don't need to cat /etc/motd for instance
|
||||||
|
case "$OS" in
|
||||||
|
SunOS) ;;
|
||||||
|
SCO-UNIX)
|
||||||
|
[ -s /etc/motd ] && cat /etc/motd
|
||||||
|
[ -x /usr/bin/mail -a -s "$MAIL" ] &&
|
||||||
|
echo "You have mail."
|
||||||
|
[ -x /usr/bin/news ] && /usr/bin/news -n
|
||||||
|
;;
|
||||||
|
NetBSD|386bsd)
|
||||||
|
# hardware flow control works so use it
|
||||||
|
case $TTY in
|
||||||
|
tty0*) # dialups
|
||||||
|
stty -ixon -ixany
|
||||||
|
stty crtscts
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
[ -s /etc/motd ] && cat /etc/motd
|
||||||
|
if [ -x /usr/bin/mailx ]; then
|
||||||
|
if mailx -e; then
|
||||||
|
echo "You have mail."
|
||||||
|
# show the the headers, this might
|
||||||
|
# be better done in .profile so they
|
||||||
|
# can override it.
|
||||||
|
# mailx -H
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
[ -x /usr/bin/news ] && /usr/bin/news -n
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if [ -f $LOCAL/etc/1stlogin.ann ]; then
|
||||||
|
[ -f $HOME/... ] || sh $LOCAL/etc/1stlogin.ann
|
||||||
|
fi
|
||||||
|
# [ -x /usr/games/fortune ] && /usr/games/fortune -a
|
||||||
|
# remind folk who turned on reply.pl to turn it off.
|
||||||
|
if [ -f $HOME/.forward ]; then
|
||||||
|
echo "Your mail is being forwarded to:"
|
||||||
|
cat $HOME/.forward
|
||||||
|
if [ -f $HOME/.recording ]; then
|
||||||
|
echo "Perhaps you should run \"reply.pl off\""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
[ -x /usr/ucb/msgs ] && /usr/ucb/msgs -fq
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
unset tmpterm defterm C N
|
||||||
|
esac
|
||||||
|
case "$TERM" in
|
||||||
|
network|unknown|"") TERM=$defterm;;
|
||||||
|
esac
|
||||||
|
export TERM TTY
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# Handle X-terminals if necessary
|
||||||
|
[ "$SINGLE" = n -a -f /etc/profile.X11 ] && . /etc/profile.X11
|
||||||
|
|
||||||
|
# make sure you have this bit last
|
||||||
|
trap $sigs # restore signals
|
||||||
|
unset sigs
|
64
etc/sys_config.sh
Normal file
64
etc/sys_config.sh
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
:
|
||||||
|
# NAME:
|
||||||
|
# sys_config.sh - set system specific variables
|
||||||
|
#
|
||||||
|
# SYNOPSIS:
|
||||||
|
# . /etc/sys_config.sh
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# Source this script into shell scripts that want to handle
|
||||||
|
# various system types.
|
||||||
|
# You may well want to edit this on a particular system replacing
|
||||||
|
# `uname -s` etc with the result. So that the facility will work
|
||||||
|
# even when in single user mode and uname et al are not available.
|
||||||
|
#
|
||||||
|
# SEE ALSO:
|
||||||
|
# /etc/profile
|
||||||
|
|
||||||
|
# RCSid:
|
||||||
|
# $Id: sys_config.sh,v 1.1 2004/03/21 00:34:32 tg Exp $
|
||||||
|
#
|
||||||
|
# @(#)Copyright (c) 1991 Simon J. Gerraty
|
||||||
|
#
|
||||||
|
# This file is provided in the hope that it will
|
||||||
|
# be of use. There is absolutely NO WARRANTY.
|
||||||
|
# Permission to copy, redistribute or otherwise
|
||||||
|
# use this file is hereby granted provided that
|
||||||
|
# the above copyright notice and this notice are
|
||||||
|
# left intact.
|
||||||
|
#
|
||||||
|
|
||||||
|
# determin machine type
|
||||||
|
if [ -f /386bsd ]; then # doesn't have uname or arch
|
||||||
|
ARCH=i386
|
||||||
|
OS=386bsd
|
||||||
|
HOSTNAME=`hostname`
|
||||||
|
elif [ -f /usr/bin/arch ]; then
|
||||||
|
ARCH=`arch`
|
||||||
|
elif [ -f /usr/bin/uname -o -f /bin/uname ]; then
|
||||||
|
ARCH=`uname -m`
|
||||||
|
fi
|
||||||
|
#
|
||||||
|
case "$ARCH" in
|
||||||
|
sun386) uname=/usr/5bin/uname
|
||||||
|
OS=SunOS
|
||||||
|
;;
|
||||||
|
*) uname=uname;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# set the operating system type
|
||||||
|
# you can't use `uname -s` with SCO UNIX
|
||||||
|
# it returns the same string as `uname -n`
|
||||||
|
# so set it manually
|
||||||
|
# OS=SCO-UNIX
|
||||||
|
# The eval below is a workaround for a bug in the PD ksh.
|
||||||
|
OS=${OS:-`eval $uname -s`}
|
||||||
|
HOSTNAME=${HOSTNAME:-`eval $uname -n`}
|
||||||
|
|
||||||
|
case `echo -n ""` in
|
||||||
|
-n*) _C_=""; _N_="-n";;
|
||||||
|
*) _C_="\c"; _N_="";;
|
||||||
|
esac
|
||||||
|
N="${_N_}"
|
||||||
|
C="${_C_}"
|
||||||
|
export OS ARCH HOSTNAME uname
|
119
install-sh
Normal file
119
install-sh
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# install - install a program, script, or datafile
|
||||||
|
# This comes from X11R5; it is not part of GNU.
|
||||||
|
#
|
||||||
|
# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
|
||||||
|
#
|
||||||
|
# This script is compatible with the BSD install script, but was written
|
||||||
|
# from scratch.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
# set DOITPROG to echo to test this script
|
||||||
|
|
||||||
|
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||||
|
doit="${DOITPROG-}"
|
||||||
|
|
||||||
|
|
||||||
|
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||||
|
|
||||||
|
mvprog="${MVPROG-mv}"
|
||||||
|
cpprog="${CPPROG-cp}"
|
||||||
|
chmodprog="${CHMODPROG-chmod}"
|
||||||
|
chownprog="${CHOWNPROG-chown}"
|
||||||
|
chgrpprog="${CHGRPPROG-chgrp}"
|
||||||
|
stripprog="${STRIPPROG-strip}"
|
||||||
|
rmprog="${RMPROG-rm}"
|
||||||
|
|
||||||
|
instcmd="$mvprog"
|
||||||
|
chmodcmd=""
|
||||||
|
chowncmd=""
|
||||||
|
chgrpcmd=""
|
||||||
|
stripcmd=""
|
||||||
|
rmcmd="$rmprog -f"
|
||||||
|
mvcmd="$mvprog"
|
||||||
|
src=""
|
||||||
|
dst=""
|
||||||
|
|
||||||
|
while [ x"$1" != x ]; do
|
||||||
|
case $1 in
|
||||||
|
-c) instcmd="$cpprog"
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-m) chmodcmd="$chmodprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-o) chowncmd="$chownprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-g) chgrpcmd="$chgrpprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-s) stripcmd="$stripprog"
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
*) if [ x"$src" = x ]
|
||||||
|
then
|
||||||
|
src=$1
|
||||||
|
else
|
||||||
|
dst=$1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ x"$src" = x ]
|
||||||
|
then
|
||||||
|
echo "install: no input file specified"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dst" = x ]
|
||||||
|
then
|
||||||
|
echo "install: no destination specified"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# If destination is a directory, append the input filename; if your system
|
||||||
|
# does not like double slashes in filenames, you may need to add some logic
|
||||||
|
|
||||||
|
if [ -d $dst ]
|
||||||
|
then
|
||||||
|
dst="$dst"/`basename $src`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make a temp file name in the proper directory.
|
||||||
|
|
||||||
|
dstdir=`dirname $dst`
|
||||||
|
dsttmp=$dstdir/#inst.$$#
|
||||||
|
|
||||||
|
# Move or copy the file name to the temp name
|
||||||
|
|
||||||
|
$doit $instcmd $src $dsttmp
|
||||||
|
|
||||||
|
# and set any options; do chmod last to preserve setuid bits
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
|
||||||
|
|
||||||
|
# Now rename the file to the real destination.
|
||||||
|
|
||||||
|
$doit $rmcmd $dst
|
||||||
|
$doit $mvcmd $dsttmp $dst
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
652
misc/Bugs
Normal file
652
misc/Bugs
Normal file
@ -0,0 +1,652 @@
|
|||||||
|
if [ $# != 1 ] ; then
|
||||||
|
echo "Usage: ksh-prog Bugs ksh-prog" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
THIS_KSH=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
echo 'The following tests are known to fail:
|
||||||
|
39'
|
||||||
|
|
||||||
|
tbase=bug-t$$
|
||||||
|
tfile=/tmp/$tbase
|
||||||
|
sfile=/tmp/bug-s$$
|
||||||
|
|
||||||
|
# 1. Everywhere
|
||||||
|
# lex array code has problems....
|
||||||
|
# $ echo blah[
|
||||||
|
# missing ]
|
||||||
|
# $
|
||||||
|
# Different view of same bug:
|
||||||
|
# $ n=blah echo "hi[ $n ]"
|
||||||
|
# hi[ $n ]
|
||||||
|
# $
|
||||||
|
n=blah
|
||||||
|
x=$(echo hi[ $n ]=1)
|
||||||
|
if [ "$x" = 'hi[ $n ]=1' ] ; then
|
||||||
|
echo 'Bug 1 present (echo "hi[ $n ] " prints hi[ $n ]).'
|
||||||
|
fi
|
||||||
|
unset n x
|
||||||
|
|
||||||
|
#
|
||||||
|
# 2. Everywhere
|
||||||
|
# When PATH is set before running a command, the new path is not used
|
||||||
|
# in doing the path search
|
||||||
|
# $ echo echo hi > /tmp/q ; chmod a+rx /tmp/q
|
||||||
|
# $ PATH=/tmp q
|
||||||
|
# q: not found
|
||||||
|
# $
|
||||||
|
# in comexec() the two lines
|
||||||
|
# while (*vp != NULL)
|
||||||
|
# (void) typeset(*vp++, xxx, 0);
|
||||||
|
# need to be moved out of the switch to before findcom() is called - I
|
||||||
|
# don't know what this will break.
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
#!/bin/sh
|
||||||
|
echo hi
|
||||||
|
exit 0
|
||||||
|
EOF
|
||||||
|
chmod a+rx $tfile
|
||||||
|
PATH=/tmp $tbase > /dev/null 2>&1
|
||||||
|
if [ $? != 0 ] ; then
|
||||||
|
echo "Bug 2 present: local assignments to PATH don't effect PATH search"
|
||||||
|
fi
|
||||||
|
rm -f $tfile
|
||||||
|
|
||||||
|
#
|
||||||
|
# 3. Sun OS 4.0.x (This seems to be a problem with sun's PENDIN not being done
|
||||||
|
# properly)
|
||||||
|
# sleep 5^J ls^J ls^J ls [only first ls runs]
|
||||||
|
# vi ... ZZ (while waiting type) [some of the input gets eaten]
|
||||||
|
# [not present in SunOS 4.1.x]
|
||||||
|
echo " [No automatic test for bug 3 - interactive]"
|
||||||
|
|
||||||
|
#
|
||||||
|
# 4. (fixed)
|
||||||
|
#
|
||||||
|
echo " [Don't know what bug 4 was]"
|
||||||
|
|
||||||
|
#
|
||||||
|
# 5. Everywhere
|
||||||
|
# File name completion (^X,*) does not mesh well with cd and
|
||||||
|
# symbolic links. cd does path simplification wrt $PWD before
|
||||||
|
# doing the actual chdir(), while file name completion does
|
||||||
|
# not do the simplification. E.g., you are in directory A
|
||||||
|
# which has a symbolic link to directory B, you create a file
|
||||||
|
# called foobar and you then cd to the symlink to B, and type
|
||||||
|
# $ echo ../foo^X
|
||||||
|
# and the shell beeps at you. Would be more consistent to
|
||||||
|
# do the completion after simplifing the `$PWD/..'.
|
||||||
|
echo " [No automatic test for bug 5 - interactive]"
|
||||||
|
|
||||||
|
#
|
||||||
|
# 6. Everywhere
|
||||||
|
# Parsing of $(..) expressions is non-optimal. It is
|
||||||
|
# impossible to have any parentheses inside the expression.
|
||||||
|
# I.e.,
|
||||||
|
# $ ksh -c 'echo $(echo \( )'
|
||||||
|
# no closing quote
|
||||||
|
# $ ksh -c 'echo $(echo "(" )'
|
||||||
|
# no closing quote
|
||||||
|
# $
|
||||||
|
# The solution is to hack the parsing clode in lex.c, the
|
||||||
|
# question is how to hack it: should any parentheses be
|
||||||
|
# escaped by a backslash, or should recursive parsing be done
|
||||||
|
# (so quotes could also be used to hide hem). The former is
|
||||||
|
# easier, the later better...
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
echo $(echo \()
|
||||||
|
EOF
|
||||||
|
out=`$THIS_KSH $tfile 2>&1`
|
||||||
|
if [ "X$out" != 'X(' ] ; then
|
||||||
|
echo 'Bug 6 present: can'\''t quote ( inside $(..) escapes'
|
||||||
|
fi
|
||||||
|
rm -f $tfile
|
||||||
|
|
||||||
|
#
|
||||||
|
# 7. (fixed)
|
||||||
|
#
|
||||||
|
echo " [Don't know what bug 7 was]"
|
||||||
|
|
||||||
|
#
|
||||||
|
# 8. Everywhere - NOT A BUG - this is what at&t ksh does
|
||||||
|
# Strange typset -x behaviour in functions. The following function
|
||||||
|
# does not set the environment variable BLAH outside the function:
|
||||||
|
# function blah
|
||||||
|
# {
|
||||||
|
# typeset -x BLAH=foobar
|
||||||
|
# }
|
||||||
|
# This function does work:
|
||||||
|
# function blah
|
||||||
|
# { BLAH=foobar; export BLAH
|
||||||
|
# }
|
||||||
|
echo ' [Bug 8 was bogus]'
|
||||||
|
|
||||||
|
#
|
||||||
|
# 9. (fixed) Fix is to make sure Volatile is not defined to nothing
|
||||||
|
# (see defines in sh.h)
|
||||||
|
# Continue in a for loop does not work right:
|
||||||
|
# for i in a b c ; do
|
||||||
|
# if [ $i = b ] ; then
|
||||||
|
# continue
|
||||||
|
# fi
|
||||||
|
# echo $i
|
||||||
|
# done
|
||||||
|
# Prints a forever...
|
||||||
|
first=yes
|
||||||
|
for i in a b c ; do
|
||||||
|
if [ $i = b ] ; then
|
||||||
|
if [ $first = no ] ; then
|
||||||
|
echo 'Bug 9 present: continue in for loop broken'
|
||||||
|
break # hope break isn't broken too :-)
|
||||||
|
fi
|
||||||
|
first=no
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# 10. Everywhere
|
||||||
|
# The following:
|
||||||
|
# set -- `false`
|
||||||
|
# echo $?
|
||||||
|
# shoud not print 0. (according to /bin/sh, at&t ksh, and the
|
||||||
|
# getopt(1) man page - not according to POSIX)
|
||||||
|
set -- `false`
|
||||||
|
if [ $? != 1 ] ; then
|
||||||
|
echo 'Bug 10 present: set exit code overrides exit code of command subst'
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# 11. Some places (sun4s but not mips)
|
||||||
|
# The following:
|
||||||
|
# x=/foo/bar/blah
|
||||||
|
# echo ${x##*/}
|
||||||
|
# should echo blah but on some machines echos /foo/bar/blah.
|
||||||
|
x=/foo/bar/blah
|
||||||
|
if [ ${x##*/} != blah ] ; then
|
||||||
|
echo 'Bug 11 present: ${x##*/} doesn'\''t work'
|
||||||
|
fi
|
||||||
|
unset x
|
||||||
|
|
||||||
|
#
|
||||||
|
# 12. Everywhere:
|
||||||
|
# Both of the following echos produce the same output under sh/ksh.att:
|
||||||
|
# #!/bin/sh
|
||||||
|
# x="foo bar"
|
||||||
|
# echo "`echo \"$x\"`"
|
||||||
|
# echo "`echo "$x"`"
|
||||||
|
# pdksh produces different output for the former (foo instead of foo\tbar)
|
||||||
|
x="foo bar"
|
||||||
|
if [ "X`echo \"$x\"`" != "Xfoo bar" ] ; then
|
||||||
|
echo 'Bug 12 present: quotes inside `` sequences different from sh'
|
||||||
|
fi
|
||||||
|
unset x
|
||||||
|
|
||||||
|
#
|
||||||
|
# 13. Everywhere
|
||||||
|
# The following command hangs forever:
|
||||||
|
# $ (: ; cat /etc/termcap) | sleep 2
|
||||||
|
# This is because the shell forks a shell to run the (..) command
|
||||||
|
# and this shell has the pipe open. When the sleep dies, the cat
|
||||||
|
# doesn't get a SIGPIPE 'cause a process (ie, the second shell)
|
||||||
|
# still has the pipe open.
|
||||||
|
trap 'echo "Bug 13 present: pipes not closed properly"; trap 2' 2
|
||||||
|
echo " [If this hangs for more than a second, hit ^C]"
|
||||||
|
(: ; cat /etc/termcap) | sleep 1
|
||||||
|
trap 2
|
||||||
|
echo " [relax, no bug 13]"
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# 14. Everywhere
|
||||||
|
# The command
|
||||||
|
# $ (foobar) 2> /dev/null
|
||||||
|
# generates no output under /bin/sh, but pdksh produces the error
|
||||||
|
# foobar: not found
|
||||||
|
# Also, the command
|
||||||
|
# $ foobar 2> /dev/null
|
||||||
|
# generates an error under /bin/sh and pdksh, but at&t ksh produces
|
||||||
|
# no error (redirected to /dev/null).
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
(you/should/not/see/this/error/1) 2> /dev/null
|
||||||
|
you/should/not/see/this/error/2 2> /dev/null
|
||||||
|
EOF
|
||||||
|
if $THIS_KSH $tfile 2>&1 | grep you/should > /dev/null; then
|
||||||
|
echo "Bug 14 present: shell 'command not found' error not redirected"
|
||||||
|
fi
|
||||||
|
rm -f $tfile
|
||||||
|
|
||||||
|
#
|
||||||
|
# 15. Everywhere
|
||||||
|
# The command
|
||||||
|
# $ whence foobar
|
||||||
|
# generates a blank line under pdksh and sets the exit status to 0.
|
||||||
|
# at&t ksh generates no output and sets the exit status to 1. Also,
|
||||||
|
# the command
|
||||||
|
# $ whence foobar cat
|
||||||
|
# generates no output under at&t ksh (pdksh generates a blank line
|
||||||
|
# and /bin/cat).
|
||||||
|
echo " [Note that there are three bug 15 tests: 15a, 15b, 15c]"
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
whence does/not/exist > /dev/null
|
||||||
|
echo $?
|
||||||
|
EOF
|
||||||
|
out=`$THIS_KSH $tfile 2> /dev/null`
|
||||||
|
if [ "$out" != 1 ] ; then
|
||||||
|
echo 'Bug 15a present: exit status of whence wrong'
|
||||||
|
fi
|
||||||
|
rm -f $tfile
|
||||||
|
x=$(whence does/not/exist | wc -l)
|
||||||
|
case $x in
|
||||||
|
*0*) ;;
|
||||||
|
*) echo 'Bug 15b present: whence produces blank lines'
|
||||||
|
esac
|
||||||
|
x=$(whence does/not/exist cat | wc -l)
|
||||||
|
case $x in
|
||||||
|
*2*) echo 'Bug 15c present: whence continues after error'
|
||||||
|
esac
|
||||||
|
unset x
|
||||||
|
|
||||||
|
#
|
||||||
|
# 16. Everywhere
|
||||||
|
# ${var%%expr} seems to be broken in many places. On the mips
|
||||||
|
# the commands
|
||||||
|
# $ read line < /etc/passwd
|
||||||
|
# $ echo $line
|
||||||
|
# root:0:1:...
|
||||||
|
# $ echo ${line%%:*}
|
||||||
|
# root
|
||||||
|
# $ echo $line
|
||||||
|
# root
|
||||||
|
# $
|
||||||
|
# change the value of line. On sun4s & pas, the echo ${line%%:*} doesn't
|
||||||
|
# work. Haven't checked elsewhere...
|
||||||
|
read x < /etc/passwd
|
||||||
|
y=$x
|
||||||
|
echo ${x%%:*} > /dev/null
|
||||||
|
if [ "$x" != "$y" ] ; then
|
||||||
|
echo 'Bug 16 present: ${..%%..} trashes variables'
|
||||||
|
fi
|
||||||
|
unset x y
|
||||||
|
|
||||||
|
#
|
||||||
|
# 17. Everywhere
|
||||||
|
# The command
|
||||||
|
# . /foo/bar
|
||||||
|
# should set the exit status to non-zero (sh and at&t ksh do).
|
||||||
|
# XXX doting a non existant file is a fatal error for a script
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
(. does/not/exist)
|
||||||
|
echo $?
|
||||||
|
EOF
|
||||||
|
out=`$THIS_KSH $tfile 2> /dev/null`
|
||||||
|
if [ "$out" != 1 ] ; then
|
||||||
|
echo 'Bug 17 present: exit status of . wrong'
|
||||||
|
fi
|
||||||
|
rm -f $tfile
|
||||||
|
|
||||||
|
#
|
||||||
|
# 18. Everywhere
|
||||||
|
# In vi mode ^X (and *) can dump core:
|
||||||
|
# $ ab[cd^XMemory fault (core dumped)
|
||||||
|
echo " [No automatic test for bug 18 - interactive]"
|
||||||
|
|
||||||
|
#
|
||||||
|
# 19. Everywhere
|
||||||
|
# Both of the following echos should produce the same thing, but don't:
|
||||||
|
# $ x=foo/bar
|
||||||
|
# $ echo ${x%/*}
|
||||||
|
# foo
|
||||||
|
# $ echo "${x%/*}"
|
||||||
|
# foo/bar
|
||||||
|
x=foo/bar
|
||||||
|
if [ "${x%/*}" != foo ] ; then
|
||||||
|
echo 'Bug 19 present: ${..%..} in double quotes broken'
|
||||||
|
fi
|
||||||
|
unset x
|
||||||
|
|
||||||
|
#
|
||||||
|
# 20. (same as 18)
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# 21. Everywhere
|
||||||
|
# backslash does not work as expected in case labels:
|
||||||
|
# $ x='-x'
|
||||||
|
# $ case $x in
|
||||||
|
# -\?) echo hi
|
||||||
|
# esac
|
||||||
|
# hi
|
||||||
|
# $ x='-?'
|
||||||
|
# $ case $x in
|
||||||
|
# -\\?) echo hi
|
||||||
|
# esac
|
||||||
|
# hi
|
||||||
|
# $
|
||||||
|
case -x in
|
||||||
|
-\?) echo 'Bug 21 present: backslashes do not work in case patterns'
|
||||||
|
esac
|
||||||
|
|
||||||
|
#
|
||||||
|
# 22. Quoting backquotes inside backquotes doesn't work:
|
||||||
|
# $ echo `echo hi \`echo there\` folks`
|
||||||
|
# asks for more info. sh and at&t ksh both echo
|
||||||
|
# hi there folks
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
echo `echo hi \`echo there\` folks`
|
||||||
|
EOF
|
||||||
|
out=`$THIS_KSH $tfile 2>&1`
|
||||||
|
if [ "$out" != 'hi there folks' ] ; then
|
||||||
|
echo 'Bug 22 present: quoting backquotes inside backquotes broken'
|
||||||
|
fi
|
||||||
|
rm -f $tfile
|
||||||
|
|
||||||
|
#
|
||||||
|
# 23. )) is not treated `correctly':
|
||||||
|
# $ (echo hi ; (echo there ; echo folks))
|
||||||
|
# missing ((
|
||||||
|
# $
|
||||||
|
# instead of (as sh and ksh.att)
|
||||||
|
# $ (echo hi ; (echo there ; echo folks))
|
||||||
|
# hi
|
||||||
|
# there
|
||||||
|
# folks
|
||||||
|
# $
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
( : ; ( : ; echo hi))
|
||||||
|
EOF
|
||||||
|
out=`$THIS_KSH $tfile 2>&1`
|
||||||
|
if [ "$out" != 'hi' ] ; then
|
||||||
|
echo 'Bug 23 present: )) always assumed to be end of (( )) expr'
|
||||||
|
fi
|
||||||
|
rm -f $tfile
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# 24. strangeness with file name completion involving symlinks to nowhere
|
||||||
|
# $ mkdir foo foo/bar
|
||||||
|
# $ ln -s /stuff/junk foo/bar/xx
|
||||||
|
# $ echo foo/*/xx
|
||||||
|
# (beep)
|
||||||
|
# $
|
||||||
|
echo " [No automatic test for bug 24 - interactive]"
|
||||||
|
|
||||||
|
#
|
||||||
|
# 25. Check reading stdin in a while loop. The read should only read
|
||||||
|
# a single line, not a whole stdio buffer; the cat should get
|
||||||
|
# the rest.
|
||||||
|
#
|
||||||
|
(echo a; echo b) | while read x ; do
|
||||||
|
[ "$x" = b ] && echo 'Bug 25 present (read reads too much from pipe).'
|
||||||
|
cat > /dev/null
|
||||||
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# 26a. Check reading stdin in a while loop. The read should read both
|
||||||
|
# lines, not just the first.
|
||||||
|
#
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
a
|
||||||
|
b
|
||||||
|
EOF
|
||||||
|
cat > $sfile << 'EOF'
|
||||||
|
a=
|
||||||
|
while [ "$a" != xxx ] ; do
|
||||||
|
last=$x
|
||||||
|
read x
|
||||||
|
cat /dev/null | sed 's/x/y/'
|
||||||
|
a=x$a
|
||||||
|
done
|
||||||
|
if [ "$last" != b ] ; then
|
||||||
|
echo 'Bug 26 present (reading in a while loop broken).'
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
$THIS_KSH $sfile < $tfile
|
||||||
|
rm -f $tfile $sfile
|
||||||
|
|
||||||
|
#
|
||||||
|
# 26b Check reading stdin in a while loop. The read should read both
|
||||||
|
# lines, not just the first. This differs from 26 in that lines
|
||||||
|
# are placed against the margin.
|
||||||
|
#
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
ab
|
||||||
|
cd
|
||||||
|
EOF
|
||||||
|
cat > $sfile << 'EOF'
|
||||||
|
a=
|
||||||
|
while [ "$a" != xxx ] ; do
|
||||||
|
last=$x
|
||||||
|
read x
|
||||||
|
cat /dev/null | sed 's/x/y/'
|
||||||
|
a=x$a
|
||||||
|
done
|
||||||
|
if [ "$last" != cd ] ; then
|
||||||
|
echo "Bug 26b present (last line should be cd was $last.)"
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
$THIS_KSH $sfile < $tfile
|
||||||
|
rm -f $tfile $sfile
|
||||||
|
|
||||||
|
#
|
||||||
|
# 27. Everywhere
|
||||||
|
# The command
|
||||||
|
# . /does/not/exist
|
||||||
|
# should cause a script to exit.
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
. does/not/exist
|
||||||
|
echo hi
|
||||||
|
EOF
|
||||||
|
out=`$THIS_KSH $tfile 2> /dev/null`
|
||||||
|
if [ "$out" = hi ] ; then
|
||||||
|
echo "Bug 27 present: .'ing a non-existant file doesn't kill script"
|
||||||
|
fi
|
||||||
|
rm -f $tfile
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# 28. Everywhere
|
||||||
|
# variable assignements not detected well
|
||||||
|
#
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
a.x=1 echo hi
|
||||||
|
EOF
|
||||||
|
out=`$THIS_KSH $tfile 2> /dev/null`
|
||||||
|
if [ "$out" = hi ] ; then
|
||||||
|
echo "Bug 28 present: strange chars allowed in variables"
|
||||||
|
fi
|
||||||
|
rm -f $tfile
|
||||||
|
|
||||||
|
#
|
||||||
|
# 29. Everywhere
|
||||||
|
# alias expansion different from real ksh
|
||||||
|
#
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
alias a='for ' b='i in'
|
||||||
|
a b hi ; do echo $i ; done
|
||||||
|
EOF
|
||||||
|
out=`$THIS_KSH $tfile 2> /dev/null`
|
||||||
|
if [ "$out" != hi ] ; then
|
||||||
|
echo "Bug 29 present: keyword in alias with trailing space doesn't work"
|
||||||
|
fi
|
||||||
|
rm -f $tfile
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# 30. Everywhere
|
||||||
|
# strange characters allowed inside ${...}
|
||||||
|
#
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
echo ${a{b}}
|
||||||
|
EOF
|
||||||
|
out=`$THIS_KSH $tfile 2> /dev/null`
|
||||||
|
if [ $? = 0 ] ; then
|
||||||
|
echo 'Bug 30 present: strange chars allowed inside ${..}'
|
||||||
|
fi
|
||||||
|
rm -f $tfile
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# 31. Everywhere
|
||||||
|
# Does read handle partial lines correctly
|
||||||
|
#
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
a A Aa
|
||||||
|
b B Bb
|
||||||
|
EOF
|
||||||
|
print -n 'c' >> $tfile
|
||||||
|
cat > $sfile << 'EOF'
|
||||||
|
a=
|
||||||
|
ret=
|
||||||
|
while [ "$a" != xxx ] ; do
|
||||||
|
read x y z
|
||||||
|
ret=$?
|
||||||
|
a=x$a
|
||||||
|
done
|
||||||
|
if [ "$x" != c ] ; then
|
||||||
|
echo 'Bug 31a present: read throws away partial lines'
|
||||||
|
fi
|
||||||
|
if [ "$ret" != 1 ] ; then
|
||||||
|
echo 'Bug 31b present: read does not return eof for partial lines'
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
$THIS_KSH $sfile < $tfile 2> /dev/null
|
||||||
|
rm -f $sfile $tfile
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# 32. Everywhere
|
||||||
|
# Does read set variables to null at eof?
|
||||||
|
#
|
||||||
|
cat > $tfile << 'EOF'
|
||||||
|
a A Aa
|
||||||
|
b B Bb
|
||||||
|
EOF
|
||||||
|
cat > $sfile << 'EOF'
|
||||||
|
a=
|
||||||
|
while [ "$a" != xxx ] ; do
|
||||||
|
read x y z
|
||||||
|
a=x$a
|
||||||
|
done
|
||||||
|
if [ -n "$x$y$z" ] ; then
|
||||||
|
echo "Bug 32 present: read does not set variables to null at eof"
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
$THIS_KSH $sfile < $tfile
|
||||||
|
rm -f $sfile $tfile
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# 33. Everywhere
|
||||||
|
# Does umask print a leading 0 when umask is 3 digits?
|
||||||
|
#
|
||||||
|
cat > $sfile << 'EOF'
|
||||||
|
umask 222
|
||||||
|
umask
|
||||||
|
EOF
|
||||||
|
out=`$THIS_KSH $sfile`
|
||||||
|
if [ X"$out" = X222 ] ; then
|
||||||
|
echo "Bug 33 present: umask doesn't always start with 0"
|
||||||
|
fi
|
||||||
|
rm -f $sfile
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# 34. Everywhere
|
||||||
|
# Does umask print a umask of 0 sanely?
|
||||||
|
#
|
||||||
|
cat > $sfile << 'EOF'
|
||||||
|
umask 0
|
||||||
|
umask
|
||||||
|
EOF
|
||||||
|
out=`$THIS_KSH $sfile`
|
||||||
|
if [ X"$out" = X00 ] ; then
|
||||||
|
echo "Bug 34 present: umask prints 0 as \`$out'"
|
||||||
|
fi
|
||||||
|
rm -f $sfile
|
||||||
|
|
||||||
|
#
|
||||||
|
# 35. Everywhere
|
||||||
|
# Tempory files used for here-docs in functions get trashed after
|
||||||
|
# the function is parsed (before it is executed)
|
||||||
|
#
|
||||||
|
cat > $sfile << 'EOF'
|
||||||
|
f1() {
|
||||||
|
cat <<- EOF
|
||||||
|
F1
|
||||||
|
EOF
|
||||||
|
f2() {
|
||||||
|
cat <<- EOF
|
||||||
|
F2
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
}
|
||||||
|
f1
|
||||||
|
f2
|
||||||
|
unset -f f1
|
||||||
|
f2
|
||||||
|
EOF
|
||||||
|
out=`$THIS_KSH $sfile 2>&1`
|
||||||
|
expected='F1
|
||||||
|
F2
|
||||||
|
F2'
|
||||||
|
if [ X"$out" != X"$expected" ] ; then
|
||||||
|
echo "Bug 35 present: here documents in functions don't work"
|
||||||
|
fi
|
||||||
|
rm -f $sfile
|
||||||
|
|
||||||
|
#
|
||||||
|
# 36. Everywhere (test from <sjg@void.zen.oz.au>)
|
||||||
|
# Command substitution breaks reading in while loop
|
||||||
|
#
|
||||||
|
cat > $sfile << 'EOF'
|
||||||
|
(echo abcdef; echo; echo 123) |
|
||||||
|
while read line
|
||||||
|
do
|
||||||
|
# the following line breaks it
|
||||||
|
c=`echo $line | wc -c`
|
||||||
|
echo $c
|
||||||
|
done
|
||||||
|
|
||||||
|
EOF
|
||||||
|
out=`$THIS_KSH $sfile 2>&1`
|
||||||
|
expect='7
|
||||||
|
1
|
||||||
|
4'
|
||||||
|
if [ X"$out" != X"$expect" ] ; then
|
||||||
|
echo "Bug 36 present: reading broken by command substitution in while loops"
|
||||||
|
fi
|
||||||
|
rm -f $sfile
|
||||||
|
|
||||||
|
#
|
||||||
|
# 37. Machines with broken times() (reported by <sjg@void.zen.oz.au>)
|
||||||
|
# time does not report correct real time
|
||||||
|
#
|
||||||
|
out=`$THIS_KSH -c 'time sleep 1' 2>&1 | awk '
|
||||||
|
/^[ ]*0*\.0*s?[ ][ ]*real/ { print "bad" }
|
||||||
|
/^[ ]*real[ ][ ]*0*\.0*s?([ ]|$)/ { print "bad" }'`
|
||||||
|
if [ -n "$out" ] ; then
|
||||||
|
echo "Bug 37 present: time does not report real-time correctly"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# 38. set -e doesn't ignore exit codes for if/while/until/&&/||/!.
|
||||||
|
#
|
||||||
|
out=`$THIS_KSH -e -c '
|
||||||
|
if false; then echo hi ; fi
|
||||||
|
false || true
|
||||||
|
false && true
|
||||||
|
while false; do echo hi; done
|
||||||
|
echo ok' 2>&1`
|
||||||
|
if [ X"$out" != Xok ] ; then
|
||||||
|
echo "Bug 38 present: set -e exits when it shouldn't"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# 39. set -e: errors in command substitutions aren't ignored
|
||||||
|
#
|
||||||
|
out=`$THIS_KSH -e -c 'if test X\`false; echo hi\` = Xhi; then echo ok ; fi' 2>&1`
|
||||||
|
if [ X"$out" != Xok ] ; then
|
||||||
|
echo "Bug 39 present: set -e: errors in command substitutions not ignored"
|
||||||
|
fi
|
49
misc/ChangeLog.sjg
Normal file
49
misc/ChangeLog.sjg
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
Fri Dec 3 21:39:47 1993 Piercarlo Grandi (pcg@aber.ac.uk)
|
||||||
|
|
||||||
|
* polished 4.9 for linux; corrected a terrible, linux
|
||||||
|
specific performance bug that caused all streams to
|
||||||
|
become unbuffered; made emacs.c more understandable.
|
||||||
|
With 4.9 pdksh is twice as fast and one third the size
|
||||||
|
of bash 1.13, and has most of the relevant functionality.
|
||||||
|
To me it is a drop-in replacement.
|
||||||
|
|
||||||
|
Sat May 8 15:55:24 1993 Simon J. Gerraty (sjg@zen.void.oz.au)
|
||||||
|
|
||||||
|
* Ported to 386bsd - sh directory only, stc/* not needed.
|
||||||
|
|
||||||
|
Sat Aug 1 17:11:24 1992 Simon J. Gerraty (sjg@zen)
|
||||||
|
|
||||||
|
* Incorporated massive contribution from Peter Collinson
|
||||||
|
Refer to Changes.pc
|
||||||
|
|
||||||
|
* Incorporated Emacs-style completion provided by
|
||||||
|
Neil.Smithline@eng.sun.com this a bit nicer than the standard ksh
|
||||||
|
file completion.
|
||||||
|
|
||||||
|
Sun May 3 17:50:03 1992 Simon J. Gerraty (sjg@zen)
|
||||||
|
|
||||||
|
* Updated MACHINES.
|
||||||
|
* Placed source under CVS. This should help with processing fixes
|
||||||
|
from the field.
|
||||||
|
|
||||||
|
Sat Apr 25 10:53:20 1992 Simon J. Gerraty (sjg@zen)
|
||||||
|
|
||||||
|
* Getting ready for 4.3 release.
|
||||||
|
|
||||||
|
Fri Nov 22 22:24:29 1991 Simon J. Gerraty (sjg at zen)
|
||||||
|
|
||||||
|
* Cleaned up the build process slightly. Makefiles in ./std tree
|
||||||
|
now maintain objects within the libraries rather than simply
|
||||||
|
building the .o's and archiving them. Of course the make(1) used
|
||||||
|
must know how to maintain libraries :-)
|
||||||
|
|
||||||
|
* Added bug.report as a template for bug reporting.
|
||||||
|
|
||||||
|
* Source in ./sh can be built independently of ./std tree if
|
||||||
|
desired. See comments in ./sh/Makefile.
|
||||||
|
|
||||||
|
* As originally distributed some of libstdc.a was not used and
|
||||||
|
libposix.a was not used at all. On Sun's this highlighted a bug
|
||||||
|
(incompatibility) in the times() call. Now the ./std/libs are
|
||||||
|
used fully, and the supplied times() call functions as expected.
|
||||||
|
|
61
misc/Changes.jrm
Normal file
61
misc/Changes.jrm
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
Changes to the PD ksh since last time:
|
||||||
|
|
||||||
|
- clean up the option configuration stuff. Options in config.h should
|
||||||
|
now just be #define'd or not, not #define'd to 1 if you want them
|
||||||
|
and 0 if you don't
|
||||||
|
|
||||||
|
- ksh now uses the shell specified by the variable EXECSHELL to run
|
||||||
|
shell scripts. If EXECSHELL is unset or null it defaults to
|
||||||
|
/bin/sh. It does a path lookup on the value, so if you set it to
|
||||||
|
``ksh'' the ksh will run all scripts that don't start with #!. It
|
||||||
|
seems to run most sh scripts fine (now). I'd be very interested to
|
||||||
|
hear your experiences if you try this out, as for my next trick I'd
|
||||||
|
like to make ksh just fork itself to run scripts, which would speed
|
||||||
|
things up, and allow exportable functions and aliases (like he real
|
||||||
|
ksh). Just to assure you that it can do some hairy sh scripts, both
|
||||||
|
CC and coco work with ksh.
|
||||||
|
|
||||||
|
EXECSHELL won't work if the system's exec(2) call runs scripts...
|
||||||
|
|
||||||
|
- the ``let'' builtin now evaluates null or unset vars to 0, as per
|
||||||
|
The Book
|
||||||
|
|
||||||
|
- Various memory allocation/use problems were cleaned up. Hopefully
|
||||||
|
you'll never see the ``freeing free object'' error again (if you've
|
||||||
|
ever seen it).
|
||||||
|
|
||||||
|
- the ``test'' builtin is now much more tolerant in parsing its
|
||||||
|
arguments. This was to make it like the /bin/sh test.
|
||||||
|
|
||||||
|
- Temp files (for here documents or ``fc'') are now mode 0600
|
||||||
|
|
||||||
|
- Some format strings in the tree printing routines got ``expanded''
|
||||||
|
into SCCS keywords, so the results of``type <function>'' were
|
||||||
|
gave you interesting things like the time I last checked in the
|
||||||
|
file. This has been fixed.
|
||||||
|
|
||||||
|
- ``unset -f'' now really does unset functions.
|
||||||
|
|
||||||
|
- the ``trailing blank or tab in alias definition'' feature now works.
|
||||||
|
|
||||||
|
- A bug in command completion was fixed. Note command completion only
|
||||||
|
works on commands that have been hashed, so you want to ``set -h''
|
||||||
|
in your .kshrc, and you may wish to force hashing of some common
|
||||||
|
commands with the ``hash'' builtin.
|
||||||
|
|
||||||
|
- ``echo $$ | cat'' now works as in /bin/sh
|
||||||
|
|
||||||
|
Not new features, but newly discovered bugs:
|
||||||
|
|
||||||
|
- Local functions don't work correctly. This shouldn't be much
|
||||||
|
problem, since sh doesn't have them.
|
||||||
|
|
||||||
|
- Here documents in functions don't work. This is a problem with the
|
||||||
|
temp file allocation that requires more work to fix than I've gotten
|
||||||
|
around to doing. So avoid things like:
|
||||||
|
|
||||||
|
foo() {
|
||||||
|
cat <<- HereDoc
|
||||||
|
This is a test
|
||||||
|
HereDoc
|
||||||
|
}
|
44
misc/Changes.mlj
Normal file
44
misc/Changes.mlj
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
I got the pd-ksh from John MacMillan after he indicated that he
|
||||||
|
had a version of it that had vi editing (I'd seen various versions
|
||||||
|
with emacs-editing, but none with vi).
|
||||||
|
|
||||||
|
It had a few bugs and areas which were not quite complete. I fixed
|
||||||
|
(or at least tried) to fix several; there are still some things
|
||||||
|
which I plan on doing (or at least looking into).
|
||||||
|
|
||||||
|
Bugs fixed (or at least abated):
|
||||||
|
|
||||||
|
vi-mode changes:
|
||||||
|
- Changed memcpy() to memmove(), which fixed the trashing of
|
||||||
|
the end of the edit buffer while inserting in the middle
|
||||||
|
of a line or with use of '#'
|
||||||
|
- using 'r' replacing the current character with ^@
|
||||||
|
- typing ctrl-c resulting in next command being garbled
|
||||||
|
- lack of support for '-' and '+' (pretty trivial)
|
||||||
|
- finish adding support for '*' (not entirely sure I'm freeing
|
||||||
|
malloc'ed memory correctly here, but I haven't had any problems)
|
||||||
|
- treats '_' as end of a word
|
||||||
|
|
||||||
|
general changes:
|
||||||
|
- reporting "not found" when a file actually doesn't have
|
||||||
|
the appropriate execute bit set (now says "cannot execute"
|
||||||
|
or "not found", as appropriate)
|
||||||
|
|
||||||
|
|
||||||
|
Still to do:
|
||||||
|
|
||||||
|
vi changes:
|
||||||
|
- fix ctrl-r (I've come up with a hack, but it involves
|
||||||
|
redrawing the screen a lot when it isn't necessary; I
|
||||||
|
really wouldn't consider this a fix)
|
||||||
|
- add support for 'v'
|
||||||
|
|
||||||
|
general changes:
|
||||||
|
- seems to be a memory leak when executing shells in the
|
||||||
|
current shell; repeatedly executing ". /etc/profile"
|
||||||
|
increased the size of the program as reported in the
|
||||||
|
"SZ" field of "ps -l"
|
||||||
|
- don't give a file its complete pathname in argv[0]; only
|
||||||
|
its filename (religious issue?)
|
||||||
|
- history recall should start at the previous command, not
|
||||||
|
the current one (typing "r r" causes an infinite loop)
|
28
misc/Changes.pc
Normal file
28
misc/Changes.pc
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
Changes by Peter Collinson - Hillside Systems/BSDI - July 1992
|
||||||
|
|
||||||
|
|
||||||
|
a) Add select command - this cannot be ksh without that.
|
||||||
|
(It NEEDS typedefs too)
|
||||||
|
b) Remove all the bcopys from vi.c
|
||||||
|
add
|
||||||
|
#define memmove in sh.h for BSD systems
|
||||||
|
c) Add <Esc>* command to vi mode - expands to a list of files
|
||||||
|
using the menu printing routine
|
||||||
|
d) Add my version of history, that works much like the `proper' ksh
|
||||||
|
storing data in a file that is shared between different invocations
|
||||||
|
of the shell.
|
||||||
|
e) Add the ability to redirect to am expansion... ie
|
||||||
|
|
||||||
|
ls > o*
|
||||||
|
if o* is unique then it puts it into the file that matches
|
||||||
|
otherwise it puts it to a file called o*... this is current
|
||||||
|
behaviour.
|
||||||
|
f) Add alternations, from Csh.d) This is not part of ksh but is something
|
||||||
|
that csh users really miss from the Bourne shell derivatives. The idea
|
||||||
|
is that lists inside curly braces expand to arguments. ie.
|
||||||
|
exampl{a,b,c,d,e}
|
||||||
|
will expand to 5 arguments
|
||||||
|
exampla examplb examplc exampld example
|
||||||
|
Recursive lists are permitted.
|
||||||
|
g) Add suspend as a built-in alias.
|
||||||
|
h) Port to BSD/386 - add _POSIX_TERM and _BSDI as defines.
|
118
misc/README.sjg
Normal file
118
misc/README.sjg
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
Public Domain Korn Shell
|
||||||
|
Version 4.9
|
||||||
|
|
||||||
|
PD KSH:
|
||||||
|
|
||||||
|
This is the latest version of the PD ksh (pdksh). It is not intended
|
||||||
|
to be the ultimate shell but rather a usable ksh work alike. For
|
||||||
|
those of us who have to work on multiple systems it is nice to have
|
||||||
|
the same user interface on all. I resisted moving to the ksh on a
|
||||||
|
System V machine where I worked, for nearly a year due to the lack of
|
||||||
|
a ksh on my Sun systems. When I first picked up the 3.2 PD KSH a
|
||||||
|
couple of years ago, it took only a few minutes to convert a C-shell
|
||||||
|
fan to a ksh fan :-) Pdksh is not 100% compatible with the ksh.
|
||||||
|
Having said that, I use it daily beside a real ksh88 and find them
|
||||||
|
virtually indistinguishable. With one exception - arrays! If some
|
||||||
|
one feels like adding arrays, I for one would appreciate it :-)
|
||||||
|
|
||||||
|
I only run this shell on sun's and BSD systems and only for
|
||||||
|
interactive use. I use it on sun4c, sun3, sun386 and 386bsd systems.
|
||||||
|
The shell itself has been compiled on the sun's both with and without
|
||||||
|
the POSIX/ANSI compatability libraries in ./std. I do not use ./std
|
||||||
|
for 386bsd and friends. See the file MACHINES for details of systems
|
||||||
|
that the shell has been built on.
|
||||||
|
|
||||||
|
I released version 4.0 of the shell (with the kind permission of
|
||||||
|
the previous maintainers and major contributors) to ensure that
|
||||||
|
it is available from usenet archive sites. Of course it remains
|
||||||
|
in the Public Domain. Equally obviously neither myself nor any
|
||||||
|
other contributors make any claims of suitability etc. Ie. NO
|
||||||
|
WARRANTY!!! If you make any changes and distribute them, please
|
||||||
|
leave your own finger prints in the source. Its bad enough
|
||||||
|
being flamed for my own bugs let alone anyone elses :-)
|
||||||
|
|
||||||
|
|
||||||
|
HISTORY:
|
||||||
|
|
||||||
|
This shell was written by Eric Gisin. It is based on Charles
|
||||||
|
Forsyth's public domain V7 shell, which he later contributed to
|
||||||
|
Minix. John R MacMillan picked up Eric Gisin's version after
|
||||||
|
Eric moved on to other projects (see ReadMe.jrm).
|
||||||
|
|
||||||
|
Since then there have been many contributors to this shell.
|
||||||
|
Most have left their fingerprints within the source and various
|
||||||
|
ReadMe.xxx and Changes.xxx files reflect their input.
|
||||||
|
|
||||||
|
This version is basically that known as Eric Gisin's version 3.3
|
||||||
|
alpha which I obtained indirectly from John R MacMillan who is
|
||||||
|
the most recent maintainer. This version has much improved
|
||||||
|
emacs-mode command line editing (my main contribution) plus
|
||||||
|
enough extra emacs-mode features to make it difficult to
|
||||||
|
distinguish from ksh88. Bug fixes from various contributors are
|
||||||
|
the only other changes from John MacMillan's version.
|
||||||
|
|
||||||
|
I have upped the version number for this release to distinguish
|
||||||
|
it from the original 3.3 version. This version is much improved
|
||||||
|
despite the small number of new features.
|
||||||
|
|
||||||
|
INSTALLATION:
|
||||||
|
|
||||||
|
The file INSTALL contains intructions for building and
|
||||||
|
installing the shell.
|
||||||
|
|
||||||
|
The original instructions indicated that a POSIX compliant
|
||||||
|
environment and possibly an ANSI compiler are required. I have
|
||||||
|
used both gcc and native Sun and the GreenHills ANSI compiler
|
||||||
|
without problems.
|
||||||
|
|
||||||
|
The POSIX/STDC compatability stuff in ./std seems to cause lots
|
||||||
|
of problems for some systems. This was at least in part because
|
||||||
|
I distributed it with half the librraies disabled :-), in any
|
||||||
|
case the shell itself in ./sh can now be compiled without any of
|
||||||
|
the ./std stuff which makes things much simpler on systems that
|
||||||
|
have a real POSIX environment.
|
||||||
|
|
||||||
|
Porting to new environemnts can be a real pain. I don't really
|
||||||
|
plan to make a huge effort in this area since I expect that this
|
||||||
|
shell will be mainly required on exotic or obscure systems (the
|
||||||
|
ones that the vendor does not provide a ksh for). Thus the
|
||||||
|
small "market" does not warrant a C-news or X11 style
|
||||||
|
portability effort. Of course if people send patches for
|
||||||
|
various systems I'm happy to try and integrate them.
|
||||||
|
|
||||||
|
ENVIRONMENT:
|
||||||
|
|
||||||
|
My main interest in this shell is for Sun workstations. Every
|
||||||
|
other UNIX system I use comes with a real ksh. Being a strictly
|
||||||
|
C-shell environment, some improved profile files are in order on
|
||||||
|
Sun's.
|
||||||
|
|
||||||
|
The etc directory contains a set of useful environment files.
|
||||||
|
These are the same files I use on several systems (many use a
|
||||||
|
real ksh):
|
||||||
|
./etc/profile
|
||||||
|
./etc/sys_config.sh
|
||||||
|
./etc/ksh.kshrc
|
||||||
|
|
||||||
|
The first one is obvious. The second, sys_config.sh is sourced
|
||||||
|
by /etc/profile and several other scripts. It is used to
|
||||||
|
determine the system type so that scripts like profile can be
|
||||||
|
used on multiple platforms.
|
||||||
|
The third one is also quite useful, add
|
||||||
|
. /etc/ksh.kshrc
|
||||||
|
to user's ~/.kshrc to simplify alias management.
|
||||||
|
|
||||||
|
BUGS:
|
||||||
|
|
||||||
|
Many folk have contributed to this shell.
|
||||||
|
I have attempted to credit (in sh/ChangeLog) the authors of bug
|
||||||
|
fixes received since the previous release.
|
||||||
|
There are surely still plenty of bugs to be found/fixed.
|
||||||
|
|
||||||
|
There is a template bug report in bug-report [borrowed from the
|
||||||
|
X11R5 mit tree], just fill in the blanks and mail to
|
||||||
|
pdksh-bug@zen.void.oz.au.
|
||||||
|
|
||||||
|
I hope you find this shell as useful as I do...
|
||||||
|
|
||||||
|
Simon J. Gerraty <sjg@zen.void.oz.au>
|
46
misc/ReadMe.eg
Normal file
46
misc/ReadMe.eg
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
Public Domain KornShell
|
||||||
|
|
||||||
|
Quick installation notes for PD KornShell
|
||||||
|
|
||||||
|
PD KornShell can be installed on 4.2+ BSD systems, System V, and
|
||||||
|
POSIX-compatable systems. The makefiles all define _BSD, change
|
||||||
|
this to _SYSV, or _POSIX. The makefiles also contain CC=gcc,
|
||||||
|
delete this if you don't have GNU C. The ksh makefile also
|
||||||
|
contains some options, including JOBS (BSD/POSIX job control)
|
||||||
|
and EDIT (emacs command editing).
|
||||||
|
|
||||||
|
PD KornShell assumes you have standard C (ANSI) and POSIX header
|
||||||
|
files and functions. Since you probably don't, they are provided
|
||||||
|
in the "std" directory.
|
||||||
|
|
||||||
|
The Alpha test version will probably come as two tar files.
|
||||||
|
std.tar contains standard C and POSIX emulation and must be
|
||||||
|
extracted into a directory called std. ksh.tar contains the ksh
|
||||||
|
source and should be extracted into a directory called src or
|
||||||
|
ksh.
|
||||||
|
|
||||||
|
See std/ReadMe and install it. Only then can you make ksh in the
|
||||||
|
"src" directory.
|
||||||
|
|
||||||
|
To clear up questions about the origin of this shell, this shell
|
||||||
|
is NOT based on the "Minix shell". It is based on Charles
|
||||||
|
Forsyth's public domain V7 shell, which he later contributed to
|
||||||
|
Minix.
|
||||||
|
|
||||||
|
I have permission directly from Charles Forsyth to use his shell.
|
||||||
|
|
||||||
|
Eric Gisin, egisin@math.UWaterloo.CA (or Waterloo.EDU)
|
||||||
|
|
||||||
|
Things to do
|
||||||
|
- add sxt-based job control (see Brown's contribution on the Usenix 87 tape).
|
||||||
|
- add arrays and variable attributes.
|
||||||
|
- add MAILPATH and CDPATH.
|
||||||
|
- add vi editing mode (apparently someone has a PD version).
|
||||||
|
- add new features described in Korn's book.
|
||||||
|
|
||||||
|
Machines ported to
|
||||||
|
VAX, 68000, 80386
|
||||||
|
|
||||||
|
OS's ported to
|
||||||
|
BSD 4.2, BSD 4.3 (with and without YP and NFS
|
||||||
|
Sys V.3
|
88
misc/ReadMe.emacs
Normal file
88
misc/ReadMe.emacs
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
HORIZONTAL SCROLLING
|
||||||
|
====================
|
||||||
|
|
||||||
|
I have migrated my 3.2 ksh edit.c mods into the 3.3 ksh
|
||||||
|
This file describes the mods in general and really only applies
|
||||||
|
(at this stage) to emacs-mode. I have not touched vi-mode apart
|
||||||
|
from making it use pprompt() so that '!' is correctly expanded
|
||||||
|
as in emacs-mode.
|
||||||
|
|
||||||
|
I would prefer to see both vi.c and emacs.c use a common set of
|
||||||
|
primatives in edit.c - but that looks like a lot of work.
|
||||||
|
|
||||||
|
Basically my mods affect the functions that move the cursor
|
||||||
|
about and redraw the edit line.
|
||||||
|
|
||||||
|
The input buffer "buf" is pointed to by "xbuf" and its end is
|
||||||
|
pointed to by "xend". The current position in "xbuf" and end of
|
||||||
|
the edit line are pointed to by "xcp" and "xep" respectively.
|
||||||
|
I have added "xbp" which points to the start of a display window
|
||||||
|
within "xbuf".
|
||||||
|
|
||||||
|
[A] starting position
|
||||||
|
|
||||||
|
buf
|
||||||
|
|<-------- $COLUMNS --------->|
|
||||||
|
| |<---- x_displen ------->|
|
||||||
|
| PS1|
|
||||||
|
+==========+==============--------+.......+
|
||||||
|
|\ \ \ \
|
||||||
|
xbuf xbp xcp xep xend
|
||||||
|
|
||||||
|
[B] scrolled
|
||||||
|
|
||||||
|
buf
|
||||||
|
| |<----- COLUMNS -------->|
|
||||||
|
| |<----- x_displen ------>|
|
||||||
|
|
|
||||||
|
+-----------+==========+==============--------+.......+
|
||||||
|
\ \ \ \ \
|
||||||
|
xbuf xbp xcp xep xend
|
||||||
|
|
||||||
|
In the above -------- represents the current edit line while
|
||||||
|
===== represents that portion which is visible on the screen.
|
||||||
|
Note that initially xbp == xbuf and PS1 is displayed.
|
||||||
|
PS1 uses some of the screen width and thus "x_displen" is less
|
||||||
|
than $COLUMNS.
|
||||||
|
|
||||||
|
Any time that "xcp" moves outside the region bounded by "xbp"
|
||||||
|
and "xbp" + "x_displen", the function x_adjust() is called to
|
||||||
|
relocate "xbp" appropriately and redraw the line.
|
||||||
|
|
||||||
|
Excessive I/O is avoided where possible. x_goto() for instance
|
||||||
|
calculates whether the destination is outside the visible
|
||||||
|
region, and if so simply adjusts "xcp" and calls x_adjust()
|
||||||
|
directly. Normally though x_adjust() is called from x_putc().
|
||||||
|
|
||||||
|
The above mechanism has be updated to use a function x_lastcp()
|
||||||
|
that returns a pointer that accurately reflects the last
|
||||||
|
visible char in the edit buffer. That is a more accurate
|
||||||
|
version of xbp + x_displen which does not account for TABS.
|
||||||
|
|
||||||
|
Other changes
|
||||||
|
=============
|
||||||
|
|
||||||
|
I have also added some emacs mode functions.
|
||||||
|
M-[0-9]
|
||||||
|
Set a numeric arg (positive only).
|
||||||
|
Used by all word related commands.
|
||||||
|
M-_
|
||||||
|
M-.
|
||||||
|
Retrieve word from previous command (default is last
|
||||||
|
word). Use M-[1-9] to select word.
|
||||||
|
M-u
|
||||||
|
M-l
|
||||||
|
M-c
|
||||||
|
UPPER,lower,Capitalize word.
|
||||||
|
|
||||||
|
|
||||||
|
Commands like delete-word now push the deleted text so that it
|
||||||
|
may be yanked back into place.
|
||||||
|
|
||||||
|
BUGS?
|
||||||
|
=====
|
||||||
|
|
||||||
|
There are bound to be some. Please report same to me:
|
||||||
|
|
||||||
|
Simon J. Gerraty <sjg@zen.void.oz.au>
|
||||||
|
|
118
misc/ReadMe.jrm
Normal file
118
misc/ReadMe.jrm
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
BUILDING THE PD KSH
|
||||||
|
===================
|
||||||
|
|
||||||
|
As usual, there are differences between BSD and System V
|
||||||
|
versions. Ideally, all you have to do is edit the Makefile in
|
||||||
|
this directory to set the CONFIG macro to the appropriate value.
|
||||||
|
(Actually, you may wish to change the CONFIG macro in all
|
||||||
|
Makefiles; if you always invoke make(1) from here, CONFIG will
|
||||||
|
be passed down, but if you invoke make(1) from a subdirectory
|
||||||
|
you'll want the appropriate definition in that Makefile.)
|
||||||
|
|
||||||
|
Of course it's not quite that simple. You may, however, take
|
||||||
|
solace in the knowledge that it used to be worse.
|
||||||
|
|
||||||
|
The Compatibility Libraries
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
Eric Gisin wrote this shell using ANSI C and POSIX as
|
||||||
|
portability guidlines. Realizing that nobody had a POSIX
|
||||||
|
system and almost no one had an ANSI C environment, he provided
|
||||||
|
minimal compatibility libraries.
|
||||||
|
|
||||||
|
There are two libraries, one for POSIX (libposix.a) and one for
|
||||||
|
ANSI C (libstdc.a).
|
||||||
|
|
||||||
|
Libposix.a is pretty simple. Nothing in it has ever broken on
|
||||||
|
me, so I'd just leave it. It provides a version of dup2() for
|
||||||
|
System V systems.
|
||||||
|
|
||||||
|
Libstdc.a is a bit hairy. I recommend looking at the routines
|
||||||
|
provided and, and editing the std/stdc Makefile and only
|
||||||
|
including objects that have routines your system libc.a is
|
||||||
|
lacking. Various of the provided routines are just plain
|
||||||
|
flaky, but only when they're not really needed. The other
|
||||||
|
hairy thing he does is craft an ANSI stdio.h from the system
|
||||||
|
supplied one and one of his own. Again, it's better than it
|
||||||
|
used to be, but it's still a hack, and you may have to modify
|
||||||
|
it by hand.
|
||||||
|
|
||||||
|
You will also need a POSIX compatible set of directory reading
|
||||||
|
routines. System V.3 systems have this in libc.a. The
|
||||||
|
std/posix directory provides a something for BSD systems. I
|
||||||
|
use a slightly modified version of Doug Gwyn's PD version.
|
||||||
|
|
||||||
|
(The ``slightly modified'' is to work around a bug in Gwyn's version.
|
||||||
|
The POSIX routines are documented as returning failure if the file for
|
||||||
|
opendir(3) is not a directory. Gwyn attempts to open(2) the file, and
|
||||||
|
then stats it to see if the file is a directory. However, if the file
|
||||||
|
is a special file, and the open(2) doesn't return, you're screwed. My
|
||||||
|
change was to open the file with the O_NDELAY flag, but Gwyn didn't
|
||||||
|
feel this was portable (true, but I only do it where it works) and
|
||||||
|
that stat-ing before the open would be too slow (true). The upshot is
|
||||||
|
if you use his routines unmodified, don't ever do an "ls -l /dev/*/*".)
|
||||||
|
|
||||||
|
The Shell Source
|
||||||
|
----------------
|
||||||
|
|
||||||
|
The source for the shell itself is in the sh directory. There you
|
||||||
|
will want to edit config.h to determine the configuration options. Vi
|
||||||
|
mode is in kind of rough shape, but does work. DIRSTACK routines
|
||||||
|
aren't implemented yet, so again, why bother. SWTCH is a bit arcane,
|
||||||
|
but it you use shl(1) and you define EMACS or VI you want to define
|
||||||
|
this. JOBS is really only useful on BSD systems. It might work on
|
||||||
|
systems that have POSIX job control, but I wouldn't bet on it.
|
||||||
|
SHARPBANG is only useful on systems where the exec() family don't
|
||||||
|
honour the #!/prog/path convention.
|
||||||
|
|
||||||
|
This is where the shell gets built so you may wish to change
|
||||||
|
the OTHERLIBS macro in the Makefile to point to your POSIX
|
||||||
|
directory routines, or to use -lc_s, or whatever.
|
||||||
|
|
||||||
|
Miscellaneous
|
||||||
|
-------------
|
||||||
|
|
||||||
|
The Makefiles that actually compile things use the macro
|
||||||
|
CCOPTS, so you can change it in individual Makefiles or specify
|
||||||
|
it on the command line, eg. "make CCOPTS=-O OTHERLIBS=-lc_s".
|
||||||
|
LDOPTS is used in the Makefile where the ksh is actually built.
|
||||||
|
|
||||||
|
The very first time on a new system, do a "make clobber"
|
||||||
|
|
||||||
|
Good luck.
|
||||||
|
|
||||||
|
Documentation
|
||||||
|
-------------
|
||||||
|
|
||||||
|
The ksh.1 is a man page for the PD ksh, although it lags
|
||||||
|
somewhat behind the code. You get what you pay for.
|
||||||
|
|
||||||
|
The ksh88.1 is a man page for AT&T's ksh88 (the latest version)
|
||||||
|
provided for comparison.
|
||||||
|
|
||||||
|
History
|
||||||
|
-------
|
||||||
|
|
||||||
|
Much of the shell was written by Eric Gisin at the University
|
||||||
|
of Waterloo, using some pieces of other stuff, notably Charles
|
||||||
|
Forsythe's V7 shell, and some enhancements from the BRL shell.
|
||||||
|
He placed it (in a alpha test state) into the public domain
|
||||||
|
while I was at UW. I snarfed a copy, and got it running on my
|
||||||
|
UNIXpc, and later some machines at work. I sent Gisin some bug
|
||||||
|
reports, but he seems to have lost interest in the project.
|
||||||
|
This may be because he now does some work for MKS, who produce a
|
||||||
|
commercial version of the ksh for MS-DOS machines, so there may
|
||||||
|
be a conflict of interest.
|
||||||
|
|
||||||
|
So I gave up on getting future versions, and adopted it. I've
|
||||||
|
made some enhancements, and quite a few bug fixes, and various
|
||||||
|
people at work have contributed as well. It remains in the
|
||||||
|
public domain, although I imagine the people involved would
|
||||||
|
appreciate leaving their names attached (I'm exempt; I haven't
|
||||||
|
actually included my name anywhere but here).
|
||||||
|
|
||||||
|
The README in the sh directory is Gisin's, and tells a bit of
|
||||||
|
the story from his point of view. Note that his compilation
|
||||||
|
instructions don't really apply anymore.
|
||||||
|
|
||||||
|
John R. MacMillan
|
35
mkinstalldirs
Normal file
35
mkinstalldirs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Make directory hierarchy.
|
||||||
|
# Written by Noah Friedman <friedman@prep.ai.mit.edu>
|
||||||
|
# Public domain.
|
||||||
|
|
||||||
|
defaultIFS='
|
||||||
|
'
|
||||||
|
IFS="${IFS-${defaultIFS}}"
|
||||||
|
|
||||||
|
errstatus=0
|
||||||
|
|
||||||
|
for file in ${1+"$@"} ; do
|
||||||
|
oIFS="${IFS}"
|
||||||
|
# Some sh's can't handle IFS=/ for some reason.
|
||||||
|
IFS='%'
|
||||||
|
set - `echo ${file} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||||
|
IFS="${oIFS}"
|
||||||
|
|
||||||
|
pathcomp=''
|
||||||
|
|
||||||
|
for d in ${1+"$@"} ; do
|
||||||
|
pathcomp="${pathcomp}${d}"
|
||||||
|
|
||||||
|
if test ! -d "${pathcomp}"; then
|
||||||
|
echo "mkdir $pathcomp" 1>&2
|
||||||
|
mkdir "${pathcomp}" || errstatus=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
pathcomp="${pathcomp}/"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $errstatus
|
||||||
|
|
||||||
|
# eof
|
44
mkman
Normal file
44
mkman
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
verbose=no
|
||||||
|
|
||||||
|
if [ X"$1" = X-v ] ; then
|
||||||
|
verbose=yes
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
if [ $# != 2 ] ; then
|
||||||
|
echo "Usage: $0 [-v] which-shell ksh.Man-file" 1>&2
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
shell=$1
|
||||||
|
man=$2
|
||||||
|
|
||||||
|
case $shell in
|
||||||
|
sh) which=0;;
|
||||||
|
ksh) which=1;;
|
||||||
|
*)
|
||||||
|
echo "$0: bad shell option (must be sh or ksh)" 1>&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if [ ! -r "$man" ] ; then
|
||||||
|
echo "$0: can't read $man file" 1>&2
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Now generate the appropriate man page...
|
||||||
|
#
|
||||||
|
[ $verbose = yes ] && echo "$0: Generating $which man page (0=sh,1=ksh)..." 1>&2
|
||||||
|
|
||||||
|
awk 'BEGIN { ksh = '$which'; pr = 1 }
|
||||||
|
/^\.sh\(/ { pr = ksh - 1; next }
|
||||||
|
/^\.sh\)/ { pr = 1; next }
|
||||||
|
/^\.ksh\(/ { pr = ksh; next }
|
||||||
|
/^\.ksh\)/ { pr = 1; next }
|
||||||
|
{ if (pr) print $0 } ' < $man
|
||||||
|
|
||||||
|
[ $verbose = yes ] && echo "$0: All done" 1>&2
|
||||||
|
|
||||||
|
exit 0
|
75
new-version.sh
Normal file
75
new-version.sh
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Update the date in the version file (version.c). If the existing
|
||||||
|
# date is todays date, a .number is apprended (or incremented) to
|
||||||
|
# make them distinct.
|
||||||
|
# Also update the version number and date in tests/version.t and ksh.Man.
|
||||||
|
#
|
||||||
|
|
||||||
|
# pattern that matches the date in the version string in version.c
|
||||||
|
# \1 is preamble (@(#)PD KSH ),
|
||||||
|
# \2 is the version (v1.2.3 ),
|
||||||
|
# \3 is the date (99/03/21.3),
|
||||||
|
# \4 is postamble (...)
|
||||||
|
# (use ? pattern delimiters).
|
||||||
|
DATEPAT='\(.*@(#).* \)\(v[.0-9]* \)\([0-9]*/[0-9]*/[.0-9]*\)\(.*\)'
|
||||||
|
|
||||||
|
vfile=version.c
|
||||||
|
vfiles="version.c tests/version.t ksh.Man"
|
||||||
|
|
||||||
|
version=`sed -n "s?$DATEPAT?\2?p" < $vfile`
|
||||||
|
odatev=`sed -n "s?$DATEPAT?\3?p" < $vfile`
|
||||||
|
odate=`echo "$odatev" | sed 's?\..*??'`
|
||||||
|
ov=`echo "$odatev" | sed 's?[^.]*\.*??'`
|
||||||
|
|
||||||
|
date=`date '+%y/%m/%d' 2> /dev/null`
|
||||||
|
case "$date" in
|
||||||
|
[0-9]*/[0-9]*/[0-9]*) ;;
|
||||||
|
*)
|
||||||
|
# old system - try to compensate...
|
||||||
|
date=`date | awk 'BEGIN {
|
||||||
|
months["Jan"] = 1; months["Feb"] = 2; months["Mar"] = 3;
|
||||||
|
months["Apr"] = 4; months["May"] = 5; months["Jun"] = 6;
|
||||||
|
months["Jul"] = 7; months["Aug"] = 8; months["Sep"] = 9;
|
||||||
|
months["Oct"] = 10; months["Nov"] = 11; months["Dec"] = 12;
|
||||||
|
} {
|
||||||
|
if (months[$2])
|
||||||
|
mon = sprintf("%02d", months[$2]);
|
||||||
|
else
|
||||||
|
mon = $2;
|
||||||
|
printf "%02d/%s/%02d\n", $6 % 100, mon, $3;
|
||||||
|
}'`
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test x"$odate" = x"$date"; then
|
||||||
|
v=".$ov"
|
||||||
|
if test -z "$ov" ; then
|
||||||
|
v=1
|
||||||
|
else
|
||||||
|
v=`expr $ov + 1`
|
||||||
|
fi
|
||||||
|
date="$date.$v"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for i in $vfiles; do
|
||||||
|
bfile=$i.bak
|
||||||
|
tfile=$i.new
|
||||||
|
# try to save permissions/ownership/group
|
||||||
|
cp -p $i $tfile 2> /dev/null
|
||||||
|
if sed "s?$DATEPAT?\1$version$date\4?" < $i > $tfile; then
|
||||||
|
if cmp -s $i $tfile; then
|
||||||
|
echo "$i not changed, not updating"
|
||||||
|
rm -f $tfile
|
||||||
|
else
|
||||||
|
rm -f $bfile
|
||||||
|
ln $i $bfile || exit 1
|
||||||
|
mv $tfile $i || exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "$0: error creating new $i" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0
|
323
os2/Makefile
Normal file
323
os2/Makefile
Normal file
@ -0,0 +1,323 @@
|
|||||||
|
#
|
||||||
|
# OS2_Makefile
|
||||||
|
#
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
VPATH = .
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CPP = cpp
|
||||||
|
|
||||||
|
INSTALL = /bin/install -c
|
||||||
|
INSTALL_PROGRAM = $(INSTALL)
|
||||||
|
INSTALL_DATA = $(INSTALL) -m 644
|
||||||
|
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -los2
|
||||||
|
|
||||||
|
CPPFLAGS =
|
||||||
|
CFLAGS = -O -DOS2
|
||||||
|
LDSTATIC =
|
||||||
|
LDFLAGS = -O -s $(LDSTATIC)
|
||||||
|
|
||||||
|
SHELL_PROG = ksh
|
||||||
|
|
||||||
|
prefix = c:/usr
|
||||||
|
exec_prefix = c:/usr
|
||||||
|
transform=@program_transform_name@
|
||||||
|
|
||||||
|
bindir = $(exec_prefix)/bin
|
||||||
|
mandir = $(prefix)/man/man$(manext)
|
||||||
|
manext = 1
|
||||||
|
|
||||||
|
# Suffix for executables: nothing for unix, .exe for os/2.
|
||||||
|
exe_suffix=.exe
|
||||||
|
|
||||||
|
SHELL = sh
|
||||||
|
|
||||||
|
SRCS = alloc.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c emacs.c \
|
||||||
|
eval.c exec.c expr.c history.c io.c jobs.c lex.c mail.c \
|
||||||
|
main.c misc.c missing.c path.c shf.c sigact.c syn.c table.c trap.c \
|
||||||
|
tree.c tty.c var.c version.c vi.c
|
||||||
|
OBJS = os2.o 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 misc.o missing.o path.o shf.o sigact.o syn.o table.o trap.o \
|
||||||
|
tree.o tty.o var.o version.o vi.o
|
||||||
|
HDRS = c_test.h edit.h expand.h ksh_dir.h ksh_limval.h ksh_stat.h ksh_time.h \
|
||||||
|
ksh_times.h ksh_wait.h lex.h proto.h sh.h shf.h sigact.h \
|
||||||
|
table.h tree.h tty.h
|
||||||
|
DISTFILES = $(SRCS) $(HDRS) ksh.Man Makefile.in configure.in \
|
||||||
|
config.h.in conf-end.h acconfig.h aclocal.m4 emacs-gen.sh \
|
||||||
|
mkinstalldirs install-sh new-version.sh siglist.in siglist.sh mkman \
|
||||||
|
check-fd.c check-pgrp.c check-sigs.c \
|
||||||
|
README NEWS CONTRIBUTORS LEGAL PROJECTS INSTALL NOTES BUG-REPORTS \
|
||||||
|
IAFA-PACKAGE ChangeLog ChangeLog.0 configure stamp-h.in
|
||||||
|
# ETCFILES also disted, but handled differently
|
||||||
|
ETCFILES = etc/ksh.kshrc etc/profile etc/sys_config.sh
|
||||||
|
# MISCFILES also disted, but handled differently
|
||||||
|
MISCFILES = misc/ChangeLog.sjg misc/Changes.jrm misc/Changes.mlj \
|
||||||
|
misc/Changes.pc misc/README.sjg misc/ReadMe.eg misc/ReadMe.emacs \
|
||||||
|
misc/ReadMe.jrm misc/Bugs
|
||||||
|
# TESTFILES also disted, but handled differently
|
||||||
|
TESTFILES = tests/README tests/th tests/th-sh tests/alias.t tests/arith.t \
|
||||||
|
tests/bksl-nl.t tests/brkcont.t tests/cdhist.t tests/eglob.t \
|
||||||
|
tests/glob.t tests/heredoc.t tests/history.t tests/ifs.t \
|
||||||
|
tests/integer.t tests/lineno.t tests/read.t tests/regress.t \
|
||||||
|
tests/syntax.t tests/unclass1.t tests/unclass2.t \
|
||||||
|
tests/version.t
|
||||||
|
# OS2FILES also disted, but handled differently
|
||||||
|
OS2FILES = os2/Makefile os2/config.h os2/config.status os2/configure.cmd \
|
||||||
|
os2/emacs.out os2/kshrc.ksh os2/make.sed os2/os2.c os2/os2siglist.out \
|
||||||
|
os2/README.os2 os2/NEWS.os2 os2/os2bugs os2/th.cmd os2/config.cache
|
||||||
|
|
||||||
|
all: $(SHELL_PROG)$(exe_suffix) $(SHELL_PROG).1
|
||||||
|
|
||||||
|
# This shouldn't be first - some makes don't know about PRECIOUS and assume it
|
||||||
|
# is the default target.
|
||||||
|
.PRECIOUS: configure config.h.in Makefile config.status
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(DEFS) -I. -I$(srcdir) $(CFLAGS) $<
|
||||||
|
|
||||||
|
install: installdirs all
|
||||||
|
$(INSTALL_PROGRAM) $(SHELL_PROG)$(exe_suffix) $(bindir)/$(SHELL_PROG)$(exe_suffix)
|
||||||
|
-$(INSTALL_DATA) $(SHELL_PROG).1 $(mandir)/$(SHELL_PROG).$(manext)
|
||||||
|
-@prog=$(bindir)/$(SHELL_PROG)$(exe_suffix);\
|
||||||
|
test -f /etc/shells \
|
||||||
|
&& (grep "^$$prog\$$" /etc/shells > /dev/null \
|
||||||
|
|| echo \
|
||||||
|
"NOTE: /etc/shells does not contain $$prog \
|
||||||
|
you should add it if you want to set your shell to $(SHELL_PROG)")
|
||||||
|
|
||||||
|
installdirs:
|
||||||
|
$(srcdir)/mkinstalldirs $(bindir) $(mandir)
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(bindir)/$(SHELL_PROG)$(exe_suffix)
|
||||||
|
rm -f $(mandir)/$(SHELL_PROG).$(manext)
|
||||||
|
|
||||||
|
check test:
|
||||||
|
th.cmd $(srcdir)/tests/th -s $(srcdir)/tests -p ./$(SHELL_PROG)$(exe_suffix) -C pdksh,sh,ksh,posix,posix-upu $(TESTARGS)
|
||||||
|
|
||||||
|
$(SHELL_PROG)$(exe_suffix): $(OBJS)
|
||||||
|
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||||
|
|
||||||
|
# two steps to prevent the creation of a bogus tmpksh.1
|
||||||
|
$(SHELL_PROG).1: $(srcdir)/ksh.Man
|
||||||
|
$(srcdir)/mkman $(SHELL_PROG) $(srcdir)/ksh.Man > tmpksh.1
|
||||||
|
mv tmpksh.1 $(SHELL_PROG).1
|
||||||
|
|
||||||
|
info:
|
||||||
|
@echo "No info (yet)"
|
||||||
|
|
||||||
|
dvi:
|
||||||
|
|
||||||
|
$(srcdir)/configure: configure.in aclocal.m4
|
||||||
|
cd $(srcdir) && autoconf
|
||||||
|
|
||||||
|
$(srcdir)/config.h.in: stamp-h.in
|
||||||
|
$(srcdir)/stamp-h.in: configure.in aclocal.m4 acconfig.h
|
||||||
|
cd $(srcdir) && autoheader
|
||||||
|
date > $(srcdir)/stamp-h.in
|
||||||
|
|
||||||
|
config.h:
|
||||||
|
cmd /c copy $(srcdir)\os2\config.h config.h > nul
|
||||||
|
touch config.h
|
||||||
|
Makefile:
|
||||||
|
cmd /c copy $(srcdir)\os2\Makefile Makefile > nul
|
||||||
|
touch Makefile
|
||||||
|
# two steps to prevent the creation of a bogus siglist.out
|
||||||
|
siglist.out:
|
||||||
|
cmd /c copy $(srcdir)\os2\os2siglist.out siglist.out > nul
|
||||||
|
touch siglist.out
|
||||||
|
# two steps to prevent the creation of a bogus emacs.out
|
||||||
|
emacs.out:
|
||||||
|
cmd /c copy $(srcdir)\os2\emacs.out emacs.out > nul
|
||||||
|
touch emacs.out
|
||||||
|
debugtools: check-fd$(exe_suffix) check-sigs$(exe_suffix) \
|
||||||
|
check-pgrp$(exe_suffix)
|
||||||
|
|
||||||
|
check-fd.o check-pgrp.o check-sigs.o: config.h
|
||||||
|
check-fd$(exe_suffix): check-fd.o
|
||||||
|
$(CC) $(LDFLAGS) -o $@ check-fd.o $(LIBS)
|
||||||
|
|
||||||
|
check-pgrp$(exe_suffix): check-pgrp.o
|
||||||
|
$(CC) $(LDFLAGS) -o $@ check-pgrp.o $(LIBS)
|
||||||
|
|
||||||
|
check-sigs$(exe_suffix): check-sigs.o
|
||||||
|
$(CC) $(LDFLAGS) -o $@ check-sigs.o $(LIBS)
|
||||||
|
|
||||||
|
TAGS: $(SRCS) $(HDRS)
|
||||||
|
cd $(srcdir) && etags $(SRCS) $(HDRS)
|
||||||
|
|
||||||
|
tags: $(SRCS) $(HDRS)
|
||||||
|
cd $(srcdir) && ctags -wt $(SRCS) $(HDRS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f ksh$(exe_suffix) sh$(exe_suffix) ksh.1 sh.1 $(OBJS) siglist.out \
|
||||||
|
emacs.out core a.out mon.out gmon.out \
|
||||||
|
version.c.bak Makefile.bak Makefile.tmp check-fd$(exe_suffix) \
|
||||||
|
check-pgrp$(exe_suffix) check-sigs$(exe_suffix)
|
||||||
|
|
||||||
|
mostlyclean: clean
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
rm -f Makefile config.h stamp-h config.status config.log config.cache \
|
||||||
|
tags TAGS *~
|
||||||
|
|
||||||
|
realclean: distclean
|
||||||
|
|
||||||
|
dist: $(DISTFILES) $(ETCFILES) $(MISCFILES) $(TESTFILES) $(OS2FILES)
|
||||||
|
cd $(srcdir) && \
|
||||||
|
{ \
|
||||||
|
./new-version.sh; \
|
||||||
|
FNAME=pdksh-`sed -e '/"@(.)/!d' \
|
||||||
|
-e 's/[^0-9]*\([0-9.]*\).*/\1/' -e q version.c`; \
|
||||||
|
if test `echo $$FNAME|tr . ' '|wc -w|sed 's/[ ]*//g'` -gt 3; \
|
||||||
|
then \
|
||||||
|
FNAME=`echo $$FNAME | sed 's/pdksh-/pdksh-unstable-/'`; \
|
||||||
|
fi; \
|
||||||
|
echo Creating version $$FNAME; \
|
||||||
|
rm -rf $$FNAME; \
|
||||||
|
mkdir $$FNAME $$FNAME/etc $$FNAME/misc $$FNAME/tests $$FNAME/os2; \
|
||||||
|
cp -p $(DISTFILES) $$FNAME; \
|
||||||
|
cp -p $(ETCFILES) $$FNAME/etc; \
|
||||||
|
cp -p $(MISCFILES) $$FNAME/misc; \
|
||||||
|
cp -p $(TESTFILES) $$FNAME/tests; \
|
||||||
|
cp -p $(OS2FILES) $$FNAME/os2; \
|
||||||
|
./emacs-gen.sh emacs.c > os2/emacs.out; \
|
||||||
|
test -x ./Dist-fixup && ./Dist-fixup $$FNAME; \
|
||||||
|
sed -f os2/make.sed < $$FNAME/Makefile.in > $$FNAME/os2/Makefile; \
|
||||||
|
chmod -R a+rX,u+w,og-w $$FNAME; \
|
||||||
|
tar chzf $$FNAME.tar.gz $$FNAME; \
|
||||||
|
find $$FNAME -print | xargs pathchk -p; \
|
||||||
|
}
|
||||||
|
|
||||||
|
depend: $(SRCS)
|
||||||
|
sed -n '1,/[ ]PUT ANYTHING BELOW THIS LINE/p' < Makefile > Makefile.tmp
|
||||||
|
srcs=; for i in $(SRCS) ; do srcs="$$srcs $(srcdir)/$$i"; done; \
|
||||||
|
$(CC) -M $(DEFS) -I. -I$(srcdir) $(CFLAGS) $$srcs | \
|
||||||
|
sed -e 's?[ ]/[^ ]*??g' -e 's?[ ]./? ?g' \
|
||||||
|
-e 's?[ ]$(srcdir)//*? ?g' -e 's?^$(srcdir)//*??' \
|
||||||
|
-e '/^[ ]*\\[ ]*$$/d' -e '/^[^:]*:[ ]*$$/d' \
|
||||||
|
-e 's/^\([ ]*\)$$/ sh.h/' \
|
||||||
|
>> Makefile.tmp
|
||||||
|
mv Makefile.tmp Makefile
|
||||||
|
@echo 'Make depend done (stopping make)'; false
|
||||||
|
|
||||||
|
# DON'T PUT ANYTHING BELOW THIS LINE (and don't delete it - its for make depend)
|
||||||
|
alloc.o: alloc.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h
|
||||||
|
c_ksh.o: c_ksh.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h \
|
||||||
|
sh.h
|
||||||
|
c_sh.o: c_sh.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h ksh_time.h \
|
||||||
|
ksh_times.h \
|
||||||
|
sh.h
|
||||||
|
c_test.o: c_test.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h c_test.h
|
||||||
|
c_ulimit.o: c_ulimit.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_time.h \
|
||||||
|
sh.h
|
||||||
|
edit.o: edit.c config.h conf-end.h sh.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h tty.h \
|
||||||
|
edit.h \
|
||||||
|
ksh_stat.h
|
||||||
|
emacs.o: emacs.c config.h conf-end.h sh.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h ksh_dir.h \
|
||||||
|
edit.h emacs.out
|
||||||
|
eval.o: eval.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h \
|
||||||
|
ksh_dir.h \
|
||||||
|
ksh_stat.h
|
||||||
|
exec.o: exec.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h c_test.h \
|
||||||
|
ksh_stat.h
|
||||||
|
expr.o: expr.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h \
|
||||||
|
sh.h
|
||||||
|
history.o: history.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h
|
||||||
|
io.o: io.c \
|
||||||
|
sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h
|
||||||
|
jobs.o: jobs.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h ksh_wait.h \
|
||||||
|
ksh_times.h ksh_time.h \
|
||||||
|
tty.h \
|
||||||
|
sh.h
|
||||||
|
lex.o: lex.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h \
|
||||||
|
sh.h
|
||||||
|
mail.o: mail.c config.h conf-end.h sh.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h ksh_time.h \
|
||||||
|
sh.h
|
||||||
|
main.o: main.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h ksh_time.h \
|
||||||
|
sh.h
|
||||||
|
misc.o: misc.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h \
|
||||||
|
sh.h
|
||||||
|
missing.o: missing.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h ksh_dir.h \
|
||||||
|
ksh_time.h \
|
||||||
|
ksh_times.h \
|
||||||
|
sh.h
|
||||||
|
path.o: path.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h
|
||||||
|
shf.o: shf.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h ksh_limval.h \
|
||||||
|
sh.h
|
||||||
|
sigact.o: sigact.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h
|
||||||
|
syn.o: syn.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h c_test.h
|
||||||
|
table.o: table.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h
|
||||||
|
trap.o: trap.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h siglist.out
|
||||||
|
tree.o: tree.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h
|
||||||
|
tty.o: tty.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_stat.h tty.h \
|
||||||
|
sh.h
|
||||||
|
var.o: var.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h ksh_time.h \
|
||||||
|
ksh_limval.h \
|
||||||
|
ksh_stat.h \
|
||||||
|
sh.h
|
||||||
|
version.o: version.c sh.h config.h conf-end.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h
|
||||||
|
vi.o: vi.c config.h conf-end.h sh.h \
|
||||||
|
shf.h table.h tree.h expand.h lex.h \
|
||||||
|
proto.h \
|
||||||
|
ksh_stat.h edit.h
|
106
os2/NEWS.os2
Normal file
106
os2/NEWS.os2
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
Version 5.2.6
|
||||||
|
|
||||||
|
1. The bug where hereis documents would leave temporary files behind has
|
||||||
|
been fixed.
|
||||||
|
|
||||||
|
2. Changed extension search order to place .exe files ahead of files with
|
||||||
|
no extension. This permits the gcc option -Zexe to work properly,
|
||||||
|
however it causes some limitations. Should this be a problem then I will
|
||||||
|
have to detect and ignore zero length files without an extension as a
|
||||||
|
special case for gcc. I would prefer not to do this.
|
||||||
|
|
||||||
|
3. Increased the number of file descriptors available to 40. This corrects
|
||||||
|
a problem that showed up on some warp connect systems.
|
||||||
|
|
||||||
|
4. Allowed any extension to be used for a script so long as the user
|
||||||
|
explicitly types it in.
|
||||||
|
|
||||||
|
Version 5.2.4
|
||||||
|
|
||||||
|
1. You can now open multiple files in a script, i.e. exec works. Some
|
||||||
|
better checking could still be done.
|
||||||
|
|
||||||
|
2. A bug in reading input files where data was getting shifted around
|
||||||
|
has been fixed. (forced binary mode to emx a number of places for input.)
|
||||||
|
|
||||||
|
3. Directories with same name as executables will no longer cause an error.
|
||||||
|
|
||||||
|
4. OS2 cmd processing of extproc header line only passes the file name
|
||||||
|
to the spawned process instead of the full pathname. This is a bug
|
||||||
|
in os2 IMHO since if you explicitely want a certain path for the
|
||||||
|
command you cannot guarantee it. A change was made to search the
|
||||||
|
path within ksh to permit this processing to work. Note that the
|
||||||
|
copy ksh finds might not be the one you wanted but at least you can
|
||||||
|
copy your cmd files around without having to modify them. A side
|
||||||
|
effect of this change is that typing: "ksh whatis" will now search
|
||||||
|
your path as well which does change the standard behavior of ksh.
|
||||||
|
|
||||||
|
5. #! processing will now search for the shell using the explicit path
|
||||||
|
and if not found then it will use the path variable.
|
||||||
|
Most of you won't notice any difference since the shell will still
|
||||||
|
be found but if you needed a particular one then this can be done.
|
||||||
|
Note that if you only want a particular pathname use "\"'s in the path.
|
||||||
|
|
||||||
|
6. Ksh will now honor the advertised EXECSHELL variable if it is set
|
||||||
|
instead of OS2_SHELL as the shell to be used if there is no
|
||||||
|
#! or extproc line in the file. The difference is EXECSHELL will not
|
||||||
|
have any options supplied while OS2_SHELL will automatically get
|
||||||
|
/c and the pathname will have '\' as the directory separator.
|
||||||
|
OS2_SHELL will still be used if EXECSHELL is not set.
|
||||||
|
|
||||||
|
7. A new option to print, -f, has been added for os2 users. It will
|
||||||
|
force forward slashes. It is useful when trying to massage an
|
||||||
|
environmental variable containing backslashes using something like
|
||||||
|
sed which always interpretes backslashes as escapes. There is
|
||||||
|
and example of this in the new kshrc.ksh that I have included.
|
||||||
|
|
||||||
|
8. Working with os2 variables can be a pain try to escape all of the ';'s
|
||||||
|
so I have supplied some new functions in the kshrc.ksh. Please
|
||||||
|
checkout add_path, pre_path, and del_path. These functions will
|
||||||
|
append a path, prepend a path, or delete a path from the variable
|
||||||
|
you specify, PATH by default. These are modification of the
|
||||||
|
samples shipped with the unix pdksh startup files.
|
||||||
|
|
||||||
|
9. The echo output and other outputs from ksh now use forward slashes
|
||||||
|
and in general forward slashes will be seen more often than before.
|
||||||
|
Backslashes will still be accepted on input and command line
|
||||||
|
completion but it was too painful to try and preserve the os2 look
|
||||||
|
for output and permit Unix scripts to work. If you prefer the
|
||||||
|
old method change the variable DIRSEP in sh.h and rebuild.
|
||||||
|
|
||||||
|
10. A bug requiring all command extensions to be in lower case was
|
||||||
|
fixed. This showed up most often in the setting of OS2_SHELL.
|
||||||
|
|
||||||
|
11. os2/configure will now set up to build either ksh or sh.
|
||||||
|
|
||||||
|
|
||||||
|
Version 5.2.2
|
||||||
|
|
||||||
|
o OS2 executable can be built directly from original sources! No patches
|
||||||
|
required. Just unload, cd to source directory, run os2\configure, and
|
||||||
|
then make (v3.73 minimum), nmake, or dmake.
|
||||||
|
o Built on emx09a. (513 was built on 08.)
|
||||||
|
o Now uses full signal processing from emx. Previous version used fake
|
||||||
|
signals. Better and more accurate signal status.
|
||||||
|
o TMPDIR variable can now point to a another drive. Which can be a FAT
|
||||||
|
drive.
|
||||||
|
o Improved case folding in vi mode for file name matches.
|
||||||
|
o Vi mode can now use cursor keys if desired. (Like emacs mode)
|
||||||
|
o Both vi and emacs mode now get a set of default stty settings. ^C
|
||||||
|
and ^U should now work during command line editing.
|
||||||
|
o #!/bin/sh and similar lines at the top of scripts are now stripped
|
||||||
|
of pathname prefixes permitting use of standard OS2 search paths.
|
||||||
|
This should permit better shell script portability.
|
||||||
|
o case statement variable usage is now case sensitive. Also applies
|
||||||
|
to several other variable constructions.
|
||||||
|
o Now accepts .sh as an executable extension.
|
||||||
|
o All commands that start a new window are automatically backgrounded.
|
||||||
|
o ksh can usually be made to grok gnu configure scripts but the results
|
||||||
|
are still very script dependant. See the readme.os2 for details.
|
||||||
|
|
||||||
|
|
||||||
|
Version 5.1.3
|
||||||
|
|
||||||
|
This was the original version 5 release based on an earlier port of
|
||||||
|
4.9 by Kai Rommel.
|
||||||
|
|
498
os2/README.os2
Normal file
498
os2/README.os2
Normal file
@ -0,0 +1,498 @@
|
|||||||
|
OS/2 port of pdksh version 5
|
||||||
|
June, 1996
|
||||||
|
|
||||||
|
Introduction
|
||||||
|
|
||||||
|
This document is intended to define the specific features and
|
||||||
|
differences in the os/2 port of pdksh. For general features and
|
||||||
|
descriptions of pdksh itself please refer to the standard pdksh README
|
||||||
|
or the man page. In general the port has tried to maintain as many of
|
||||||
|
the standard ksh features as possible. For installation details and
|
||||||
|
an introduction to ksh please read the README.1st file shipped in the
|
||||||
|
run time zip package for os2.
|
||||||
|
|
||||||
|
A default build of pdksh, called ksh.exe, is included in the os2
|
||||||
|
run time package. This version was built using the emx environment and
|
||||||
|
therefore requires that an emx run time package 0.9b or later be
|
||||||
|
installed on the system. This is not normally a problem since you
|
||||||
|
probably already installed it for 'ls' and other Unix commands from
|
||||||
|
the file gnufutil.zip. (If you haven't install gnufutil.zip you may
|
||||||
|
want to consider it.)
|
||||||
|
|
||||||
|
Building KSH.EXE
|
||||||
|
|
||||||
|
If you would rather build your own, you should obtain the sources from
|
||||||
|
ftp.cs.mun.ca in the directory pub/pdksh. You will need a copy of tar
|
||||||
|
and gunzip to unload the archive and install on an hpfs partition. Change
|
||||||
|
to the source directory and run the script os2\configure.cmd. (If you
|
||||||
|
prefer you can copy configure.cmd to the source directory.) This will
|
||||||
|
prepare the build environment so that your version of make can be used
|
||||||
|
to build the executable. Note that configure.cmd is still under
|
||||||
|
construction and you may need to make changes to the Makefile and to
|
||||||
|
config.h to match your specific needs. Copies of all of these files
|
||||||
|
will be placed into the source directory. In addition you may want to
|
||||||
|
make changes to config.h to define your particular preferences.
|
||||||
|
Configure.cmd for os2 support these optional options and arguments:
|
||||||
|
/h | /? | -h Print a usage message and exit.
|
||||||
|
/v | -v Print verbose output during configure
|
||||||
|
/d | -d build a debug version with symbols (for gcc)
|
||||||
|
sh build sh rather than ksh
|
||||||
|
Any configuration other that the default requires that sed be in your
|
||||||
|
search path. You should always get a copy of the latest pre-built version
|
||||||
|
of ksh as well since the file os2bugs may contain some last minute fixes
|
||||||
|
that were too late to include in the formal release, and you may find some
|
||||||
|
other updates. In addition the run time version supplies a couple of
|
||||||
|
sample icons for use with ksh.
|
||||||
|
|
||||||
|
At this point you can use your favorite make command to build the
|
||||||
|
executable. Pdksh is known to work with nmake and dmake, gnu make requires
|
||||||
|
at least version 3.7.3 and is the only one that will automatically make the
|
||||||
|
man page. You can manually run mkman after starting your new copy of ksh,
|
||||||
|
'ksh mkman ksh|sh ksh.man'. (A prebuilt sh and expanded cat version of
|
||||||
|
ksh.1 is included in the rt package.)
|
||||||
|
|
||||||
|
There is a built in check routine that is part of the makefile. Type
|
||||||
|
'make check' to run it. This routine needs a copy of perl on your
|
||||||
|
machine in order to support the test harness used to test the build. I
|
||||||
|
have built the infrastructure into the port to support this checking but
|
||||||
|
have not been able to get it all to run correctly yet. The problem is
|
||||||
|
because of a bug in the os2 port of ksh. To check the build without using
|
||||||
|
perl, run the command: 'ksh Bugs ksh'. This will use the older checking
|
||||||
|
facility. You should run this if you make any changes to the source to
|
||||||
|
insure that you haven't broken something crucial. Run make check on an
|
||||||
|
unmodified version first so that you will know what to expect. If you
|
||||||
|
want to get the perl version running please contact me for information.
|
||||||
|
|
||||||
|
KSH 5 VERSUS KSH 4.9
|
||||||
|
|
||||||
|
The KSH version 5 effort is being spearheaded by Michael Rendell. Michael
|
||||||
|
took over the effort from Simon J. Gerraty who maintained the version 4
|
||||||
|
code. While the version 4 code was a good implementation of ksh
|
||||||
|
version 5 strives to continue the conformance to the actual posix
|
||||||
|
definitions and to AT&T ksh.
|
||||||
|
|
||||||
|
For my version 5 port to os/2, I originally started with the 4.9 os/2
|
||||||
|
changes and applied them to the new version. Subsequently many changes
|
||||||
|
have been made so that there is little resemblance to that version.
|
||||||
|
One of my goals for version 5 is to make ksh not only and interactive
|
||||||
|
shell, but one that can run some limited Unix(tm) shell scripts as well.
|
||||||
|
|
||||||
|
Generally the two shells behave the same. Version 5 has no logout script
|
||||||
|
(This can be set up using a trap in your profile.ksh file if desired.) and
|
||||||
|
the option 'hashall' has been replaced with 'trackall'. (To see all of the
|
||||||
|
options use the command 'set -o'.) In addition the prompt has been changed
|
||||||
|
to conform with the at&t ksh shell instead of the csh like implemetation of
|
||||||
|
version 4. The '!' sign is used for the history number and $variable
|
||||||
|
substitutions can be used in the prompt. The commands generally behave more
|
||||||
|
consistently. For example bind now goes to standard out so it can be
|
||||||
|
redirected or piped. Arrays are now implemented as are almost all AT&T ksh
|
||||||
|
features plus a few more. The os/2 port provides file name completion that
|
||||||
|
is not case sensitive. The startup file kshrc.ksh is still supported, but
|
||||||
|
the way it works is slightly different.
|
||||||
|
|
||||||
|
OS2 IMPLEMENTATION VS. UNIX
|
||||||
|
|
||||||
|
The original OS/2 port was done by Kai Uwe Rommel. I have re-implemented
|
||||||
|
his ideas in this os/2 version. The os/2 version of ksh has been modified
|
||||||
|
to accept the standard os/2 conventions. Drive designations a:, etc., are
|
||||||
|
accepted and path separators in variables have been changed to ';'. In
|
||||||
|
addition either '/' or '\' can be used as a directory separator. The bind
|
||||||
|
command in emacs mode has been enhanced to accept function key and alt key
|
||||||
|
bindings. (To see what the alt key binding should be, use ^Q followed by
|
||||||
|
the key you are interested in. Replace the ^ alpha you see with ^0, typed
|
||||||
|
as two characters, in the bind command.) The cursor keys have been
|
||||||
|
implemented for command history for both emacs mode and vi insert mode.
|
||||||
|
Standard default stty settings are implemented for both modes as well.
|
||||||
|
A os2 only print option, -f, can be used to force forward slashes in its
|
||||||
|
argument. This can be used to switch a variable containing '\' to
|
||||||
|
output '/' in a pipe to a unix command that doesn't like '\' as a path
|
||||||
|
separator, such as sed.
|
||||||
|
|
||||||
|
/ vs. \ processing
|
||||||
|
|
||||||
|
The remapping of certain keys can lead to some confusion for Unix and OS/2
|
||||||
|
users. The '\' key has a different meaning in Unix where it is used
|
||||||
|
to escape a special meaning for the character following it or in the
|
||||||
|
case of the echo (typeset) command it provides special meanings to
|
||||||
|
certain characters. At the end of a line the '\' is used to escape the
|
||||||
|
line feed permitting a command to extend to multiple lines. In OS/2
|
||||||
|
this key is generally the directory name separator. To provide for
|
||||||
|
both functions in the OS/2 pdksh the '\' is defined to be a directory
|
||||||
|
separator in any pathname specification and will keep its escape
|
||||||
|
meaning when it is followed by any non-alphanumeric character. The
|
||||||
|
echo command retains its special interpretation of '\' and will, for
|
||||||
|
example, interpret \t as a tab when printing. This can be
|
||||||
|
disconcerting when you echo the variable that you just set to c:\tmp.
|
||||||
|
If you want to use echo on a variable with pathnames in it you should
|
||||||
|
either use uppercase names or a '/' as a separator. Another choice is
|
||||||
|
to alias echo to 'print -r' or perhaps 'echo -E'. This will disable
|
||||||
|
the special interpretaions. You could even use the new 'print -f' to
|
||||||
|
force any '\' to switch to '/', but this is less portable. If you have
|
||||||
|
loaded the printenv command it can be used to look at variables.
|
||||||
|
|
||||||
|
Unix uses '/' as a directory separator and the OS/2 implementation
|
||||||
|
permits and in some cases prefers this use as well. Generally you
|
||||||
|
can freely mix '/' and '\' characters in a pathname. However, 'cd \'
|
||||||
|
will not complete since '\' will escape the new line command and you
|
||||||
|
will get the secondary prompt. Just enter a / and the command will
|
||||||
|
complete. For many standard os/2 commands the '/' is used to indicate an
|
||||||
|
option and may want a '\' as a path separator. These will still work and
|
||||||
|
be correctly interpreted with pdksh as long as a '/' is not attached
|
||||||
|
directly to the command name. Just be sure and enter the syntax needed
|
||||||
|
by the command you are trying to execute.
|
||||||
|
|
||||||
|
While backslash processing is usually correct and automatic there are times
|
||||||
|
when it doesn't do what you might expect. For example ls \tmp\*.exe might
|
||||||
|
surprise you. In this case the '\' will be interpreted as an escape for
|
||||||
|
the '*' character. You may need quotes or several backslashes to get what
|
||||||
|
you want. Beginning with 5.2.4 the output of ksh favors '/' for any
|
||||||
|
generated pathnames. This is intended to make script processing for
|
||||||
|
unix scripts easier. Unfortunately, this may make interactive use for
|
||||||
|
os2 users that prefer the '\' key a little less desirable. Should you
|
||||||
|
prefer the earlier convention then you can rebuild the executable from
|
||||||
|
the sources. Only one change in sh.h, DIRSEP, controls this behavior.
|
||||||
|
|
||||||
|
; vs. : processing
|
||||||
|
|
||||||
|
Another conflict is the use of ':' and ';'. Unix uses ':' to separate
|
||||||
|
entries in variable assignment and ';' to indicate multiple commands
|
||||||
|
on the same line. OS/2 uses the ';' to separate entries in a variable.
|
||||||
|
This could lead to problems when making an assignment to a variable in
|
||||||
|
pdksh. You will need to escape the ';' in OS/2 to prevent the shell
|
||||||
|
from interpreting it as the end of the command. Either surround the
|
||||||
|
assignment command with quotes or use '\;'. Note that since a ';' is
|
||||||
|
not a valid filename or pathname character the '\' will be correctly
|
||||||
|
interpreted as an escape character.
|
||||||
|
|
||||||
|
Since having to escape the ';' character can be a pain when changing
|
||||||
|
environmental variables containing a list of paths there are some functions
|
||||||
|
defined in the sample kshrc.ksh file to ease this task. There are three
|
||||||
|
functions; add_path, pre_path, and del_path that can be used to append a
|
||||||
|
path, prepend a path or delete a path from any environmental variable (PATH
|
||||||
|
by default). If you needed to add a path to /emx/bin you might do "add_path
|
||||||
|
e:\emx\bin" for example, or perhaps "add_path e:\emx\book BOOKSHELF" to add
|
||||||
|
some books to the bookshelf. Note that you will need a copy of sed in your
|
||||||
|
search path to use the del_path function.
|
||||||
|
|
||||||
|
In OS/2 the ':' is used to separate the drive letter from the rest of
|
||||||
|
the pathname. This usage had been preserved in pdksh. You can imbed
|
||||||
|
the drive letter as needed in pathnames. In addition pdksh preserves
|
||||||
|
the notion of separate contexts for each drive. To change drives you
|
||||||
|
would use the cd command. "cd A:/" would change to the root on drive
|
||||||
|
A while "cd C:." would change to whatever was current context on drive
|
||||||
|
C. Some aliases are defined in the sample kshrc.ksh to permit the
|
||||||
|
usual A: to automatically do a change directory to the A drive.
|
||||||
|
|
||||||
|
Wildcard Processing
|
||||||
|
|
||||||
|
OS/2 and pdksh have similar notions about wildcard characters '*' and
|
||||||
|
'?' except that pdksh handles the expansion of these wildcard within
|
||||||
|
the shell and then passes the answer as a list to the application. If
|
||||||
|
the application needs to see the wildcard character then you must
|
||||||
|
escape it from the shell. Note that pdksh knows about other wildcard
|
||||||
|
techniques as well. Please see the man page.
|
||||||
|
|
||||||
|
Background Processing
|
||||||
|
|
||||||
|
Do to some limitations in the os2 fork process and other differences
|
||||||
|
between os2 and unix it is not possible to support back-grounding from
|
||||||
|
pdksh of commands that begin a new window. For this reason I have
|
||||||
|
automatically backgrounded all such tasks when they are started. This
|
||||||
|
will permit the os2 ksh to serve as a command line launch mechanism for
|
||||||
|
dos, full screen, and pm applications. (Note that currently ksh can only
|
||||||
|
launch an application of the same type (windowed, or fullscreen) that
|
||||||
|
ksh itself is unless you use the 'start' alias.
|
||||||
|
|
||||||
|
There is a 'start' alias defined in the sample kshrc.ksh file that can
|
||||||
|
be used to start normal command line commands in a new window. For example
|
||||||
|
you could say "start ksh" to start a copy of ksh itself in a new window.
|
||||||
|
Since it is a new window it will automatically return control to the existing
|
||||||
|
copy of ksh. Note that the start alias uses the os2 start command so
|
||||||
|
you could supply it with any standard start option such as /FS to force
|
||||||
|
a full screen copy. Please check your os2 command reference manual for
|
||||||
|
further information on start.
|
||||||
|
|
||||||
|
PDKSH, OS/2 and the ENVIRONMENT.
|
||||||
|
|
||||||
|
The environment in OS/2 and Unix are quite different. For one thing
|
||||||
|
you don't actually login to your machine in OS/2 and your initial
|
||||||
|
environment is established by your CONFIG.SYS file. The Shell will use
|
||||||
|
the variables that were set in CONFIG.SYS and you should really
|
||||||
|
consider assigning TMPDIR and HOME for use by pdksh. It will also use
|
||||||
|
ENV as a variable that names a startup file that will run each time
|
||||||
|
the shell is started, even if a script is started. This start up file
|
||||||
|
is located in your home directory. For compatability with 4.9 this
|
||||||
|
shell will also automatically use a startup shell kshrc.ksh if it
|
||||||
|
finds one in your home directory, is started interactively, and $ENV
|
||||||
|
is not set.
|
||||||
|
|
||||||
|
The variable OS2_SHELL should point to cmd.exe or a fully compatible
|
||||||
|
version and will be used as the shell of choice for any scripts that you
|
||||||
|
write that do not contain the #! or extproc information in the top line
|
||||||
|
of the script. If you prefer you can set the variable EXECSHELL to a
|
||||||
|
shell to be used instead of OS2_SHELL. The use of OS2_SHELL assumes that
|
||||||
|
the shell requires the /c option and that the shell needs all pathnames
|
||||||
|
separated with '\'. Setting EXECSHELL will disable both of these
|
||||||
|
assumptions.
|
||||||
|
|
||||||
|
A special feature is the support of the -l, login option. If this option is
|
||||||
|
entered when starting ksh then the shell will execute a loginfile called
|
||||||
|
profile.ksh if located in $INIT/etc, c:/usr/etc, or your home. If you are
|
||||||
|
using this shell as your primary shell you may wish to change the settings
|
||||||
|
in your os2 command shell notebook to call ksh.exe -l. I would not
|
||||||
|
recommend changing the default shell in config.sys.
|
||||||
|
|
||||||
|
Should you destroy your PATH variable try 'unset PATH'. A default
|
||||||
|
path may get you going again. In addition pdksh for OS/2 always uses
|
||||||
|
commands from current context first in the search path even if it is
|
||||||
|
not explicitly set. By default c: drive is used when no variables
|
||||||
|
are set. Specifically c:/usr/bin and c:/usr/etc can be used as defaults
|
||||||
|
various places in ksh. If you build your own version then this can be
|
||||||
|
changed.
|
||||||
|
|
||||||
|
Generally all of the environmental variables described in the man page will
|
||||||
|
work in OS2 so long as the tools in use understand them in the same way
|
||||||
|
as Unix would.
|
||||||
|
|
||||||
|
Using KSH
|
||||||
|
|
||||||
|
The shell itself can be called any name you wish. Good names include
|
||||||
|
pdksh.exe, ksh.exe, sh.exe. You can build two completely different
|
||||||
|
shells using the options file. A full blown Korn shell can be built
|
||||||
|
or a complete subset that behaves very much like a Bourne shell. The
|
||||||
|
smaller version is excellent for script support. In the run time
|
||||||
|
release I have provided the full shell under the name ksh.exe and the
|
||||||
|
smaller version under the name sh.exe. Be careful with names like
|
||||||
|
rksh.exe or you could end up with a restricted shell that can't do
|
||||||
|
everything.
|
||||||
|
|
||||||
|
In Unix an executable can be tagged with an attribute to
|
||||||
|
make it known to the system as an executable. In OS/2 this is done
|
||||||
|
with an extension. This shell knows all of the standard OS/2
|
||||||
|
extensions plus .ksh and .sh. (Yes it can run dos commands and OS/2 command
|
||||||
|
files as well.) The .ksh or .sh extension tells the shell that this is an
|
||||||
|
executable shell script. The current version will also treat a file
|
||||||
|
without an extension as an executable in the style of Unix. Scripts need not
|
||||||
|
necessarily be a ksh shell scripts however. The standard Unix #! line at
|
||||||
|
the top of the file determines the actual shell that will be used to run
|
||||||
|
the script. A feature in this release is that any Unix absolute
|
||||||
|
pathnames will be tried and, if they fail a second try will be made by
|
||||||
|
stripping the path from the #! line since Unix style paths are unlikely
|
||||||
|
to match os2 usage. Your standard PATH search path will be used.
|
||||||
|
Should the same filename with a different extension exist in the same
|
||||||
|
directory pdksh will use the extension typed in by the user or if
|
||||||
|
no extension is entered then the search order is, .ksh, .exe, no extension,
|
||||||
|
.sh, .cmd, .com, .bat. This search order permits ksh scripts to be used to
|
||||||
|
modify binary executable behavior while allowing the -Zexe option for emx
|
||||||
|
gcc. . Note that if you explicitly type the extension yourself then any
|
||||||
|
extension can be used so long as the #! processing line is at the top of
|
||||||
|
the file to let pdksh know what to do.
|
||||||
|
|
||||||
|
The sample kshrc.ksh file that comes with the distribution can be used as
|
||||||
|
an example that shows you how to create aliases that will simulate the
|
||||||
|
standard OS/2 commands. This means you can still use copy, dir, and del if
|
||||||
|
you want to. Keyboard bindings supplied will still provide the command
|
||||||
|
stack and suddenly you also have command line completion and alias
|
||||||
|
capability. To get the most from the shell you will probably want the set
|
||||||
|
of Unix commands developed by the Gnu team and ported to os2. You will
|
||||||
|
most certainly need them or a similar set if you want to run any Unix
|
||||||
|
scripts. A few functions are also provided in the sample kshrc.ksh file to
|
||||||
|
demonstrate the power of functions and to ease common tasks.
|
||||||
|
|
||||||
|
Unix file systems are case sensitive and ksh generally expects this also.
|
||||||
|
This means that internal commands as well as aliases are case sensitive.
|
||||||
|
You can use this to your advantage. For example you might want to run a dos
|
||||||
|
shell only to find out that 'command' is captured as an internal command by
|
||||||
|
ksh. Try 'COMMAND' or even 'Command' and you will get what you wanted.
|
||||||
|
The file name completion and wild card expansion has been modified for os2
|
||||||
|
to permit it to ignore case.
|
||||||
|
|
||||||
|
Working with Editing Modes
|
||||||
|
|
||||||
|
As delivered ksh for os2 supports three different editing modes to use
|
||||||
|
with the command line. By default the editing mode is the same as that
|
||||||
|
used in cmd.exe in that F1, F2, and F3 can be used to edit the previous
|
||||||
|
command. Left and right cursor keys can also be used to edit the command.
|
||||||
|
Support for this comes directly from the emx layer. The history mechanism
|
||||||
|
is supported in this mode but you will not be able to scroll trhough
|
||||||
|
history from the command line. Pdksh commands exist to display and edit
|
||||||
|
history and the EDITOR environmental variable can be set to specify the
|
||||||
|
editor you want. Two other mutually exclusive editing modes exist as well.
|
||||||
|
|
||||||
|
The sample kshrc.ksh file turns on emacs editing mode. In this mode
|
||||||
|
pdksh emulates the commands and keyboard binding present in emacs. The
|
||||||
|
keyboard binding is fully customizable by the user using the bind command.
|
||||||
|
For os2 the default build includes support of the cursor keys to edit
|
||||||
|
both current and previous commands. The sample kshrc.ksh file includes
|
||||||
|
some further mapping as examples of keyboard binding. The bind -m
|
||||||
|
command can be used to define special macro commands. Note that in emacs
|
||||||
|
the ESC key following by a letter key is usually synonymous with holding
|
||||||
|
down the ALT key and pressing a letter key. In the current os2 implementation
|
||||||
|
these keys are not tied together so they could be programmed independantly
|
||||||
|
although this could be confusing for the user. This may change in the
|
||||||
|
future.
|
||||||
|
|
||||||
|
Issuing the command 'set -o vi' turns on vi mode. This mode emulates the
|
||||||
|
keyboard binding from the vi editor. In addition using the tab key for
|
||||||
|
command line completion is separately programmable using the set command.
|
||||||
|
For os2 the cursor keys are also set up to work from within insert mode to
|
||||||
|
allow editing of both the current and previous commands without ever
|
||||||
|
leaving insert mode. The Esc Shft-A sequence can be used to jump to the end
|
||||||
|
of the line allowing you to append new information to the line. CTRL-X,
|
||||||
|
CTRL-E and CTRL-F permit command line completion within insert mode. Thus
|
||||||
|
you can use vi mode without ever having to learn traditional vi commands.
|
||||||
|
|
||||||
|
SHELL SCRIPT PROGRAMMING
|
||||||
|
|
||||||
|
One of my goals in porting this shell was to be able to do shell level
|
||||||
|
script programming and to run Unix shell scripts with minimal modification.
|
||||||
|
The first goal is easy and fully functional in this release. You can write
|
||||||
|
shell scripts for this or other shells. The name of the shell you want to
|
||||||
|
run the script is entered in the first line of the script itself after a
|
||||||
|
'#!' sequence. If you only enter the name of the command then pdksh will
|
||||||
|
use your search path to find the shell. This is the recommended approach,
|
||||||
|
however absolute paths of the form /bin/ etc. will be stripped
|
||||||
|
automatically if needed to permit running Unix scripts unmodified. To write
|
||||||
|
portable scripts use the 'uname' command from Gnu to set a variable that
|
||||||
|
can be checked for specialized approaches. As a special case absoulte
|
||||||
|
paths using '\' will not be stripped and an error will be generated if
|
||||||
|
the command is not found at the exact path specified.
|
||||||
|
|
||||||
|
It is even possible to use ksh as a scripting language when your main
|
||||||
|
shell is a standard OS/2 shell. To do this you would write your ksh
|
||||||
|
script as usual except that the first line in the script should read
|
||||||
|
'extproc ksh'. The script should be named with a '.cmd' extension so
|
||||||
|
that the OS/2 shell can find it. When the cmd.exe finds this line in
|
||||||
|
the file it will call ksh to process the script for you. A script
|
||||||
|
that is written this way can also be called directly from ksh. As a
|
||||||
|
matter of fact you could use this technique entirely for script
|
||||||
|
creation and name all your scripts with the .cmd extension. Pdksh
|
||||||
|
will honor 'extproc' exactly like the standard Unix '#!' processing.
|
||||||
|
|
||||||
|
Unlike Unix #! processing the OS2 cmd processing of an extproc header line
|
||||||
|
only passes the file name to the spawned process instead of the full
|
||||||
|
pathname. This is a bug in os2 IMHO since if you explicitely want a
|
||||||
|
certain path for the command you cannot guarantee it. The workaround was to
|
||||||
|
put the path in the extproc line and then shift the extra filename off the
|
||||||
|
argument list. For example my whatis.cmd file used to start like this.
|
||||||
|
|
||||||
|
extproc ksh c:/usr/bin/whatis.cmd
|
||||||
|
shift
|
||||||
|
|
||||||
|
You can still do this, but ksh will also search the path to find a copy
|
||||||
|
of the command, so this is no longer required. Of course, the copy that ksh
|
||||||
|
finds might not be the one you wanted but at least you can copy your cmd
|
||||||
|
files around without having to modify them. A side effect of this change
|
||||||
|
is that typing: "ksh whatis" will now search your path as well which does
|
||||||
|
change the standard behavior of ksh which some might construe as a feature!
|
||||||
|
|
||||||
|
The second goal of running Unix scripts with little or no modification is
|
||||||
|
much more difficult to achieve. Unix makes many assumptions about how the
|
||||||
|
system is set up which makes fully portable scripts difficult to accomplish
|
||||||
|
without the knowledge of the script internals. Many script assume the
|
||||||
|
presense of /dev/null and /tmp. (The emx layer provides an automatic map
|
||||||
|
for shell references to /dev/null and /dev/tty as of the 0.9a version and
|
||||||
|
pdksh also maps /dev/null to nul for the cases where emx doesn't see it
|
||||||
|
unless a /dev/null is present.) Some scripts assume /bin and certain
|
||||||
|
commands within /bin (usually cp and sh). Until I can figure out how to
|
||||||
|
make this more transparent you can simply make these directories on the
|
||||||
|
drive that you intend to run the script on. (Of course, you could also
|
||||||
|
modify the script.) Some scripts reset the PATH variable near the beginning
|
||||||
|
of the script. While you could copy a whole set of commands it is probably
|
||||||
|
easier to modify the script or use tvfs (more about tvfs later.) Another
|
||||||
|
standard "trick" in Bourne shell script programming is to modify IFS to
|
||||||
|
include a colon and then use the set command to parse a variable by setting
|
||||||
|
$1, $2, etc. In OS/2 this would need to be a ';'. For now you will have to
|
||||||
|
hand modify the script.
|
||||||
|
|
||||||
|
The latest release of ksh for os2 now supports multiple open files
|
||||||
|
using standard pdksh syntax. Note that error checking may not be
|
||||||
|
as complete as standard pdksh for some of this usage.
|
||||||
|
|
||||||
|
Of course Unix scripts expect the presence of Unix commands. You will
|
||||||
|
need to install a set of Unix utilities, Unix text processing
|
||||||
|
commands, and probably sed and a version of awk. I have created a
|
||||||
|
c:/usr directory on my system for Unix stuff. I have /usr/bin,
|
||||||
|
/usr/man, /usr/etc, /usr/home, and /usr/local. You could establish
|
||||||
|
even more, or perhaps less, Unix conformance. You will also need a ps
|
||||||
|
command. I use procs.exe which I renamed to ps.exe. Kill is a ksh
|
||||||
|
builtin.
|
||||||
|
|
||||||
|
RUNNING UNIX GNU CONFIGURE SCRIPTS.
|
||||||
|
|
||||||
|
A lot of people would like to use pdksh to permit them to run the
|
||||||
|
gnu automatic configure scripts. I am pleased to report that this
|
||||||
|
is possible using pdksh. However, I can't guarantee that the results
|
||||||
|
will match the true configuration for os2 since this is dependant on
|
||||||
|
the way the individual configure scripts are written.
|
||||||
|
|
||||||
|
To set up to run configure scripts you will need to have a copy of pdksh
|
||||||
|
called sh.exe somewhere in your path and, of course, you should be
|
||||||
|
running within a pdksh shell. One of the very early things done
|
||||||
|
by most configure scripts is to figure out the compiler. This will fail
|
||||||
|
since it depends on setting the IFS (see the above discussion). To
|
||||||
|
workaround this problem simply set CC to the compiler you want to use
|
||||||
|
prior to running the script. For example to use gcc: 'export CC=gcc'.
|
||||||
|
Most configure scripts couldn't figure out the names of os2 compilers
|
||||||
|
anyway. Now you should be able to simply type 'configure' and watch it
|
||||||
|
work. At some point the configure script will build a config.status
|
||||||
|
script to perform the final step. If this is not run using 'sh -c
|
||||||
|
config.status' or some such it will fail since .status is not an os2
|
||||||
|
legal executable suffix. You can run it manually however by typing
|
||||||
|
'ksh config.status'. If you have problems you should inspect the
|
||||||
|
config.status script and fix it as required. Using ksh -x config.status
|
||||||
|
will echo the lines as they are executed which should aid in debug.
|
||||||
|
|
||||||
|
Many configure scripts actually build and execute programs to test
|
||||||
|
for certain features. In OS2 using emx, the final link step must have
|
||||||
|
the .exe extension tied to the executable name or the linker will not
|
||||||
|
link correctly. You will need to modify the configure script to
|
||||||
|
insure the correct executable name. Once this is built it can be
|
||||||
|
renamed to a name without an extension if ksh is being used to run it.
|
||||||
|
A line similar to the following may work for you if you are using 2.0:
|
||||||
|
|
||||||
|
ac_link='${CC-cc} -o conftest.exe $CFLAGS $CPPFLAGS $LDFLAGS \
|
||||||
|
conftest.$ac_ext $LIBS && mv conftest.exe conftest'
|
||||||
|
|
||||||
|
This trick takes advantage of ksh's ability to run a command without an
|
||||||
|
extension. Even with these changes you may still find that configure does
|
||||||
|
not correctly identify some os2 features. I would recommend that the
|
||||||
|
config.cache file be edited as required or the resulting config.h file.
|
||||||
|
|
||||||
|
Another trick is to use the -Zexe option to gcc. This builds a zero length
|
||||||
|
file without an extension and the real executable with the extension .exe.
|
||||||
|
Makefiles and some configure scripts may be fooled by this behavior.
|
||||||
|
|
||||||
|
TVFS
|
||||||
|
|
||||||
|
An IBM employee written program called tvfs, toronto virtual file system,
|
||||||
|
can be downloaded from most os2 ftp sites and from IBM ftp sites. This
|
||||||
|
program permits you to simulate a Unix like file system that can span
|
||||||
|
physical drives and even network drives. Using tvfs you cd once into the
|
||||||
|
drive letter designated as the tvfs drive and from then on you can
|
||||||
|
reference all of your drives and directories by only using Unix style
|
||||||
|
pathnames if you wish. Even a limited form of symbolic links can be set
|
||||||
|
up on this drive. This can be a great aid in running Unix scripts and
|
||||||
|
makefiles as well as configure scripts.
|
||||||
|
|
||||||
|
WORK IN PROGRESS
|
||||||
|
|
||||||
|
There is still much to do and this project will probably never be complete.
|
||||||
|
The configure.cmd file needs work as does the Makefile. Please let me know
|
||||||
|
if you get this to compile using a C compiler other than gcc. The standard
|
||||||
|
defaults work in the Makefile but many other things are not implemented.
|
||||||
|
And of course there are bugs to fix and enhancements to be made. Check the
|
||||||
|
file os2bugs in the run time release for the latest information on bugs.
|
||||||
|
|
||||||
|
Please let me know if you like this port, have found a porting bug,
|
||||||
|
have fixed a bug, or have coded a spiffy enhancement. Michael Rendell
|
||||||
|
should be consulted for general pdksh items and is now actually
|
||||||
|
maintaining and enhancing all of the code. Please check the standard
|
||||||
|
README for more information and also the file os2bugs for current known
|
||||||
|
problems and limitations. I can be reached at daled@cadence.com.
|
||||||
|
|
||||||
|
Note that this is a home brew project and is in no way related to my
|
||||||
|
employment.
|
||||||
|
|
||||||
|
Dale DePriest
|
||||||
|
|
91
os2/config.cache
Normal file
91
os2/config.cache
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
# This file is a shell script that caches the results of configure
|
||||||
|
# tests run on this system so they can be shared between configure
|
||||||
|
# scripts and configure runs. It is not useful on other systems.
|
||||||
|
# If it contains results you don't want to keep, you may remove or edit it.
|
||||||
|
#
|
||||||
|
# By default, configure uses ./config.cache as the cache file,
|
||||||
|
# creating it if it does not exist already. You can give configure
|
||||||
|
# the --cache-file=FILE option to use a different cache file; that is
|
||||||
|
# what configure does when it calls configure scripts in
|
||||||
|
# subdirectories, so they share the cache.
|
||||||
|
# Giving --cache-file=/dev/null disables caching, for debugging configure.
|
||||||
|
# config.status only pays attention to the cache file if you give it the
|
||||||
|
# --recheck option to rerun configure.
|
||||||
|
#
|
||||||
|
ac_cv_c_const=${ac_cv_c_const='yes'}
|
||||||
|
ac_cv_c_cross=${ac_cv_c_cross='no'}
|
||||||
|
ac_cv_decl_sys_siglist=${ac_cv_decl_sys_siglist='no'}
|
||||||
|
ac_cv_func_confstr=${ac_cv_func_confstr='no'}
|
||||||
|
ac_cv_func_flock=${ac_cv_func_flock='yes'}
|
||||||
|
ac_cv_func_getwd=${ac_cv_func_getwd='no'}
|
||||||
|
ac_cv_func_killpg=${ac_cv_func_killpg='no'}
|
||||||
|
ac_cv_func_mmap=${ac_cv_func_mmap='no'}
|
||||||
|
ac_cv_func_nice=${ac_cv_func_nice='no'}
|
||||||
|
ac_cv_func_setrlimit=${ac_cv_func_setrlimit='no'}
|
||||||
|
ac_cv_func_sigsetjmp=${ac_cv_func_sigsetjmp='yes'}
|
||||||
|
ac_cv_func_strcasecmp=${ac_cv_func_strcasecmp='no'}
|
||||||
|
ac_cv_func_strerror=${ac_cv_func_strerror='yes'}
|
||||||
|
ac_cv_func_strstr=${ac_cv_func_strstr='yes'}
|
||||||
|
ac_cv_func_sysconf=${ac_cv_func_sysconf='yes'}
|
||||||
|
ac_cv_func_tcsetpgrp=${ac_cv_func_tcsetpgrp='yes'}
|
||||||
|
ac_cv_func_ulimit=${ac_cv_func_ulimit='yes'}
|
||||||
|
ac_cv_func_wait3=${ac_cv_func_wait3='no'}
|
||||||
|
ac_cv_func_waitpid=${ac_cv_func_waitpid='yes'}
|
||||||
|
ac_cv_header_dirent_dirent_h=${ac_cv_header_dirent_dirent_h='yes'}
|
||||||
|
ac_cv_header_fcntl_h=${ac_cv_header_fcntl_h='yes'}
|
||||||
|
ac_cv_header_limits_h=${ac_cv_header_limits_h='yes'}
|
||||||
|
ac_cv_header_memory_h=${ac_cv_header_memory_h='yes'}
|
||||||
|
ac_cv_header_paths_h=${ac_cv_header_paths_h='no'}
|
||||||
|
ac_cv_header_stat_broken=${ac_cv_header_stat_broken='no'}
|
||||||
|
ac_cv_header_stddef_h=${ac_cv_header_stddef_h='yes'}
|
||||||
|
ac_cv_header_stdlib_h=${ac_cv_header_stdlib_h='yes'}
|
||||||
|
ac_cv_header_string_h=${ac_cv_header_string_h='yes'}
|
||||||
|
ac_cv_header_sys_param_h=${ac_cv_header_sys_param_h='yes'}
|
||||||
|
ac_cv_header_sys_resource_h=${ac_cv_header_sys_resource_h='yes'}
|
||||||
|
ac_cv_header_sys_time_h=${ac_cv_header_sys_time_h='yes'}
|
||||||
|
ac_cv_header_time=${ac_cv_header_time='yes'}
|
||||||
|
ac_cv_header_ulimit_h=${ac_cv_header_ulimit_h='no'}
|
||||||
|
ac_cv_header_values_h=${ac_cv_header_values_h='no'}
|
||||||
|
ac_cv_lib_dir=${ac_cv_lib_dir='no'}
|
||||||
|
ac_cv_path_install=${ac_cv_path_install=''./install-sh -c''}
|
||||||
|
ac_cv_prog_CC=${ac_cv_prog_CC='gcc'}
|
||||||
|
ac_cv_prog_CPP=${ac_cv_prog_CPP=''gcc -E''}
|
||||||
|
ac_cv_prog_gcc=${ac_cv_prog_gcc='yes'}
|
||||||
|
ac_cv_prog_gcc_g=${ac_cv_prog_gcc_g='yes'}
|
||||||
|
ac_cv_prog_gcc_traditional=${ac_cv_prog_gcc_traditional='no'}
|
||||||
|
ac_cv_sizeof_int=${ac_cv_sizeof_int='4'}
|
||||||
|
ac_cv_sizeof_long=${ac_cv_sizeof_long='4'}
|
||||||
|
ac_cv_struct_st_rdev=${ac_cv_struct_st_rdev='yes'}
|
||||||
|
ac_cv_sys_interpreter=${ac_cv_sys_interpreter='no'}
|
||||||
|
ac_cv_type_clock_t=${ac_cv_type_clock_t='yes'}
|
||||||
|
ac_cv_type_getgroups=${ac_cv_type_getgroups='gid_t'}
|
||||||
|
ac_cv_type_mode_t=${ac_cv_type_mode_t='yes'}
|
||||||
|
ac_cv_type_off_t=${ac_cv_type_off_t='yes'}
|
||||||
|
ac_cv_type_pid_t=${ac_cv_type_pid_t='yes'}
|
||||||
|
ac_cv_type_rlim_t=${ac_cv_type_rlim_t='no'}
|
||||||
|
ac_cv_type_signal=${ac_cv_type_signal='void'}
|
||||||
|
ac_cv_type_sigset_t=${ac_cv_type_sigset_t='yes'}
|
||||||
|
ac_cv_type_uid_t=${ac_cv_type_uid_t='yes'}
|
||||||
|
ksh_cv_c_func_attr=${ksh_cv_c_func_attr='yes'}
|
||||||
|
ksh_cv_c_prototypes=${ksh_cv_c_prototypes='yes'}
|
||||||
|
ksh_cv_c_void=${ksh_cv_c_void='yes'}
|
||||||
|
ksh_cv_c_volatile=${ksh_cv_c_volatile='yes'}
|
||||||
|
ksh_cv_decl_sys_errlist=${ksh_cv_decl_sys_errlist='no'}
|
||||||
|
ksh_cv_dev_fd=${ksh_cv_dev_fd='no'}
|
||||||
|
ksh_cv_dup2_clexec_broken=${ksh_cv_dup2_clexec_broken='no'}
|
||||||
|
ksh_cv_func_lstat=${ksh_cv_func_lstat='no'}
|
||||||
|
ksh_cv_func_memmove=${ksh_cv_func_memmove='yes'}
|
||||||
|
ksh_cv_func_memset=${ksh_cv_func_memset='yes'}
|
||||||
|
ksh_cv_func_times_broken=${ksh_cv_func_times_broken='no'}
|
||||||
|
ksh_cv_header_sys_wait_h=${ksh_cv_header_sys_wait_h='yes'}
|
||||||
|
ksh_cv_header_unistd=${ksh_cv_header_unistd='yes'}
|
||||||
|
ksh_cv_opendir_nondir=${ksh_cv_opendir_nondir='no'}
|
||||||
|
ksh_cv_os_type=${ksh_cv_os_type='OS2_EMX'}
|
||||||
|
ksh_cv_pgrp_check=${ksh_cv_pgrp_check='none'}
|
||||||
|
ksh_cv_rlim_check=${ksh_cv_rlim_check='long'}
|
||||||
|
ksh_cv_signal_check=${ksh_cv_signal_check='v7'}
|
||||||
|
ksh_cv_signal_retval=${ksh_cv_signal_retval=''}
|
||||||
|
ksh_cv_term_check=${ksh_cv_term_check='termio'}
|
||||||
|
ksh_cv_time_delcared=${ksh_cv_time_delcared='yes'}
|
||||||
|
ksh_cv_var_sys_errlist=${ksh_cv_var_sys_errlist='yes'}
|
||||||
|
ksh_cv_var_sys_siglist=${ksh_cv_var_sys_siglist='no'}
|
345
os2/config.h
Normal file
345
os2/config.h
Normal file
@ -0,0 +1,345 @@
|
|||||||
|
/* config.h. Generated automatically by configure. */
|
||||||
|
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||||
|
/*
|
||||||
|
* This file, acconfig.h, which is a part of pdksh (the public domain ksh),
|
||||||
|
* is placed in the public domain. It comes with no licence, warranty
|
||||||
|
* or guarantee of any kind (i.e., at your own risk).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
|
||||||
|
/* Define if on AIX 3.
|
||||||
|
System headers sometimes define this.
|
||||||
|
We just want to avoid a redefinition error message. */
|
||||||
|
#ifndef _ALL_SOURCE
|
||||||
|
/* #undef _ALL_SOURCE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if the closedir function returns void instead of int. */
|
||||||
|
/* #undef CLOSEDIR_VOID */
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if you have a working `mmap' system call. */
|
||||||
|
/* #undef HAVE_MMAP */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define if you have <unistd.h>. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if on MINIX. */
|
||||||
|
/* #undef _MINIX */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define if the system does not provide POSIX.1 features except
|
||||||
|
with this defined. */
|
||||||
|
/* #undef _POSIX_1_SOURCE */
|
||||||
|
|
||||||
|
/* Define if you need to in order for stat and other things to work. */
|
||||||
|
/* #undef _POSIX_SOURCE */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
|
||||||
|
/* #undef STAT_MACROS_BROKEN */
|
||||||
|
|
||||||
|
/* Define if `sys_siglist' is declared by <signal.h>. */
|
||||||
|
/* #undef SYS_SIGLIST_DECLARED */
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if the closedir function returns void instead of int. */
|
||||||
|
/* #undef VOID_CLOSEDIR */
|
||||||
|
|
||||||
|
/* Define if your kernal doesn't handle scripts starting with #! */
|
||||||
|
#define SHARPBANG 1
|
||||||
|
|
||||||
|
/* Define if dup2() preserves the close-on-exec flag (ultrix does this) */
|
||||||
|
/* #undef DUP2_BROKEN */
|
||||||
|
|
||||||
|
/* Define as the return value of signal handlers (0 or ). */
|
||||||
|
#define RETSIGVAL
|
||||||
|
|
||||||
|
/* Define if you have posix signal routines (sigaction(), et. al.) */
|
||||||
|
/* #undef POSIX_SIGNALS */
|
||||||
|
|
||||||
|
/* Define if you have BSD4.2 signal routines (sigsetmask(), et. al.) */
|
||||||
|
/* #undef BSD42_SIGNALS */
|
||||||
|
|
||||||
|
/* Define if you have BSD4.1 signal routines (sigset(), et. al.) */
|
||||||
|
/* #undef BSD41_SIGNALS */
|
||||||
|
|
||||||
|
/* Define if you have v7 signal routines (signal(), signal reset on delivery) */
|
||||||
|
#define V7_SIGNALS 1
|
||||||
|
|
||||||
|
/* Define to use the fake posix signal routines (sigact.[ch]) */
|
||||||
|
/* #define USE_FAKE_SIGACT 1 */
|
||||||
|
|
||||||
|
/* Define if signals don't interrupt read() */
|
||||||
|
/* #undef SIGNALS_DONT_INTERRUPT */
|
||||||
|
|
||||||
|
/* Define if you have bsd versions of the setpgrp() and getpgrp() routines */
|
||||||
|
/* #undef BSD_PGRP */
|
||||||
|
|
||||||
|
/* Define if you have POSIX versions of the setpgid() and getpgrp() routines */
|
||||||
|
/* #undef POSIX_PGRP */
|
||||||
|
|
||||||
|
/* Define if you have sysV versions of the setpgrp() and getpgrp() routines */
|
||||||
|
/* #undef SYSV_PGRP */
|
||||||
|
|
||||||
|
/* Define if you don't have setpgrp(), setpgid() or getpgrp() routines */
|
||||||
|
#define NO_PGRP 1
|
||||||
|
|
||||||
|
/* Define to char if your compiler doesn't like the void keyword */
|
||||||
|
/* #undef void */
|
||||||
|
|
||||||
|
/* Define to nothing if compiler doesn't like the volatile keyword */
|
||||||
|
/* #undef volatile */
|
||||||
|
|
||||||
|
/* Define if C compiler groks function prototypes */
|
||||||
|
#define HAVE_PROTOTYPES 1
|
||||||
|
|
||||||
|
/* Define if C compiler groks __attribute__((...)) (const, noreturn, format) */
|
||||||
|
#define HAVE_GCC_FUNC_ATTR 1
|
||||||
|
|
||||||
|
/* Define to 32-bit signed integer type if <sys/types.h> doesn't define */
|
||||||
|
/* #undef clock_t */
|
||||||
|
|
||||||
|
/* Define to the type of struct rlimit fields if the rlim_t type is missing */
|
||||||
|
#define rlim_t long
|
||||||
|
|
||||||
|
/* Define if time() is declared in <time.h> */
|
||||||
|
#define TIME_DECLARED 1
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <signal.h> doesn't define */
|
||||||
|
/* #undef sigset_t */
|
||||||
|
|
||||||
|
/* Define if sys_errlist[] and sys_nerr are in the C library */
|
||||||
|
#define HAVE_SYS_ERRLIST 1
|
||||||
|
|
||||||
|
/* Define if sys_errlist[] and sys_nerr are defined in <errno.h> */
|
||||||
|
/* #undef SYS_ERRLIST_DECLARED */
|
||||||
|
|
||||||
|
/* Define if sys_siglist[] is in the C library */
|
||||||
|
/* #undef HAVE_SYS_SIGLIST */
|
||||||
|
|
||||||
|
/* Define if you have a sane <termios.h> header file */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have a memset() function in your C library */
|
||||||
|
#define HAVE_MEMSET 1
|
||||||
|
|
||||||
|
/* Define if you have a memmove() function in your C library */
|
||||||
|
#define HAVE_MEMMOVE 1
|
||||||
|
|
||||||
|
/* Define if you have a bcopy() function in your C library */
|
||||||
|
/* #undef HAVE_BCOPY */
|
||||||
|
|
||||||
|
/* Define if you have a lstat() function in your C library */
|
||||||
|
/* #undef HAVE_LSTAT */
|
||||||
|
|
||||||
|
/* Define if you have a sane <termio.h> header file */
|
||||||
|
#define HAVE_TERMIO_H 1
|
||||||
|
|
||||||
|
/* Define if you don't have times() or if it always returns 0 */
|
||||||
|
/* #undef TIMES_BROKEN */
|
||||||
|
|
||||||
|
/* Define if opendir() will open non-directory files */
|
||||||
|
/* #undef OPENDIR_DOES_NONDIR */
|
||||||
|
|
||||||
|
/* Define if the pgrp of setpgrp() can't be the pid of a zombie process */
|
||||||
|
/* #undef NEED_PGRP_SYNC */
|
||||||
|
|
||||||
|
/* Define if you arg running SCO unix */
|
||||||
|
/* #undef OS_SCO */
|
||||||
|
|
||||||
|
/* Define if you arg running ISC unix */
|
||||||
|
/* #undef OS_ISC */
|
||||||
|
|
||||||
|
/* Define if you arg running OS2 with the EMX library */
|
||||||
|
#define OS2 1
|
||||||
|
|
||||||
|
/* Define if you have a POSIX.1 compatiable <sys/wait.h> */
|
||||||
|
#define POSIX_SYS_WAIT 1
|
||||||
|
|
||||||
|
/* Define if your OS maps references to /dev/fd/n to file descriptor n */
|
||||||
|
/* #undef HAVE_DEV_FD */
|
||||||
|
|
||||||
|
/* Default PATH (see comments in configure.in for more details) */
|
||||||
|
#define DEFAULT_PATH "c:/usr/bin;c:/os2;/os2"
|
||||||
|
|
||||||
|
/* Include ksh features? (see comments in configure.in for more details) */
|
||||||
|
#define KSH 1
|
||||||
|
|
||||||
|
/* Include emacs editing? (see comments in configure.in for more details) */
|
||||||
|
#define EMACS 1
|
||||||
|
|
||||||
|
/* Include vi editing? (see comments in configure.in for more details) */
|
||||||
|
#define VI 1
|
||||||
|
|
||||||
|
/* Include job control? (see comments in configure.in for more details) */
|
||||||
|
#define JOBS 1
|
||||||
|
|
||||||
|
/* Include brace-expansion? (see comments in configure.in for more details) */
|
||||||
|
#define BRACE_EXPAND 1
|
||||||
|
|
||||||
|
/* Include any history? (see comments in configure.in for more details) */
|
||||||
|
#define HISTORY 1
|
||||||
|
|
||||||
|
/* Include complex history? (see comments in configure.in for more details) */
|
||||||
|
/* #undef COMPLEX_HISTORY */
|
||||||
|
|
||||||
|
/* Strict POSIX behaviour? (see comments in configure.in for more details) */
|
||||||
|
/* #undef POSIXLY_CORRECT */
|
||||||
|
|
||||||
|
/* Specify default $ENV? (see comments in configure.in for more details) */
|
||||||
|
/* #undef DEFAULT_ENV */
|
||||||
|
|
||||||
|
/* Include shl(1) support? (see comments in configure.in for more details) */
|
||||||
|
/* #undef SWTCH */
|
||||||
|
|
||||||
|
/* Include game-of-life? (see comments in configure.in for more details) */
|
||||||
|
/* #undef SILLY */
|
||||||
|
|
||||||
|
/* The number of bytes in a int. */
|
||||||
|
#define SIZEOF_INT 4
|
||||||
|
|
||||||
|
/* The number of bytes in a long. */
|
||||||
|
#define SIZEOF_LONG 4
|
||||||
|
|
||||||
|
/* Define if you have the _setjmp function. */
|
||||||
|
/* #undef HAVE__SETJMP */
|
||||||
|
|
||||||
|
/* Define if you have the confstr function. */
|
||||||
|
/* #undef HAVE_CONFSTR */
|
||||||
|
|
||||||
|
/* Define if you have the flock function. */
|
||||||
|
#define HAVE_FLOCK 1
|
||||||
|
|
||||||
|
/* Define if you have the getgroups function. */
|
||||||
|
/* #undef HAVE_GETGROUPS */
|
||||||
|
|
||||||
|
/* Define if you have the getrusage function. */
|
||||||
|
/* #undef HAVE_GETRUSAGE */
|
||||||
|
|
||||||
|
/* Define if you have the getwd function. */
|
||||||
|
/* #undef HAVE_GETWD */
|
||||||
|
|
||||||
|
/* Define if you have the killpg function. */
|
||||||
|
/* #undef HAVE_KILLPG */
|
||||||
|
|
||||||
|
/* Define if you have the nice function. */
|
||||||
|
/* #undef HAVE_NICE */
|
||||||
|
|
||||||
|
/* Define if you have the setrlimit function. */
|
||||||
|
/* #undef HAVE_SETRLIMIT */
|
||||||
|
|
||||||
|
/* Define if you have the sigsetjmp function. */
|
||||||
|
#define HAVE_SIGSETJMP 1
|
||||||
|
|
||||||
|
/* Define if you have the strcasecmp function. */
|
||||||
|
/* #undef HAVE_STRCASECMP */
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the sysconf function. */
|
||||||
|
#define HAVE_SYSCONF 1
|
||||||
|
|
||||||
|
/* Define if you have the tcsetpgrp function. */
|
||||||
|
#define HAVE_TCSETPGRP 1
|
||||||
|
|
||||||
|
/* Define if you have the ulimit function. */
|
||||||
|
#define HAVE_ULIMIT 1
|
||||||
|
|
||||||
|
/* Define if you have the wait3 function. */
|
||||||
|
/* #undef HAVE_WAIT3 */
|
||||||
|
|
||||||
|
/* Define if you have the waitpid function. */
|
||||||
|
#define HAVE_WAITPID 1
|
||||||
|
|
||||||
|
/* Define if you have the <dirent.h> header file. */
|
||||||
|
#define HAVE_DIRENT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <memory.h> header file. */
|
||||||
|
#define HAVE_MEMORY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <ndir.h> header file. */
|
||||||
|
/* #undef HAVE_NDIR_H */
|
||||||
|
|
||||||
|
/* Define if you have the <paths.h> header file. */
|
||||||
|
/* #undef HAVE_PATHS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <stddef.h> header file. */
|
||||||
|
#define HAVE_STDDEF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdlib.h> header file. */
|
||||||
|
#define HAVE_STDLIB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <string.h> header file. */
|
||||||
|
#define HAVE_STRING_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/dir.h> header file. */
|
||||||
|
/* #undef HAVE_SYS_DIR_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ndir.h> header file. */
|
||||||
|
/* #undef HAVE_SYS_NDIR_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/resource.h> header file. */
|
||||||
|
#define HAVE_SYS_RESOURCE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/wait.h> header file. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <ulimit.h> header file. */
|
||||||
|
/* #undef HAVE_ULIMIT_H */
|
||||||
|
|
||||||
|
/* Define if you have the <values.h> header file. */
|
||||||
|
/* #undef HAVE_VALUES_H */
|
||||||
|
|
||||||
|
/* Need to use a separate file to keep the configure script from commenting
|
||||||
|
* out the undefs....
|
||||||
|
*/
|
||||||
|
#include "conf-end.h"
|
||||||
|
|
||||||
|
#endif /* CONFIG_H */
|
2
os2/config.status
Normal file
2
os2/config.status
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
extproc ksh
|
||||||
|
echo Please run os2/configure.
|
111
os2/configure.cmd
Normal file
111
os2/configure.cmd
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
@echo off
|
||||||
|
if "%1" == "/h" goto help
|
||||||
|
if "%1" == "/?" goto help
|
||||||
|
if "%1" == "-h" goto help
|
||||||
|
set verbose=no
|
||||||
|
set debug=no
|
||||||
|
set ushell=ksh
|
||||||
|
:parse
|
||||||
|
if "%1" == "/v" goto verbose
|
||||||
|
if "%1" == "-v" goto verbose
|
||||||
|
if "%1" == "/d" goto gdebug
|
||||||
|
if "%1" == "-d" goto gdebug
|
||||||
|
if "%1" == "sh" goto usersh
|
||||||
|
if exist os2 goto start
|
||||||
|
echo You are in the wrong directory. Change to source directory.
|
||||||
|
echo Copy this file and run again or type os2\configure.
|
||||||
|
goto end
|
||||||
|
:verbose
|
||||||
|
set verbose=yes
|
||||||
|
shift
|
||||||
|
goto parse
|
||||||
|
:gdebug
|
||||||
|
set debug=yes
|
||||||
|
shift
|
||||||
|
goto parse
|
||||||
|
:usersh
|
||||||
|
if %verbose% == yes echo Configuring for Bourne shell.
|
||||||
|
set ushell=sh
|
||||||
|
:start
|
||||||
|
if exist conftest.c erase conftest.c
|
||||||
|
if exist confdefs.h erase confdefs.h
|
||||||
|
if %verbose% == yes echo Searching for sed
|
||||||
|
:::::for %%i in (%path%) do if exist %%i\sed.exe goto s_success
|
||||||
|
sed --version && goto s_success
|
||||||
|
echo No sed in search path. Copying Makefile for gcc. You will need
|
||||||
|
echo to edit it if you are not using standard defaults.
|
||||||
|
copy os2\Makefile Makefile
|
||||||
|
goto copystuff
|
||||||
|
:help
|
||||||
|
echo Run os2\configure to set up for os/2 compilation.
|
||||||
|
echo You must have current context in the source directory.
|
||||||
|
echo usage: configure [[/v^|-v][/d^|-d]^|/h^|-h^|/?] [sh]
|
||||||
|
echo where /v means verbose output
|
||||||
|
echo /d means compile with symbols (debug)
|
||||||
|
goto end
|
||||||
|
:s_success
|
||||||
|
if %verbose% == yes echo checking for compiler
|
||||||
|
for %%i in (%path%) do if exist %%i\gcc.exe goto g_success
|
||||||
|
gcc --version && goto g_success
|
||||||
|
rem for the future we'll use sed processing
|
||||||
|
for %%i in (%path%) do if exist %%i\bcc.exe goto b_success
|
||||||
|
for %%i in (%path%) do if exist %%i\icc.exe goto i_success
|
||||||
|
echo Compiler not found. Check your path
|
||||||
|
goto end
|
||||||
|
:b_success
|
||||||
|
echo Borland C compiler found. Configuration not complete for
|
||||||
|
echo this compiler. You may need to edit the Makefile
|
||||||
|
set CC=bcc
|
||||||
|
set CPP=cpp
|
||||||
|
goto createstuff
|
||||||
|
:i_success
|
||||||
|
echo IBM C compiler found. Configuration not complete for
|
||||||
|
echo this compiler. You may need to edit the Makefile.
|
||||||
|
set CC=icc -q -Sm -Gm -Gt -Spl -D__STDC__
|
||||||
|
set CPP=cpp
|
||||||
|
goto createstuff
|
||||||
|
:checkshell
|
||||||
|
if %ushell% == sh goto fixshell
|
||||||
|
goto copystuff
|
||||||
|
:g_success
|
||||||
|
echo GNU C compiler found. This is the standard configuration.
|
||||||
|
copy os2\Makefile Makefile
|
||||||
|
if %debug% == no goto checkshell
|
||||||
|
set CC=gcc -g
|
||||||
|
set CPP=cpp
|
||||||
|
:createstuff
|
||||||
|
echo Creating files for you.
|
||||||
|
echo s/@CC@/%CC%/> os2\make.tmp
|
||||||
|
echo s/@CPP@/%CPP%/>> os2\make.tmp
|
||||||
|
echo s/@LDFLAGS@/-O/>> os2\make.tmp
|
||||||
|
if %ushell% == ksh goto skipsh
|
||||||
|
:fixshell
|
||||||
|
echo s!/bin/sh!ksh!>> os2\make.tmp
|
||||||
|
echo s/@SHELL_PROG@/sh/>> os2\make.tmp
|
||||||
|
:skipsh
|
||||||
|
copy os2\make.tmp+os2\make.sed os2\make.tmp
|
||||||
|
sed -f os2\make.tmp Makefile.in > Makefile
|
||||||
|
del os2\make.tmp
|
||||||
|
:copystuff
|
||||||
|
if %verbose% == yes echo Copying config.h and config.status files.
|
||||||
|
copy os2\config.h config.h
|
||||||
|
touch config.h
|
||||||
|
copy os2\config.status config.status
|
||||||
|
if %verbose% == yes echo Checking for os2.c and th.cmd.
|
||||||
|
if not exist os2.c copy os2\os2.c os2.c
|
||||||
|
if not exist th.cmd copy os2\th.cmd th.cmd
|
||||||
|
if %ushell% == ksh goto end
|
||||||
|
if %verbose% == yes echo Fixing config.h for building sh.
|
||||||
|
echo #ifdef KSH>> config.h
|
||||||
|
echo #undef KSH>> config.h
|
||||||
|
echo #undef VI>> config.h
|
||||||
|
echo #undef EMACS>> config.h
|
||||||
|
echo #undef EDIT>> config.h
|
||||||
|
echo #undef COMPLEX_HISTORY>> config.h
|
||||||
|
echo #undef EASY_HISTORY>> config.h
|
||||||
|
echo #undef HISTORY>> config.h
|
||||||
|
echo #undef BRACE_EXPAND>>config.h
|
||||||
|
echo #endif>> config.h
|
||||||
|
:end
|
||||||
|
|
||||||
|
|
132
os2/emacs.out
Normal file
132
os2/emacs.out
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
* NOTE: THIS FILE WAS GENERATED AUTOMATICALLY FROM emacs.c
|
||||||
|
*
|
||||||
|
* DO NOT BOTHER EDITING THIS FILE
|
||||||
|
*/
|
||||||
|
#define XFUNC_abort 0
|
||||||
|
static int x_abort ARGS((int c));
|
||||||
|
#define XFUNC_beg_hist 1
|
||||||
|
static int x_beg_hist ARGS((int c));
|
||||||
|
#define XFUNC_comp_comm 2
|
||||||
|
static int x_comp_comm ARGS((int c));
|
||||||
|
#define XFUNC_comp_file 3
|
||||||
|
static int x_comp_file ARGS((int c));
|
||||||
|
#define XFUNC_complete 4
|
||||||
|
static int x_complete ARGS((int c));
|
||||||
|
#define XFUNC_del_back 5
|
||||||
|
static int x_del_back ARGS((int c));
|
||||||
|
#define XFUNC_del_bword 6
|
||||||
|
static int x_del_bword ARGS((int c));
|
||||||
|
#define XFUNC_del_char 7
|
||||||
|
static int x_del_char ARGS((int c));
|
||||||
|
#define XFUNC_del_fword 8
|
||||||
|
static int x_del_fword ARGS((int c));
|
||||||
|
#define XFUNC_del_line 9
|
||||||
|
static int x_del_line ARGS((int c));
|
||||||
|
#define XFUNC_draw_line 10
|
||||||
|
static int x_draw_line ARGS((int c));
|
||||||
|
#define XFUNC_end_hist 11
|
||||||
|
static int x_end_hist ARGS((int c));
|
||||||
|
#define XFUNC_end_of_text 12
|
||||||
|
static int x_end_of_text ARGS((int c));
|
||||||
|
#define XFUNC_enumerate 13
|
||||||
|
static int x_enumerate ARGS((int c));
|
||||||
|
#define XFUNC_eot_del 14
|
||||||
|
static int x_eot_del ARGS((int c));
|
||||||
|
#define XFUNC_error 15
|
||||||
|
static int x_error ARGS((int c));
|
||||||
|
#define XFUNC_goto_hist 16
|
||||||
|
static int x_goto_hist ARGS((int c));
|
||||||
|
#define XFUNC_ins_string 17
|
||||||
|
static int x_ins_string ARGS((int c));
|
||||||
|
#define XFUNC_insert 18
|
||||||
|
static int x_insert ARGS((int c));
|
||||||
|
#define XFUNC_kill 19
|
||||||
|
static int x_kill ARGS((int c));
|
||||||
|
#define XFUNC_kill_region 20
|
||||||
|
static int x_kill_region ARGS((int c));
|
||||||
|
#define XFUNC_list_comm 21
|
||||||
|
static int x_list_comm ARGS((int c));
|
||||||
|
#define XFUNC_list_file 22
|
||||||
|
static int x_list_file ARGS((int c));
|
||||||
|
#define XFUNC_literal 23
|
||||||
|
static int x_literal ARGS((int c));
|
||||||
|
#define XFUNC_meta1 24
|
||||||
|
static int x_meta1 ARGS((int c));
|
||||||
|
#define XFUNC_meta2 25
|
||||||
|
static int x_meta2 ARGS((int c));
|
||||||
|
#define XFUNC_meta_yank 26
|
||||||
|
static int x_meta_yank ARGS((int c));
|
||||||
|
#define XFUNC_mv_back 27
|
||||||
|
static int x_mv_back ARGS((int c));
|
||||||
|
#define XFUNC_mv_begin 28
|
||||||
|
static int x_mv_begin ARGS((int c));
|
||||||
|
#define XFUNC_mv_bword 29
|
||||||
|
static int x_mv_bword ARGS((int c));
|
||||||
|
#define XFUNC_mv_end 30
|
||||||
|
static int x_mv_end ARGS((int c));
|
||||||
|
#define XFUNC_mv_forw 31
|
||||||
|
static int x_mv_forw ARGS((int c));
|
||||||
|
#define XFUNC_mv_fword 32
|
||||||
|
static int x_mv_fword ARGS((int c));
|
||||||
|
#define XFUNC_newline 33
|
||||||
|
static int x_newline ARGS((int c));
|
||||||
|
#define XFUNC_next_com 34
|
||||||
|
static int x_next_com ARGS((int c));
|
||||||
|
#define XFUNC_nl_next_com 35
|
||||||
|
static int x_nl_next_com ARGS((int c));
|
||||||
|
#define XFUNC_noop 36
|
||||||
|
static int x_noop ARGS((int c));
|
||||||
|
#define XFUNC_prev_com 37
|
||||||
|
static int x_prev_com ARGS((int c));
|
||||||
|
#define XFUNC_prev_histword 38
|
||||||
|
static int x_prev_histword ARGS((int c));
|
||||||
|
#define XFUNC_search_char_forw 39
|
||||||
|
static int x_search_char_forw ARGS((int c));
|
||||||
|
#define XFUNC_search_char_back 40
|
||||||
|
static int x_search_char_back ARGS((int c));
|
||||||
|
#define XFUNC_search_hist 41
|
||||||
|
static int x_search_hist ARGS((int c));
|
||||||
|
#define XFUNC_set_mark 42
|
||||||
|
static int x_set_mark ARGS((int c));
|
||||||
|
#define XFUNC_stuff 43
|
||||||
|
static int x_stuff ARGS((int c));
|
||||||
|
#define XFUNC_stuffreset 44
|
||||||
|
static int x_stuffreset ARGS((int c));
|
||||||
|
#define XFUNC_transpose 45
|
||||||
|
static int x_transpose ARGS((int c));
|
||||||
|
#define XFUNC_version 46
|
||||||
|
static int x_version ARGS((int c));
|
||||||
|
#define XFUNC_xchg_point_mark 47
|
||||||
|
static int x_xchg_point_mark ARGS((int c));
|
||||||
|
#define XFUNC_yank 48
|
||||||
|
static int x_yank ARGS((int c));
|
||||||
|
#define XFUNC_comp_list 49
|
||||||
|
static int x_comp_list ARGS((int c));
|
||||||
|
#define XFUNC_expand 50
|
||||||
|
static int x_expand ARGS((int c));
|
||||||
|
#define XFUNC_fold_capitialize 51
|
||||||
|
static int x_fold_capitialize ARGS((int c));
|
||||||
|
#define XFUNC_fold_lower 52
|
||||||
|
static int x_fold_lower ARGS((int c));
|
||||||
|
#define XFUNC_fold_upper 53
|
||||||
|
static int x_fold_upper ARGS((int c));
|
||||||
|
#define XFUNC_set_arg 54
|
||||||
|
static int x_set_arg ARGS((int c));
|
||||||
|
#define XFUNC_comment 55
|
||||||
|
static int x_comment ARGS((int c));
|
||||||
|
#ifdef SILLY
|
||||||
|
#define XFUNC_game_of_life 56
|
||||||
|
static int x_game_of_life ARGS((int c));
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define XFUNC_debug_info 57
|
||||||
|
static int x_debug_info ARGS((int c));
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
#ifdef OS2
|
||||||
|
#define XFUNC_meta3 58
|
||||||
|
static int x_meta3 ARGS((int c));
|
||||||
|
#else
|
||||||
|
#endif
|
118
os2/kshrc.ksh
Normal file
118
os2/kshrc.ksh
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
# kshrc.ksh startup file for OS/2 version of ksh
|
||||||
|
|
||||||
|
set -o trackall
|
||||||
|
set -o ignoreeof
|
||||||
|
|
||||||
|
alias a:='cd a:.'
|
||||||
|
alias b:='cd b:.'
|
||||||
|
alias c:='cd c:.'
|
||||||
|
alias d:='cd d:.'
|
||||||
|
alias e:='cd e:.'
|
||||||
|
alias f:='cd f:.'
|
||||||
|
alias g:='cd g:.'
|
||||||
|
alias h:='cd h:.'
|
||||||
|
alias i:='cd i:.'
|
||||||
|
alias j:='cd j:.'
|
||||||
|
alias k:='cd k:.'
|
||||||
|
alias l:='cd l:.'
|
||||||
|
alias m:='cd m:.'
|
||||||
|
|
||||||
|
alias h='fc -l'
|
||||||
|
alias j='jobs'
|
||||||
|
#alias which='type'
|
||||||
|
alias back='cd -'
|
||||||
|
alias cls='print -n "\033[H\033[2J"'
|
||||||
|
|
||||||
|
alias dir='cmd /c dir'
|
||||||
|
alias del='cmd /c del'
|
||||||
|
alias erase='cmd/c erase'
|
||||||
|
alias copy='cmd /c copy'
|
||||||
|
alias start='cmd /c start /f'
|
||||||
|
alias path='print -r $PATH'
|
||||||
|
|
||||||
|
alias ll='ls -lsAFk'
|
||||||
|
alias lf='ls -CAFk'
|
||||||
|
alias cp='cp -p'
|
||||||
|
alias ls='ls -F'
|
||||||
|
|
||||||
|
clock_p () {
|
||||||
|
PS1='${__[(H=SECONDS/3600%24)==(M=SECONDS/60%60)==(S=SECONDS%60)]-$H:$M:$S}>'
|
||||||
|
typeset -Z2 H M S; let SECONDS=`date '+(%H*60+%M)*60+%S'`
|
||||||
|
}
|
||||||
|
#function needed by add_path, pre_path, and del_path
|
||||||
|
no_path () {
|
||||||
|
eval _v="\$${2:-PATH}"
|
||||||
|
case \;$_v\; in
|
||||||
|
*\;$1\;*) return 1 ;; # no we have it
|
||||||
|
esac
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
#if $1 exists and is not in path, append it, or prepend it
|
||||||
|
add_path () {
|
||||||
|
[ -d ${1:-.} ] && no_path $* && eval ${2:-PATH}="\$${2:-PATH}\;$1"
|
||||||
|
}
|
||||||
|
pre_path () {
|
||||||
|
[ -d ${1:-.} ] && no_path $* && eval ${2:-PATH}="$1\;\$${2:-PATH}"
|
||||||
|
}
|
||||||
|
#if $1 is in path then remove it
|
||||||
|
del_path () {
|
||||||
|
no_path $* || eval ${2:-PATH}=`eval print -f '\;$'${2:-PATH}'\;' | sed -e "s!;$1;!;!g" -e "s!^;!!" -e "s!;\\$!!" -e "s!;!\\\\\;!g"`
|
||||||
|
}
|
||||||
|
|
||||||
|
unalias login newgrp
|
||||||
|
|
||||||
|
if [ "$KSH_VERSION" = "" ]
|
||||||
|
then PS1='$PWD>'
|
||||||
|
return #bail out for sh which doesn't have edit modes
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -o emacs
|
||||||
|
bind ^Q=quote
|
||||||
|
bind ^I=complete
|
||||||
|
#bind ^[^[=list-file
|
||||||
|
|
||||||
|
#The next four have been preprogrammed
|
||||||
|
bind ^0H=up-history
|
||||||
|
bind ^0P=down-history
|
||||||
|
bind ^0K=backward-char
|
||||||
|
bind ^0M=forward-char
|
||||||
|
|
||||||
|
bind ^0s=backward-word
|
||||||
|
bind ^0t=forward-word
|
||||||
|
bind ^0G=beginning-of-line
|
||||||
|
bind ^0O=end-of-line
|
||||||
|
bind ^0w=beginning-of-history
|
||||||
|
bind ^0u=end-of-history
|
||||||
|
bind ^0S=eot-or-delete
|
||||||
|
|
||||||
|
|
||||||
|
FCEDIT=t2
|
||||||
|
PS1='[!]$PWD: '
|
||||||
|
function pushd {
|
||||||
|
if [ $# -eq 0 ]
|
||||||
|
then d=~
|
||||||
|
set -A dirstk ${dirstk[*]} $PWD
|
||||||
|
cd $d
|
||||||
|
else for d in $*
|
||||||
|
do if [ -d $d ] && [ -r $d ] && [ -x $d ]
|
||||||
|
then set -A dirstk ${dirstk[*]} $PWD
|
||||||
|
cd $d
|
||||||
|
else echo "$d: Cannot change directory"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
echo ${dirstk[*]} $PWD
|
||||||
|
unset d ;
|
||||||
|
}
|
||||||
|
|
||||||
|
function popd {
|
||||||
|
if [ ${#dirstk[*]} -gt 0 ]
|
||||||
|
then let n=${#dirstk[*]}-1
|
||||||
|
cd ${dirstk[$n]}
|
||||||
|
unset dirstk[$n]
|
||||||
|
echo ${dirstk[*]} $PWD
|
||||||
|
else echo "popd: Directory stack empty"
|
||||||
|
fi
|
||||||
|
unset n ;
|
||||||
|
}
|
44
os2/make.sed
Normal file
44
os2/make.sed
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
s/@SHELL_PROG@/ksh/
|
||||||
|
s!/bin/sh!sh!
|
||||||
|
s/@configure_input@/OS2_Makefile/
|
||||||
|
s/@srcdir@/./
|
||||||
|
s/@CC@/gcc/
|
||||||
|
s/@CPP@/cpp/
|
||||||
|
s/@CPPFLAGS@//
|
||||||
|
s/@INSTALL@/\/bin\/install -c/
|
||||||
|
s/@INSTALL_PROGRAM@/$(INSTALL)/
|
||||||
|
s/@INSTALL_DATA@/$(INSTALL) -m 644/
|
||||||
|
s/@DEFS@/-DHAVE_CONFIG_H/
|
||||||
|
s/@LIBS@/-los2/
|
||||||
|
s/@LDSTATIC@//
|
||||||
|
s/@LDFLAGS@/-O -s $(LDSTATIC)/
|
||||||
|
s/^\(CFLAGS[ ]*=\).*/\1 -O -DOS2/
|
||||||
|
s/^\(prefix[ ]*=\).*/\1 c:\/usr/
|
||||||
|
s/^\(exec_prefix[ ]*=\).*/\1 c:\/usr/
|
||||||
|
s/^\(exe_suffix[ ]*=\).*/\1.exe/
|
||||||
|
s/^\(OBJS[ ]*=\)/\1 os2.o/
|
||||||
|
s/`echo $(SHELL_PROG)|sed '$(transform)'`/$(SHELL_PROG)/
|
||||||
|
s#$(srcdir)/tests/th.sh#th.cmd#
|
||||||
|
/^configure:/,/^$/d
|
||||||
|
/^config.h.in:/,/^$/d
|
||||||
|
/^config.h:/,/^$/c\
|
||||||
|
config.h:\
|
||||||
|
cmd /c copy $(srcdir)\\os2\\config.h config.h > nul\
|
||||||
|
touch config.h\
|
||||||
|
|
||||||
|
/^Makefile:/,/^$/c\
|
||||||
|
Makefile:\
|
||||||
|
cmd /c copy $(srcdir)\\os2\\Makefile Makefile > nul\
|
||||||
|
touch Makefile\
|
||||||
|
|
||||||
|
/^config.status:/,/^$/d
|
||||||
|
/^siglist.out:/,/^$/c\
|
||||||
|
siglist.out:\
|
||||||
|
cmd /c copy $(srcdir)\\os2\\os2siglist.out siglist.out > nul\
|
||||||
|
touch siglist.out\
|
||||||
|
|
||||||
|
/^emacs.out:/,/^$/c\
|
||||||
|
emacs.out:\
|
||||||
|
cmd /c copy $(srcdir)\\os2\\emacs.out emacs.out > nul\
|
||||||
|
touch emacs.out\
|
||||||
|
|
264
os2/os2.c
Normal file
264
os2/os2.c
Normal file
@ -0,0 +1,264 @@
|
|||||||
|
#define INCL_DOS
|
||||||
|
#define INCL_DOSERRORS
|
||||||
|
#define INCL_DOSSESMGR
|
||||||
|
#define INCL_WINPROGRAMLIST
|
||||||
|
#include <os2.h>
|
||||||
|
#include "config.h"
|
||||||
|
#include "sh.h" /* To get inDOS(). */
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <io.h>
|
||||||
|
#include <process.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
static int isfullscreen(void)
|
||||||
|
{
|
||||||
|
PTIB ptib;
|
||||||
|
PPIB ppib;
|
||||||
|
|
||||||
|
DosGetInfoBlocks(&ptib, &ppib);
|
||||||
|
return (ppib -> pib_ultype != SSF_TYPE_WINDOWABLEVIO);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
quoted_strlen(char *s)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
int seen_space = 0;
|
||||||
|
while (*s) {
|
||||||
|
if (seen_space == 0 && *s == ' ') {
|
||||||
|
ret += 2;
|
||||||
|
seen_space = 1;
|
||||||
|
} else if (*s == '\"') {
|
||||||
|
if (seen_space == 0) {
|
||||||
|
seen_space = 1;
|
||||||
|
ret += 4;
|
||||||
|
} else ret += 2;
|
||||||
|
} else ret++;
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
quoted_strcpy(char *targ, char* src)
|
||||||
|
{
|
||||||
|
int seen_space = 0;
|
||||||
|
char *s = src, *t = targ;
|
||||||
|
|
||||||
|
while (*s) {
|
||||||
|
if ((*s == ' ') || (*s == '\"')) {
|
||||||
|
seen_space = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
if (seen_space) {
|
||||||
|
*targ++ = '\"';
|
||||||
|
}
|
||||||
|
while (*src) {
|
||||||
|
if (*src == '\"') {
|
||||||
|
*targ++ = '\\';
|
||||||
|
}
|
||||||
|
*targ++ = *src++;
|
||||||
|
}
|
||||||
|
if (seen_space) {
|
||||||
|
*targ++ = '\"';
|
||||||
|
}
|
||||||
|
*targ = '\0';
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
newsession(int type, int mode, char *cmd, char **args, char **env)
|
||||||
|
{
|
||||||
|
STARTDATA sd;
|
||||||
|
STATUSDATA st;
|
||||||
|
REQUESTDATA qr;
|
||||||
|
ULONG sid, pid, len, cnt, rc;
|
||||||
|
PVOID ptr;
|
||||||
|
BYTE prio;
|
||||||
|
static char queue[18];
|
||||||
|
static HQUEUE qid = -1;
|
||||||
|
char *ap, *ep, *p;
|
||||||
|
char object[256] = {0};
|
||||||
|
|
||||||
|
for ( cnt = 1, len = 0; args[cnt] != NULL; cnt++ )
|
||||||
|
len += quoted_strlen(args[cnt]) + 1;
|
||||||
|
p = ap = alloca(len + 2);
|
||||||
|
*p = 0;
|
||||||
|
for ( cnt = 1, len = 0; args[cnt] != NULL; cnt++ )
|
||||||
|
{
|
||||||
|
if ( cnt > 1 )
|
||||||
|
*p++ = ' ';
|
||||||
|
quoted_strcpy(p, args[cnt]);
|
||||||
|
p += strlen(p);
|
||||||
|
}
|
||||||
|
for ( cnt = 0, len = 0; env[cnt] != NULL; cnt++ )
|
||||||
|
len += strlen(env[cnt]) + 1;
|
||||||
|
p = ep = alloca(len + 2);
|
||||||
|
*p = 0;
|
||||||
|
for ( cnt = 0, len = 0; env[cnt] != NULL; cnt++ )
|
||||||
|
{
|
||||||
|
strcpy(p, env[cnt]);
|
||||||
|
p += strlen(p) + 1;
|
||||||
|
}
|
||||||
|
*p = 0;
|
||||||
|
|
||||||
|
if ( mode == P_WAIT && qid == -1 )
|
||||||
|
{
|
||||||
|
sprintf(queue, "\\queues\\ksh%04d", getpid());
|
||||||
|
if ( DosCreateQueue(&qid, QUE_FIFO, queue) )
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sd.Length = sizeof(sd);
|
||||||
|
sd.Related = (mode == P_WAIT) ? SSF_RELATED_CHILD : SSF_RELATED_INDEPENDENT;
|
||||||
|
sd.FgBg = SSF_FGBG_FORE;
|
||||||
|
sd.TraceOpt = SSF_TRACEOPT_NONE;
|
||||||
|
sd.PgmTitle = NULL;
|
||||||
|
sd.PgmName = cmd;
|
||||||
|
sd.PgmInputs = (PBYTE) ap;
|
||||||
|
sd.TermQ = (mode == P_WAIT) ? (PBYTE) queue : NULL;
|
||||||
|
sd.Environment = NULL;
|
||||||
|
sd.InheritOpt = SSF_INHERTOPT_PARENT;
|
||||||
|
sd.SessionType = type;
|
||||||
|
sd.IconFile = NULL;
|
||||||
|
sd.PgmHandle = 0;
|
||||||
|
sd.PgmControl = 0;
|
||||||
|
sd.Reserved = 0;
|
||||||
|
sd.ObjectBuffer = object;
|
||||||
|
sd.ObjectBuffLen = sizeof(object);
|
||||||
|
|
||||||
|
if ( DosStartSession(&sd, &sid, &pid) )
|
||||||
|
return errno = ENOEXEC, -1;
|
||||||
|
|
||||||
|
if ( mode == P_WAIT )
|
||||||
|
{
|
||||||
|
st.Length = sizeof(st);
|
||||||
|
st.SelectInd = SET_SESSION_UNCHANGED;
|
||||||
|
st.BondInd = SET_SESSION_BOND;
|
||||||
|
DosSetSession(sid, &st);
|
||||||
|
if ( DosReadQueue(qid, &qr, &len, &ptr, 0, DCWW_WAIT, &prio, 0) )
|
||||||
|
return -1;
|
||||||
|
rc = ((PUSHORT)ptr)[1];
|
||||||
|
DosFreeMem(ptr);
|
||||||
|
exit(rc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ksh_execve(char *cmd, char **args, char **env, int flags)
|
||||||
|
{
|
||||||
|
ULONG apptype;
|
||||||
|
char path[256], *p;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
strcpy(path, cmd);
|
||||||
|
for ( p = path; *p; p++ )
|
||||||
|
if ( *p == '/' )
|
||||||
|
*p = '\\';
|
||||||
|
|
||||||
|
if (_emx_env & 0x1000) { /* RSX, do best we can do. */
|
||||||
|
int len = strlen(cmd);
|
||||||
|
|
||||||
|
if (len > 4 && stricmp(cmd + len - 4, ".bat") == 0) {
|
||||||
|
/* execve would fail anyway, but most probably segfault. */
|
||||||
|
errno = ENOEXEC;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
goto do_execve;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( inDOS() ) {
|
||||||
|
fprintf(stderr, "ksh_execve requires OS/2 or RSX!\n");
|
||||||
|
exit(255);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( DosQueryAppType(path, &apptype) == 0 )
|
||||||
|
{
|
||||||
|
if (apptype & FAPPTYP_DOS)
|
||||||
|
return newsession(isfullscreen() ? SSF_TYPE_VDM :
|
||||||
|
SSF_TYPE_WINDOWEDVDM,
|
||||||
|
P_WAIT, path, args, env);
|
||||||
|
|
||||||
|
if ((apptype & FAPPTYP_WINDOWSREAL) ||
|
||||||
|
(apptype & FAPPTYP_WINDOWSPROT) ||
|
||||||
|
(apptype & FAPPTYP_WINDOWSPROT31))
|
||||||
|
return newsession(isfullscreen() ? PROG_WINDOW_AUTO :
|
||||||
|
PROG_SEAMLESSCOMMON,
|
||||||
|
P_WAIT, path, args, env);
|
||||||
|
|
||||||
|
if ( (apptype & FAPPTYP_EXETYPE) == FAPPTYP_WINDOWAPI ) {
|
||||||
|
printf(""); /* kludge to prevent PM apps from core dumping */
|
||||||
|
/* Start new session if interactive and not a part of a pipe. */
|
||||||
|
return newsession(SSF_TYPE_PM,
|
||||||
|
( (flags & XINTACT) && (flags & XPIPE)
|
||||||
|
/* _isterm(0) && _isterm(1) && _isterm(2) */
|
||||||
|
? P_NOWAIT
|
||||||
|
: P_WAIT),
|
||||||
|
path, args, env);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (apptype & FAPPTYP_EXETYPE) == FAPPTYP_NOTWINDOWCOMPAT ||
|
||||||
|
(apptype & FAPPTYP_EXETYPE) == FAPPTYP_NOTSPEC )
|
||||||
|
if ( !isfullscreen() )
|
||||||
|
return newsession(SSF_TYPE_FULLSCREEN,
|
||||||
|
( (flags & XINTACT) && (flags & XPIPE)
|
||||||
|
/* _isterm(0) && _isterm(1) && _isterm(2) */
|
||||||
|
? P_NOWAIT
|
||||||
|
: P_WAIT),
|
||||||
|
path, args, env);
|
||||||
|
}
|
||||||
|
do_execve:
|
||||||
|
{
|
||||||
|
/* P_QUOTE is too agressive, it quotes `@args_from_file' too,
|
||||||
|
which breaks emxomfld calling LINK386 when EMXSHELL=ksh.
|
||||||
|
Thus we check whether we need to quote, and delegate the hard
|
||||||
|
work to P_QUOTE if needed. */
|
||||||
|
char **pp = args;
|
||||||
|
int do_quote = 0;
|
||||||
|
for (; !do_quote && *pp; pp++) {
|
||||||
|
for (p = *pp; *p; p++) {
|
||||||
|
if (*p == '*' || *p == '?') {
|
||||||
|
do_quote = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (rc = spawnve(P_OVERLAY | (do_quote ? P_QUOTE : 0),
|
||||||
|
path, args, env)) != -1 )
|
||||||
|
exit(rc);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnixName(char *path)
|
||||||
|
{
|
||||||
|
for ( ; *path; path++ )
|
||||||
|
if ( *path == '\\' )
|
||||||
|
*path = '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
char *ksh_strchr_dirsep(const char *path)
|
||||||
|
{
|
||||||
|
char *p1 = strchr(path, '\\');
|
||||||
|
char *p2 = strchr(path, '/');
|
||||||
|
if ( !p1 ) return p2;
|
||||||
|
if ( !p2 ) return p1;
|
||||||
|
return (p1 > p2) ? p2 : p1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *ksh_strrchr_dirsep(const char *path)
|
||||||
|
{
|
||||||
|
char *p1 = strrchr(path, '\\');
|
||||||
|
char *p2 = strrchr(path, '/');
|
||||||
|
if ( !p1 ) return p2;
|
||||||
|
if ( !p2 ) return p1;
|
||||||
|
return (p1 > p2) ? p1 : p2;
|
||||||
|
}
|
19
os2/os2bugs
Normal file
19
os2/os2bugs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
Bugs and Limitations
|
||||||
|
1/99
|
||||||
|
|
||||||
|
1. Some of the makefile targets are not yet working. Those known to
|
||||||
|
work include all, uninstall,ksh, config.h, makefile,
|
||||||
|
debugtools (only check-fd and check-sigs.), test, clean, & distclean.
|
||||||
|
You need to run ksh Bugs ksh, or sh Bugs sh as appropriate.
|
||||||
|
|
||||||
|
2. You cannot start a full screen session from the windowed ksh command line.
|
||||||
|
|
||||||
|
3. Job control is not working and may never work in os/2 (no sigstp,
|
||||||
|
sigcont, etc).
|
||||||
|
|
||||||
|
4. ls [B]* fails even when a file Bozo exists. ls [b]* will work
|
||||||
|
due to case folding. The bug is in the way case folding is managed.
|
||||||
|
ls b* or ls B* will work as expected.
|
||||||
|
|
||||||
|
5. regress.t:regression-13 test fails. I do not understand why it can
|
||||||
|
work on *nix. In fact cat does not get SIGPIPE, but gets write failure.
|
24
os2/os2siglist.out
Normal file
24
os2/os2siglist.out
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* signal handling
|
||||||
|
*/
|
||||||
|
{SIGHUP, "HUP", "Hangup"},
|
||||||
|
{SIGINT, "INT", "Interrupt"},
|
||||||
|
{SIGQUIT, "QUIT", "Quit"},
|
||||||
|
{SIGILL, "ILL", "Illegal instruction"},
|
||||||
|
{SIGTRAP, "TRAP", "Trace trap"},
|
||||||
|
{SIGABRT, "ABRT", "Abort"},
|
||||||
|
{SIGEMT, "EMT", "EMT trap"},
|
||||||
|
{SIGFPE, "FPE", "Floating exception"},
|
||||||
|
{SIGKILL, "KILL", "Killed"},
|
||||||
|
{SIGBUS, "BUS", "Bus error"},
|
||||||
|
{SIGSEGV, "SEGV", "Memory fault"},
|
||||||
|
{SIGSYS, "SYS", "Bad system call"},
|
||||||
|
{SIGPIPE, "PIPE", "Broken pipe"},
|
||||||
|
{SIGALRM, "ALRM", "Alarm clock"},
|
||||||
|
{SIGTERM, "TERM", "Terminated"},
|
||||||
|
{SIGUSR1, "USR1", "User defined #1"},
|
||||||
|
{SIGUSR2, "USR2", "User defined #2"},
|
||||||
|
{SIGCHLD, "CHLD", "Death of a child"},
|
||||||
|
{ 19, (char *) 0, "Signal 19"},
|
||||||
|
{ 20, (char *) 0, "Signal 20"},
|
||||||
|
{SIGBREAK, "BREAK", "Ctrl-Break"},
|
28
os2/th.cmd
Normal file
28
os2/th.cmd
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
extproc ksh
|
||||||
|
#
|
||||||
|
# Simple script to find perl and run it
|
||||||
|
# for os2
|
||||||
|
|
||||||
|
IFS=\;$IFS
|
||||||
|
perl=
|
||||||
|
for i in $PATH; do
|
||||||
|
[ X"$i" = X ] && i=.
|
||||||
|
for j in perl perl5x perl5 ; do
|
||||||
|
[ -x $i/$j.exe ] && perl=$i/$j.exe && break 2
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
[ X"$perl" = X ] && {
|
||||||
|
echo "$0: can't find perl - bye\n" 1>&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
perlpath=`dirname $perl`
|
||||||
|
if [ `basename $perlpath` = bin ]
|
||||||
|
then perlpath=`dirname $perlpath`
|
||||||
|
fi
|
||||||
|
if [ "$PERL5LIB" = "" ]
|
||||||
|
then PERL5LIB=$perlpath/lib
|
||||||
|
fi
|
||||||
|
export PERL5LIB
|
||||||
|
exec $perl "$@"
|
482
sigact.c
Normal file
482
sigact.c
Normal file
@ -0,0 +1,482 @@
|
|||||||
|
/* NAME:
|
||||||
|
* sigact.c - fake sigaction(2)
|
||||||
|
*
|
||||||
|
* SYNOPSIS:
|
||||||
|
* #include "sigact.h"
|
||||||
|
*
|
||||||
|
* int sigaction(int sig, struct sigaction *act,
|
||||||
|
* struct sigaction *oact);
|
||||||
|
* int sigaddset(sigset_t *mask, int sig);
|
||||||
|
* int sigdelset(sigset_t *mask, int sig);
|
||||||
|
* int sigemptyset(sigset_t *mask);
|
||||||
|
* int sigfillset(sigset_t *mask);
|
||||||
|
* int sigismember(sigset_t *mask, int sig);
|
||||||
|
* int sigpending(sigset_t *set);
|
||||||
|
* int sigprocmask(int how, sigset_t *set, sigset_t *oset);
|
||||||
|
* int sigsuspend(sigset_t *mask);
|
||||||
|
*
|
||||||
|
* RETSIGTYPE (*Signal(int sig, RETSIGTYPE (*disp)(int)))(int);
|
||||||
|
*
|
||||||
|
* DESCRIPTION:
|
||||||
|
* This is a fake sigaction implementation. It uses
|
||||||
|
* sigsetmask(2) et al or sigset(2) and friends if
|
||||||
|
* available, otherwise it just uses signal(2). If it
|
||||||
|
* thinks sigaction(2) really exists it compiles to "almost"
|
||||||
|
* nothing.
|
||||||
|
*
|
||||||
|
* In any case it provides a Signal() function that is
|
||||||
|
* implemented in terms of sigaction().
|
||||||
|
* If not using signal(2) as part of the underlying
|
||||||
|
* implementation (USE_SIGNAL or USE_SIGMASK), and
|
||||||
|
* NO_SIGNAL is not defined, it also provides a signal()
|
||||||
|
* function that calls Signal().
|
||||||
|
*
|
||||||
|
* The need for all this mucking about is the problems
|
||||||
|
* caused by mixing various signal handling mechanisms in
|
||||||
|
* the one process. This module allows for a consistent
|
||||||
|
* POSIX compliant interface to whatever is actually
|
||||||
|
* available.
|
||||||
|
*
|
||||||
|
* sigaction() allows the caller to examine and/or set the
|
||||||
|
* action to be associated with a given signal. "act" and
|
||||||
|
* "oact" are pointers to 'sigaction structs':
|
||||||
|
*.nf
|
||||||
|
*
|
||||||
|
* struct sigaction
|
||||||
|
* {
|
||||||
|
* RETSIGTYPE (*sa_handler)();
|
||||||
|
* sigset_t sa_mask;
|
||||||
|
* int sa_flags;
|
||||||
|
* };
|
||||||
|
*.fi
|
||||||
|
*
|
||||||
|
* RETSIGTYPE is normally 'void' in the POSIX implementation
|
||||||
|
* and for most current systems. On some older UNIX
|
||||||
|
* systems, signal handlers do not return 'void', so
|
||||||
|
* this implementation keeps 'sa_handler' inline with the
|
||||||
|
* hosts normal signal handling conventions.
|
||||||
|
* 'sa_mask' controls which signals will be blocked while
|
||||||
|
* the selected signal handler is active. It is not used
|
||||||
|
* in this implementation.
|
||||||
|
* 'sa_flags' controls various semantics such as whether
|
||||||
|
* system calls should be automagically restarted
|
||||||
|
* (SA_RESTART) etc. It is not used in this
|
||||||
|
* implementation.
|
||||||
|
* Either "act" or "oact" may be NULL in which case the
|
||||||
|
* appropriate operation is skipped.
|
||||||
|
*
|
||||||
|
* sigaddset() adds "sig" to the sigset_t pointed to by "mask".
|
||||||
|
*
|
||||||
|
* sigdelset() removes "sig" from the sigset_t pointed to
|
||||||
|
* by "mask".
|
||||||
|
*
|
||||||
|
* sigemptyset() makes the sigset_t pointed to by "mask" empty.
|
||||||
|
*
|
||||||
|
* sigfillset() makes the sigset_t pointed to by "mask"
|
||||||
|
* full ie. match all signals.
|
||||||
|
*
|
||||||
|
* sigismember() returns true if "sig" is found in "*mask".
|
||||||
|
*
|
||||||
|
* sigpending() is supposed to return "set" loaded with the
|
||||||
|
* set of signals that are blocked and pending for the
|
||||||
|
* calling process. It does nothing in this impementation.
|
||||||
|
*
|
||||||
|
* sigprocmask() is used to examine and/or change the
|
||||||
|
* signal mask for the calling process. Either "set" or
|
||||||
|
* "oset" may be NULL in which case the appropriate
|
||||||
|
* operation is skipped. "how" may be one of SIG_BLOCK,
|
||||||
|
* SIG_UNBLOCK or SIG_SETMASK. If this package is built
|
||||||
|
* with USE_SIGNAL, then this routine achieves nothing.
|
||||||
|
*
|
||||||
|
* sigsuspend() sets the signal mask to "*mask" and waits
|
||||||
|
* for a signal to be delivered after which the previous
|
||||||
|
* mask is restored.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* RETURN VALUE:
|
||||||
|
* 0==success, -1==failure
|
||||||
|
*
|
||||||
|
* BUGS:
|
||||||
|
* Since we fake most of this, don't expect fancy usage to
|
||||||
|
* work.
|
||||||
|
*
|
||||||
|
* AUTHOR:
|
||||||
|
* Simon J. Gerraty <sjg@zen.void.oz.au>
|
||||||
|
*/
|
||||||
|
/* COPYRIGHT:
|
||||||
|
* @(#)Copyright (c) 1992 Simon J. Gerraty
|
||||||
|
*
|
||||||
|
* This is free software. It comes with NO WARRANTY.
|
||||||
|
* Permission to use, modify and distribute this source code
|
||||||
|
* is granted subject to the following conditions.
|
||||||
|
* 1/ that that the above copyright notice and this notice
|
||||||
|
* are preserved in all copies and that due credit be given
|
||||||
|
* to the author.
|
||||||
|
* 2/ that any changes to this code are clearly commented
|
||||||
|
* as such so that the author does get blamed for bugs
|
||||||
|
* other than his own.
|
||||||
|
*
|
||||||
|
* Please send copies of changes and bug-fixes to:
|
||||||
|
* sjg@zen.void.oz.au
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/* Changes to sigact.c for pdksh, Michael Rendell <michael@cs.mun.ca>:
|
||||||
|
* - sigsuspend(): pass *mask to bsd4.2 sigpause instead of mask.
|
||||||
|
* - changed SIG_HDLR to RETSIGTYPE for use with GNU autoconf
|
||||||
|
* - added and used RETSIGVAL
|
||||||
|
* - include sh.h instead of signal.h (to get *_SIGNALS macros)
|
||||||
|
* - changed if !SA_NOCLDSTOP ... to USE_FAKE_SIGACT to avoid confusion
|
||||||
|
* - set the USE_* defines using the *_SIGNALS defines from autoconf
|
||||||
|
* - sigaction(): if using BSD signals, use sigvec() (used to use
|
||||||
|
* signal()) and set the SV_INTERRUPT flag (POSIX says syscalls
|
||||||
|
* are interrupted and pdksh needs this behaviour).
|
||||||
|
* - define IS_KSH before including anything; ifdef out routines
|
||||||
|
* not used in ksh if IS_KSH is defined (same in sigact.h).
|
||||||
|
* - use ARGS() instead of __P()
|
||||||
|
* - sigaction(),sigsuspend(),Signal(),signal(): use handler_t typedef
|
||||||
|
* instead of explicit type.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <signal.h>
|
||||||
|
*/
|
||||||
|
#define IS_KSH
|
||||||
|
#include "sh.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
#ifndef __P
|
||||||
|
# if defined(__STDC__) || defined(__cplusplus)
|
||||||
|
# define __P(p) p
|
||||||
|
# else
|
||||||
|
# define __P(p) ()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* some systems have a faulty sigaction() implementation!
|
||||||
|
* Allow us to bypass it.
|
||||||
|
* Or they may have installed sigact.h as signal.h which is why
|
||||||
|
* we have SA_NOCLDSTOP defined.
|
||||||
|
*/
|
||||||
|
#ifdef USE_FAKE_SIGACT /* let autoconf decide.. */
|
||||||
|
/* #if !defined(SA_NOCLDSTOP) || defined(_SIGACT_H) || defined(USE_SIGNAL) || defined(USE_SIGSET) || defined(USE_SIGMASK) */
|
||||||
|
|
||||||
|
/* Let autoconf decide which to use */
|
||||||
|
#ifdef BSD42_SIGNALS
|
||||||
|
# define USE_SIGMASK
|
||||||
|
#else
|
||||||
|
# ifdef BSD41_SIGNALS
|
||||||
|
# define USE_SIGSET
|
||||||
|
# else
|
||||||
|
# define USE_SIGNAL
|
||||||
|
# endif
|
||||||
|
#endif /* BSD42_SIGNALS */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* if we haven't been told,
|
||||||
|
* try and guess what we should implement with.
|
||||||
|
*/
|
||||||
|
#if !defined(USE_SIGSET) && !defined(USE_SIGMASK) && !defined(USE_SIGNAL)
|
||||||
|
# if defined(sigmask) || defined(BSD) || defined(_BSD) && !defined(BSD41)
|
||||||
|
# define USE_SIGMASK
|
||||||
|
# else
|
||||||
|
# ifndef NO_SIGSET
|
||||||
|
# define USE_SIGSET
|
||||||
|
# else
|
||||||
|
# define USE_SIGNAL
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* if we still don't know, we're in trouble
|
||||||
|
*/
|
||||||
|
#if !defined(USE_SIGSET) && !defined(USE_SIGMASK) && !defined(USE_SIGNAL)
|
||||||
|
error must know what to implement with
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "sigact.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* in case signal() has been mapped to our Signal().
|
||||||
|
*/
|
||||||
|
#undef signal
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
sigaction(sig, act, oact)
|
||||||
|
int sig;
|
||||||
|
struct sigaction *act, *oact;
|
||||||
|
{
|
||||||
|
handler_t oldh;
|
||||||
|
|
||||||
|
if (act)
|
||||||
|
{
|
||||||
|
#ifdef USE_SIGSET
|
||||||
|
oldh = sigset(sig, act->sa_handler);
|
||||||
|
#else
|
||||||
|
# ifdef USE_SIGMASK
|
||||||
|
struct sigvec nsv,osv;
|
||||||
|
|
||||||
|
nsv.sv_handler = act->sa_handler;
|
||||||
|
nsv.sv_mask = 0; /* punt */
|
||||||
|
nsv.sv_flags = SV_INTERRUPT; /* punt */
|
||||||
|
sigvec(sig, &nsv, &osv);
|
||||||
|
oldh = osv.sv_handler;
|
||||||
|
# else /* USE_SIGMASK */
|
||||||
|
oldh = signal(sig, act->sa_handler);
|
||||||
|
# endif /* USE_SIGMASK */
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (oact)
|
||||||
|
{
|
||||||
|
#ifdef USE_SIGSET
|
||||||
|
oldh = sigset(sig, SIG_IGN);
|
||||||
|
#else
|
||||||
|
oldh = signal(sig, SIG_IGN);
|
||||||
|
#endif
|
||||||
|
if (oldh != SIG_IGN && oldh != SIG_ERR)
|
||||||
|
{
|
||||||
|
#ifdef USE_SIGSET
|
||||||
|
(void) sigset(sig, oldh);
|
||||||
|
#else
|
||||||
|
(void) signal(sig, oldh);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (oact)
|
||||||
|
{
|
||||||
|
oact->sa_handler = oldh;
|
||||||
|
}
|
||||||
|
return 0; /* hey we're faking it */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
sigaddset(mask, sig)
|
||||||
|
sigset_t *mask;
|
||||||
|
int sig;
|
||||||
|
{
|
||||||
|
*mask |= sigmask(sig);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef IS_KSH
|
||||||
|
int
|
||||||
|
sigdelset(mask, sig)
|
||||||
|
sigset_t *mask;
|
||||||
|
int sig;
|
||||||
|
{
|
||||||
|
*mask &= ~(sigmask(sig));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* IS_KSH */
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
sigemptyset(mask)
|
||||||
|
sigset_t *mask;
|
||||||
|
{
|
||||||
|
*mask = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef IS_KSH
|
||||||
|
int
|
||||||
|
sigfillset(mask)
|
||||||
|
sigset_t *mask;
|
||||||
|
{
|
||||||
|
*mask = ~0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* IS_KSH */
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef IS_KSH
|
||||||
|
int
|
||||||
|
sigismember(mask, sig)
|
||||||
|
sigset_t *mask;
|
||||||
|
int sig;
|
||||||
|
{
|
||||||
|
return ((*mask) & sigmask(sig));
|
||||||
|
}
|
||||||
|
#endif /* IS_KSH */
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef IS_KSH
|
||||||
|
int
|
||||||
|
sigpending(set)
|
||||||
|
sigset_t *set;
|
||||||
|
{
|
||||||
|
return 0; /* faking it! */
|
||||||
|
}
|
||||||
|
#endif /* IS_KSH */
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
sigprocmask(how, set, oset)
|
||||||
|
int how;
|
||||||
|
sigset_t *set, *oset;
|
||||||
|
{
|
||||||
|
#ifdef USE_SIGSET
|
||||||
|
register int i;
|
||||||
|
#endif
|
||||||
|
static sigset_t sm;
|
||||||
|
static int once = 0;
|
||||||
|
|
||||||
|
if (!once)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* initally we clear sm,
|
||||||
|
* there after, it represents the last
|
||||||
|
* thing we did.
|
||||||
|
*/
|
||||||
|
once++;
|
||||||
|
#ifdef USE_SIGMASK
|
||||||
|
sm = sigblock(0);
|
||||||
|
#else
|
||||||
|
sm = 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oset)
|
||||||
|
*oset = sm;
|
||||||
|
if (set)
|
||||||
|
{
|
||||||
|
switch (how)
|
||||||
|
{
|
||||||
|
case SIG_BLOCK:
|
||||||
|
sm |= *set;
|
||||||
|
break;
|
||||||
|
case SIG_UNBLOCK:
|
||||||
|
sm &= ~(*set);
|
||||||
|
break;
|
||||||
|
case SIG_SETMASK:
|
||||||
|
sm = *set;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#ifdef USE_SIGMASK
|
||||||
|
(void) sigsetmask(sm);
|
||||||
|
#else
|
||||||
|
# ifdef USE_SIGSET
|
||||||
|
for (i = 1; i < NSIG; i++)
|
||||||
|
{
|
||||||
|
if (how == SIG_UNBLOCK)
|
||||||
|
{
|
||||||
|
if (*set & sigmask(i))
|
||||||
|
sigrelse(i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (sm & sigmask(i))
|
||||||
|
{
|
||||||
|
sighold(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
sigsuspend(mask)
|
||||||
|
sigset_t *mask;
|
||||||
|
{
|
||||||
|
#ifdef USE_SIGMASK
|
||||||
|
sigpause(*mask);
|
||||||
|
#else
|
||||||
|
register int i;
|
||||||
|
|
||||||
|
# ifdef USE_SIGSET
|
||||||
|
|
||||||
|
for (i = 1; i < NSIG; i++)
|
||||||
|
{
|
||||||
|
if (*mask & sigmask(i))
|
||||||
|
{
|
||||||
|
/* not the same sigpause() as above! */
|
||||||
|
sigpause(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# else /* signal(2) only */
|
||||||
|
handler_t oldh;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* make sure that signals in mask will not
|
||||||
|
* be ignored.
|
||||||
|
*/
|
||||||
|
for (i = 1; i < NSIG; i++)
|
||||||
|
{
|
||||||
|
if (*mask & sigmask(i))
|
||||||
|
{
|
||||||
|
if ((oldh = signal(i, SIG_DFL)) != SIG_ERR &&
|
||||||
|
oldh != SIG_IGN &&
|
||||||
|
oldh != SIG_DFL)
|
||||||
|
(void) signal(i, oldh); /* restore handler */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pause(); /* wait for a signal */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* USE_FAKE_SIGACT (was ! SA_NOCLDSTOP) */
|
||||||
|
|
||||||
|
#if !defined(RETSIGTYPE)
|
||||||
|
# define RETSIGTYPE void
|
||||||
|
# define RETSIGVAL
|
||||||
|
#endif
|
||||||
|
#if !defined(SIG_ERR)
|
||||||
|
# define SIG_ERR (RETSIGTYPE (*)())-1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* an implementation of signal() using sigaction().
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef IS_KSH
|
||||||
|
handler_t Signal(sig, handler)
|
||||||
|
int sig;
|
||||||
|
handler_t handler;
|
||||||
|
{
|
||||||
|
struct sigaction act, oact;
|
||||||
|
|
||||||
|
act.sa_handler = handler;
|
||||||
|
sigemptyset(&act.sa_mask);
|
||||||
|
act.sa_flags = 0;
|
||||||
|
if (sigaction(sig, &act, &oact) < 0)
|
||||||
|
return (SIG_ERR);
|
||||||
|
return (oact.sa_handler);
|
||||||
|
}
|
||||||
|
#endif /* IS_KSH */
|
||||||
|
|
||||||
|
#ifndef IS_KSH
|
||||||
|
#if !defined(USE_SIGNAL) && !defined(USE_SIGMASK) && !defined(NO_SIGNAL)
|
||||||
|
/*
|
||||||
|
* ensure we avoid signal mayhem
|
||||||
|
*/
|
||||||
|
|
||||||
|
handler_t signal(sig, handler)
|
||||||
|
int sig;
|
||||||
|
handler_t handler;
|
||||||
|
{
|
||||||
|
return (Signal(sig, handler));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* IS_KSH */
|
||||||
|
|
||||||
|
/* This lot (for GNU-Emacs) goes at the end of the file. */
|
||||||
|
/*
|
||||||
|
* Local Variables:
|
||||||
|
* version-control:t
|
||||||
|
* comment-column:40
|
||||||
|
* End:
|
||||||
|
*/
|
129
sigact.h
Normal file
129
sigact.h
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
/* NAME:
|
||||||
|
* sigact.h - sigaction et al
|
||||||
|
*
|
||||||
|
* SYNOPSIS:
|
||||||
|
* #include "sigact.h"
|
||||||
|
*
|
||||||
|
* DESCRIPTION:
|
||||||
|
* This header is the interface to a fake sigaction(2)
|
||||||
|
* implementation. It provides a POSIX compliant interface
|
||||||
|
* to whatever signal handling mechanisms are available.
|
||||||
|
* It also provides a Signal() function that is implemented
|
||||||
|
* in terms of sigaction().
|
||||||
|
* If not using signal(2) as part of the underlying
|
||||||
|
* implementation (USE_SIGNAL or USE_SIGMASK), and
|
||||||
|
* NO_SIGNAL is not defined, it also provides a signal()
|
||||||
|
* function that calls Signal().
|
||||||
|
*
|
||||||
|
* SEE ALSO:
|
||||||
|
* sigact.c
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* RCSid:
|
||||||
|
* $Id: sigact.h,v 1.1 2004/03/21 00:34:16 tg Exp $
|
||||||
|
*/
|
||||||
|
/* Changes to sigact.h for pdksh, Michael Rendell <michael@cs.mun.ca>:
|
||||||
|
* - changed SIG_HDLR to RETSIGTYPE for use with GNU autoconf
|
||||||
|
* - added RETSIGVAL
|
||||||
|
* - ifdef'd out ARGS(), volatile and const initializations
|
||||||
|
* - ifdef'd out sigset_t definition - let autoconf handle it
|
||||||
|
* - ifdef out routines not used in ksh if IS_KSH is defined
|
||||||
|
* (same in sigact.c).
|
||||||
|
*/
|
||||||
|
#ifndef _SIGACT_H
|
||||||
|
#define _SIGACT_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* most modern systems use void for signal handlers but
|
||||||
|
* not all.
|
||||||
|
*/
|
||||||
|
#ifndef RETSIGTYPE
|
||||||
|
# define RETSIGTYPE void
|
||||||
|
# define RETSIGVAL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0 /* ARGS(), volatile and const are already set up in config*.h -mhr */
|
||||||
|
#undef ARGS
|
||||||
|
#if defined(__STDC__) || defined(__cplusplus)
|
||||||
|
# define ARGS(p) p
|
||||||
|
#else
|
||||||
|
# define ARGS(p) ()
|
||||||
|
# define volatile /* don't optimize please */
|
||||||
|
# define const /* read only */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IS_KSH
|
||||||
|
handler_t Signal ARGS((int sig, handler_t disp));
|
||||||
|
#endif /* IS_KSH */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* if you want to install this header as signal.h,
|
||||||
|
* modify this to pick up the original signal.h
|
||||||
|
*/
|
||||||
|
#ifndef SIGKILL
|
||||||
|
# include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SIG_ERR
|
||||||
|
# define SIG_ERR ((handler_t) -1)
|
||||||
|
#endif
|
||||||
|
#ifndef BADSIG
|
||||||
|
# define BADSIG SIG_ERR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SA_NOCLDSTOP
|
||||||
|
/* we assume we need the fake sigaction */
|
||||||
|
/* sa_flags */
|
||||||
|
#define SA_NOCLDSTOP 1 /* don't send SIGCHLD on child stop */
|
||||||
|
#define SA_RESTART 2 /* re-start I/O */
|
||||||
|
|
||||||
|
/* sigprocmask flags */
|
||||||
|
#define SIG_BLOCK 1
|
||||||
|
#define SIG_UNBLOCK 2
|
||||||
|
#define SIG_SETMASK 4
|
||||||
|
|
||||||
|
#if 0 /* autoconf will define sigset_t if it isn't available */
|
||||||
|
/*
|
||||||
|
* this is a bit untidy
|
||||||
|
*/
|
||||||
|
#if !defined(__sys_stdtypes_h)
|
||||||
|
typedef unsigned int sigset_t;
|
||||||
|
#endif
|
||||||
|
#endif /* 0 */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* POSIX sa_handler should return void, but since we are
|
||||||
|
* implementing in terms of something else, it may
|
||||||
|
* be appropriate to use the normal RETSIGTYPE return type
|
||||||
|
*/
|
||||||
|
struct sigaction
|
||||||
|
{
|
||||||
|
handler_t sa_handler;
|
||||||
|
sigset_t sa_mask;
|
||||||
|
int sa_flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int sigaction ARGS(( int sig, struct sigaction *act, struct sigaction *oact ));
|
||||||
|
int sigaddset ARGS(( sigset_t *mask, int sig ));
|
||||||
|
#ifndef IS_KSH
|
||||||
|
int sigdelset ARGS(( sigset_t *mask, int sig ));
|
||||||
|
#endif /* IS_KSH */
|
||||||
|
int sigemptyset ARGS(( sigset_t *mask ));
|
||||||
|
#ifndef IS_KSH
|
||||||
|
int sigfillset ARGS(( sigset_t *mask ));
|
||||||
|
int sigismember ARGS(( sigset_t *mask, int sig ));
|
||||||
|
int sigpending ARGS(( sigset_t *set ));
|
||||||
|
#endif /* IS_KSH */
|
||||||
|
int sigprocmask ARGS(( int how, sigset_t *set, sigset_t *oset ));
|
||||||
|
int sigsuspend ARGS(( sigset_t *mask ));
|
||||||
|
|
||||||
|
#ifndef sigmask
|
||||||
|
# define sigmask(s) (1<<((s)-1)) /* convert SIGnum to mask */
|
||||||
|
#endif
|
||||||
|
#if !defined(NSIG) && defined(_NSIG)
|
||||||
|
# define NSIG _NSIG
|
||||||
|
#endif
|
||||||
|
#endif /* ! SA_NOCLDSTOP */
|
||||||
|
#endif /* _SIGACT_H */
|
1
stamp-h.in
Normal file
1
stamp-h.in
Normal file
@ -0,0 +1 @@
|
|||||||
|
Tue Apr 20 17:32:21 NDT 1999
|
Loading…
x
Reference in New Issue
Block a user