Initial revision
This commit is contained in:
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 "$@"
|
Reference in New Issue
Block a user