diff --git a/cde/.gitignore b/cde/.gitignore index 759b73022..81888d17d 100644 --- a/cde/.gitignore +++ b/cde/.gitignore @@ -907,6 +907,7 @@ programs/dtinfo/tools/misc/treeres # program/dtksh programs/dtksh/dtksh +programs/dtksh/suid_exec programs/dtksh/examples/CallDataTest4 programs/dtksh/examples/CallbackTest2 programs/dtksh/examples/DtCursorTest2 @@ -928,211 +929,6 @@ programs/dtksh/examples/WorkProcTest1 programs/dtksh/examples/XCursorTest1 programs/dtksh/examples/XdrawTest programs/dtksh/examples/crMovesText1 -programs/dtksh/ksh93/bin -programs/dtksh/ksh93/include -programs/dtksh/ksh93/lib -programs/dtksh/ksh93/man -programs/dtksh/ksh93/man/man1/sh.1 -programs/dtksh/ksh93/man/man1/sh.1.old -programs/dtksh/ksh93/man/man3/LIBAST.3 -programs/dtksh/ksh93/man/man3/LIBAST.3.old -programs/dtksh/ksh93/man/man3/ast.3 -programs/dtksh/ksh93/man/man3/ast.3.old -programs/dtksh/ksh93/man/man3/chr.3 -programs/dtksh/ksh93/man/man3/chr.3.old -programs/dtksh/ksh93/man/man3/compatibility.3 -programs/dtksh/ksh93/man/man3/compatibility.3.old -programs/dtksh/ksh93/man/man3/error.3 -programs/dtksh/ksh93/man/man3/error.3.old -programs/dtksh/ksh93/man/man3/find.3 -programs/dtksh/ksh93/man/man3/find.3.old -programs/dtksh/ksh93/man/man3/fmt.3 -programs/dtksh/ksh93/man/man3/fmt.3.old -programs/dtksh/ksh93/man/man3/fmtls.3 -programs/dtksh/ksh93/man/man3/fmtls.3.old -programs/dtksh/ksh93/man/man3/fs3d.3 -programs/dtksh/ksh93/man/man3/fs3d.3.old -programs/dtksh/ksh93/man/man3/ftwalk.3 -programs/dtksh/ksh93/man/man3/ftwalk.3.old -programs/dtksh/ksh93/man/man3/getcwd.3 -programs/dtksh/ksh93/man/man3/getcwd.3.old -programs/dtksh/ksh93/man/man3/hash.3 -programs/dtksh/ksh93/man/man3/hash.3.old -programs/dtksh/ksh93/man/man3/iblocks.3 -programs/dtksh/ksh93/man/man3/iblocks.3.old -programs/dtksh/ksh93/man/man3/int.3 -programs/dtksh/ksh93/man/man3/int.3.old -programs/dtksh/ksh93/man/man3/magic.3 -programs/dtksh/ksh93/man/man3/magic.3.old -programs/dtksh/ksh93/man/man3/mem.3 -programs/dtksh/ksh93/man/man3/mem.3.old -programs/dtksh/ksh93/man/man3/modecanon.3 -programs/dtksh/ksh93/man/man3/modecanon.3.old -programs/dtksh/ksh93/man/man3/nval.3 -programs/dtksh/ksh93/man/man3/nval.3.old -programs/dtksh/ksh93/man/man3/optget.3 -programs/dtksh/ksh93/man/man3/optget.3.old -programs/dtksh/ksh93/man/man3/path.3 -programs/dtksh/ksh93/man/man3/path.3.old -programs/dtksh/ksh93/man/man3/preroot.3 -programs/dtksh/ksh93/man/man3/preroot.3.old -programs/dtksh/ksh93/man/man3/proc.3 -programs/dtksh/ksh93/man/man3/proc.3.old -programs/dtksh/ksh93/man/man3/re.3 -programs/dtksh/ksh93/man/man3/re.3.old -programs/dtksh/ksh93/man/man3/setenviron.3 -programs/dtksh/ksh93/man/man3/setenviron.3.old -programs/dtksh/ksh93/man/man3/sfdisc.3 -programs/dtksh/ksh93/man/man3/sfdisc.3.old -programs/dtksh/ksh93/man/man3/sfio.3 -programs/dtksh/ksh93/man/man3/sfio.3.old -programs/dtksh/ksh93/man/man3/sig.3 -programs/dtksh/ksh93/man/man3/sig.3.old -programs/dtksh/ksh93/man/man3/spawnveg.3 -programs/dtksh/ksh93/man/man3/spawnveg.3.old -programs/dtksh/ksh93/man/man3/stak.3 -programs/dtksh/ksh93/man/man3/stak.3.old -programs/dtksh/ksh93/man/man3/stk.3 -programs/dtksh/ksh93/man/man3/stk.3.old -programs/dtksh/ksh93/man/man3/strcopy.3 -programs/dtksh/ksh93/man/man3/strcopy.3.old -programs/dtksh/ksh93/man/man3/strdup.3 -programs/dtksh/ksh93/man/man3/strdup.3.old -programs/dtksh/ksh93/man/man3/strelapsed.3 -programs/dtksh/ksh93/man/man3/strelapsed.3.old -programs/dtksh/ksh93/man/man3/strerror.3 -programs/dtksh/ksh93/man/man3/strerror.3.old -programs/dtksh/ksh93/man/man3/stresc.3 -programs/dtksh/ksh93/man/man3/stresc.3.old -programs/dtksh/ksh93/man/man3/streval.3 -programs/dtksh/ksh93/man/man3/streval.3.old -programs/dtksh/ksh93/man/man3/strgid.3 -programs/dtksh/ksh93/man/man3/strgid.3.old -programs/dtksh/ksh93/man/man3/strmatch.3 -programs/dtksh/ksh93/man/man3/strmatch.3.old -programs/dtksh/ksh93/man/man3/stropt.3 -programs/dtksh/ksh93/man/man3/stropt.3.old -programs/dtksh/ksh93/man/man3/strperm.3 -programs/dtksh/ksh93/man/man3/strperm.3.old -programs/dtksh/ksh93/man/man3/strsignal.3 -programs/dtksh/ksh93/man/man3/strsignal.3.old -programs/dtksh/ksh93/man/man3/strsort.3 -programs/dtksh/ksh93/man/man3/strsort.3.old -programs/dtksh/ksh93/man/man3/strtape.3 -programs/dtksh/ksh93/man/man3/strtape.3.old -programs/dtksh/ksh93/man/man3/strton.3 -programs/dtksh/ksh93/man/man3/strton.3.old -programs/dtksh/ksh93/man/man3/struid.3 -programs/dtksh/ksh93/man/man3/struid.3.old -programs/dtksh/ksh93/man/man3/swap.3 -programs/dtksh/ksh93/man/man3/swap.3.old -programs/dtksh/ksh93/man/man3/tab.3 -programs/dtksh/ksh93/man/man3/tab.3.old -programs/dtksh/ksh93/man/man3/tm.3 -programs/dtksh/ksh93/man/man3/tm.3.old -programs/dtksh/ksh93/man/man3/tok.3 -programs/dtksh/ksh93/man/man3/tok.3.old -programs/dtksh/ksh93/man/man3/touch.3 -programs/dtksh/ksh93/man/man3/touch.3.old -programs/dtksh/ksh93/man/man3/vdelta.3 -programs/dtksh/ksh93/man/man3/vdelta.3.old -programs/dtksh/ksh93/man/man3/vecargs.3 -programs/dtksh/ksh93/man/man3/vecargs.3.old -programs/dtksh/ksh93/man/man3/vmalloc.3 -programs/dtksh/ksh93/man/man3/vmalloc.3.old -programs/dtksh/ksh93/ship/SHIPiffe.sh -programs/dtksh/ksh93/ship/SHIPin -programs/dtksh/ksh93/ship/SHIPop.c -programs/dtksh/ksh93/ship/SHIPprobe -programs/dtksh/ksh93/ship/SHIPproto.c -programs/dtksh/ksh93/ship/ksh93/950807/BUILT -programs/dtksh/ksh93/ship/ksh93/950807/ERROR -programs/dtksh/ksh93/ship/ksh93/in.log -programs/dtksh/ksh93/ship/lib0ast/950811/BUILT -programs/dtksh/ksh93/ship/lib0ast/950811/ERROR -programs/dtksh/ksh93/ship/lib0ast/in.log -programs/dtksh/ksh93/ship/libAST/930519/BUILT -programs/dtksh/ksh93/ship/libAST/930519/ERROR -programs/dtksh/ksh93/ship/libAST/in.log -programs/dtksh/ksh93/ship/libast/950811/BUILT -programs/dtksh/ksh93/ship/libast/950811/ERROR -programs/dtksh/ksh93/ship/libast/in.log -programs/dtksh/ksh93/ship/libcmd/950811/BUILT -programs/dtksh/ksh93/ship/libcmd/950811/ERROR -programs/dtksh/ksh93/ship/libcmd/in.log -programs/dtksh/ksh93/ship/libodelta/950811/BUILT -programs/dtksh/ksh93/ship/libodelta/950811/ERROR -programs/dtksh/ksh93/ship/libodelta/in.log -programs/dtksh/ksh93/ship/libvdelta/950811/BUILT -programs/dtksh/ksh93/ship/libvdelta/950811/ERROR -programs/dtksh/ksh93/ship/libvdelta/in.log -programs/dtksh/ksh93/ship/pax/950811/BUILT -programs/dtksh/ksh93/ship/pax/950811/ERROR -programs/dtksh/ksh93/ship/pax/in.log -programs/dtksh/ksh93/ship/shipiffe -programs/dtksh/ksh93/ship/shipop -programs/dtksh/ksh93/ship/shipproto -programs/dtksh/ksh93/src/cmd/ksh93/FEATURE/ -programs/dtksh/ksh93/src/cmd/ksh93/MAM.list -programs/dtksh/ksh93/src/cmd/ksh93/MAM.time -programs/dtksh/ksh93/src/cmd/ksh93/ksh -programs/dtksh/ksh93/src/cmd/ksh93/ksh.msg -programs/dtksh/ksh93/src/cmd/ksh93/shcomp -programs/dtksh/ksh93/src/cmd/ksh93/suid_exec -programs/dtksh/ksh93/src/cmd/pax/bax -programs/dtksh/ksh93/src/cmd/pax/cpio -programs/dtksh/ksh93/src/cmd/pax/nocom -programs/dtksh/ksh93/src/cmd/pax/pax -programs/dtksh/ksh93/src/cmd/pax/tar -programs/dtksh/ksh93/src/cmd/pax/FEATURE/ -programs/dtksh/ksh93/src/cmd/pax/MAM.list -programs/dtksh/ksh93/src/cmd/pax/MAM.time -programs/dtksh/ksh93/src/lib/lib0ast/MAM.list -programs/dtksh/ksh93/src/lib/lib0ast/MAM.time -programs/dtksh/ksh93/src/lib/lib0ast/hostinfo -programs/dtksh/ksh93/src/lib/lib0ast/prototyped.h -programs/dtksh/ksh93/src/lib/libAST/MAM.list -programs/dtksh/ksh93/src/lib/libAST/MAM.time -programs/dtksh/ksh93/src/lib/libAST/prototyped.h -programs/dtksh/ksh93/src/lib/libast/FEATURE/ -programs/dtksh/ksh93/src/lib/libast/MAM.list -programs/dtksh/ksh93/src/lib/libast/MAM.time -programs/dtksh/ksh93/src/lib/libast/align.h -programs/dtksh/ksh93/src/lib/libast/ast_botch.h -programs/dtksh/ksh93/src/lib/libast/ast_fcntl.h -programs/dtksh/ksh93/src/lib/libast/ast_fs.h -programs/dtksh/ksh93/src/lib/libast/ast_hdr.h -programs/dtksh/ksh93/src/lib/libast/ast_lib.h -programs/dtksh/ksh93/src/lib/libast/ast_mode.h -programs/dtksh/ksh93/src/lib/libast/ast_param.h -programs/dtksh/ksh93/src/lib/libast/ast_time.h -programs/dtksh/ksh93/src/lib/libast/ast_tty.h -programs/dtksh/ksh93/src/lib/libast/ast_types.h -programs/dtksh/ksh93/src/lib/libast/ast_unistd.h -programs/dtksh/ksh93/src/lib/libast/ast_wait.h -programs/dtksh/ksh93/src/lib/libast/conf -programs/dtksh/ksh93/src/lib/libast/conflib.h -programs/dtksh/ksh93/src/lib/libast/conflim.h -programs/dtksh/ksh93/src/lib/libast/confmap.c -programs/dtksh/ksh93/src/lib/libast/confmap.h -programs/dtksh/ksh93/src/lib/libast/confstr.c -programs/dtksh/ksh93/src/lib/libast/conftab.c -programs/dtksh/ksh93/src/lib/libast/conftab.h -programs/dtksh/ksh93/src/lib/libast/confuni.h -programs/dtksh/ksh93/src/lib/libast/int.h -programs/dtksh/ksh93/src/lib/libast/limits.h -programs/dtksh/ksh93/src/lib/libast/pathconf.c -programs/dtksh/ksh93/src/lib/libast/preroot.h -programs/dtksh/ksh93/src/lib/libast/sig.h -programs/dtksh/ksh93/src/lib/libast/sysconf.c -programs/dtksh/ksh93/src/lib/libcmd/FEATURE/ -programs/dtksh/ksh93/src/lib/libcmd/MAM.list -programs/dtksh/ksh93/src/lib/libcmd/MAM.time -programs/dtksh/ksh93/src/lib/libcmd/cmd.req -programs/dtksh/ksh93/src/lib/libodelta/MAM.list -programs/dtksh/ksh93/src/lib/libodelta/MAM.time -programs/dtksh/ksh93/src/lib/libvdelta/MAM.list -programs/dtksh/ksh93/src/lib/libvdelta/MAM.time # programs/dtlogin programs/dtlogin/config/0015.sun.env diff --git a/cde/Makefile b/cde/Makefile index da461ba50..d338a349e 100644 --- a/cde/Makefile +++ b/cde/Makefile @@ -21,6 +21,13 @@ MAKE_CMD = $(MAKE) $(MAKE_OPTS) NMAKE_CMD = $(NMAKE) $(MAKE_OPTS) FLAGS = $(MFLAGS) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)" +SUIDEXECDEFINES = \ + -DPROFILEPATH=\"$(CDE_CONFIGURATION_TOP)/config/profile\" \ + -DSUIDPROFILEPATH=\"$(CDE_CONFIGURATION_TOP)/config/suid_profile\" \ + -DSUIDEXECPATH=\"$(CDE_INSTALLATION_TOP)/bin/suid_exec\" \ + -DCDE_INSTALLATION_TOP=\"$(CDE_INSTALLATION_TOP)\" -DBUILD_DTKSH +CDE_CONFIGURATION_TOP = /etc/dt +CDE_INSTALLATION_TOP = /usr/dt all: @$(MAKE_CMD) xmakefile-exists || $(MAKE) all-initial @@ -51,6 +58,10 @@ World: ;; esac; @date @echo "" + # this is a weird glitch in the build process, will probably be solved + # with autotools conversion, but we need to build here for now + cd programs/dtksh/ksh93; ./bin/package clean + cd programs/dtksh/ksh93; ./bin/package make CCFLAGS='$(SUIDEXECDEFINES) -g' cd $(IMAKESRC) && $(MAKE) $(FLAGS) clean $(MAKE) $(MFLAGS) Makefile.boot $(MAKE_CMD) $(MFLAGS) VerifyOS diff --git a/cde/databases/CDE-MIN.udb b/cde/databases/CDE-MIN.udb index 409e26c11..8dcaaf651 100644 --- a/cde/databases/CDE-MIN.udb +++ b/cde/databases/CDE-MIN.udb @@ -214,7 +214,7 @@ programs/dtksh/dtksh mode = 0555 } # -programs/dtksh/ksh93/bin/suid_exec +programs/dtksh/suid_exec { default install_target = /usr/dt/bin/suid_exec owner = root diff --git a/cde/programs/dtksh/Imakefile b/cde/programs/dtksh/Imakefile index 8d6c3adcc..3750baabb 100644 --- a/cde/programs/dtksh/Imakefile +++ b/cde/programs/dtksh/Imakefile @@ -1,10 +1,47 @@ XCOMM $TOG: Imakefile /main/15 1998/04/07 08:55:29 mgreess $ DESKTOP_VERSION_STRING = DesktopVersionString +#define IHaveSubdirs +#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' + +SUBDIRS = examples + +MakeSubdirs($(SUBDIRS)) + +HOSTDIR = $(shell ./ksh93/bin/package host) + KSH93SRC = ./ksh93 + +SYS_LIBRARIES = -lm $(DYNLIBSYSLIB) $(REGEXSYSLIB) $(ICONVSYSLIB) + +#ifdef LinuxArchitecture +SYS_LIBRARIES = -lm -ldl +#endif + +#ifdef HPArchitecture +EXTRA_DEFINES = -Wl,-E -DHPUX_DYNLIB -Wp,-H12000 +SYS_LIBRARIES = -lm -ldld +#endif + +#ifdef RsArchitecture +EXTRA_DEFINES = -DDYNLIB -D_IBMRPC_ +LOCAL_LDFLAGS = -bE:dtksh.exp +#endif + +#ifdef SunArchitecture +.NO_PARALLEL: + +EXTRA_DEFINES = -DDYNLIB + +/* These need to be manually set for Solaris due to a bug in the build system */ +KSH_LDFLAGS = -lm -lsocket +#endif + DEPEND_DEFINES = $(DEPENDDEFINES) -INCLUDES = -I. -I$(KSH93SRC)/include/ast -I$(KSH93SRC)/src/cmd/ksh93/include \ - -I$(KSH93SRC)/src/cmd/ksh93 $(TIRPCINC) +INCLUDES = -I. -I$(KSH93SRC)/arch/$(HOSTDIR)/include/ast \ + -I$(KSH93SRC)/arch/$(HOSTDIR)/src/cmd/ksh93 \ + -I$(KSH93SRC)/src/cmd/ksh93/include -I$(KSH93SRC)/src/cmd/ksh93 \ + -I$(KSH93SRC)/src/lib/libast/include $(TIRPCINC) /* DEPLIBS contains the list of library depencies for a client. * LOCAL_LIBRARIES contains the list of libraries on the link line. @@ -17,51 +54,28 @@ INCLUDES = -I. -I$(KSH93SRC)/include/ast -I$(KSH93SRC)/src/cmd/ksh93/include \ */ DEPLIBS = $(DEPDTHELPLIB) $(DEPDTSVCLIB) $(DEPDTWIDGETLIB) $(DEPDTPRINTLIB) \ $(DEPTTLIB) $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB) \ - $(KSH93SRC)/lib/libast.a + $(KSH93SRC)/arch/$(HOSTDIR)/lib/libast.a LOCAL_LIBRARIES = $(DTHELPLIB) $(DTWIDGETLIB) $(DTSVCLIB) $(DTPRINTLIB) \ $(TTLIB) $(XMLIB) $(XTOOLLIB) $(XLIB) \ - $(KSH93SRC)/lib/libcmd.a $(KSH93SRC)/lib/libast.a + $(KSH93SRC)/arch/$(HOSTDIR)/lib/libcmd.a \ + $(KSH93SRC)/arch/$(HOSTDIR)/lib/libast.a \ + $(KSH93SRC)/arch/$(HOSTDIR)/lib/libdll.a libshell.a -SYS_LIBRARIES = -lm $(DYNLIBSYSLIB) $(REGEXSYSLIB) $(ICONVSYSLIB) - -#ifdef HPArchitecture -EXTRA_DEFINES = -Wl,-E -DHPUX_DYNLIB -Wp,-H12000 -SYS_LIBRARIES = -lm -ldld -#endif - -#ifdef RsArchitecture -EXTRA_DEFINES = -DDYNLIB -D_IBMRPC_ -LOCAL_LDFLAGS = -bE:dtksh.exp -#endif - -#if defined (SunArchitecture) -EXTRA_DEFINES = -DDYNLIB -#endif +EXTRA_DEFINES = -DDYNLIB -DKSHELL -DSHOPT_RAWONLY EXTRA_INCLUDES = -I$(DTHELPSRC) -I$(DTPRINTSRC) -#ifdef SunArchitecture -.NO_PARALLEL: -#endif +SUIDEXECDEFINES = \ + -DPROFILEPATH=\"$(CDE_CONFIGURATION_TOP)/config/profile\" \ + -DSUIDPROFILEPATH=\"$(CDE_CONFIGURATION_TOP)/config/suid_profile\" \ + -DSUIDEXECPATH=\"$(CDE_INSTALLATION_TOP)/bin/suid_exec\" \ + -DCDE_INSTALLATION_TOP=\"$(CDE_INSTALLATION_TOP)\" -DBUILD_DTKSH -#ifdef LinuxArchitecture -SYS_LIBRARIES = -lm -ldl -#endif - -#define IHaveSubdirs -#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' - -SUBDIRS = examples ksh93 -KSH93OBJ = $(KSH93SRC)/ksh93.o - -MakeSubdirs($(SUBDIRS)) - -KSH93LIBSHELL = $(KSH93SRC)/src/cmd/ksh93/libshell.a +KSH93LIBSHELL = $(KSH93SRC)/arch/$(HOSTDIR)/lib/libshell.a PROGRAMS = dtksh -SRCS = \ - userinit.c \ +SRCS = init.c \ builtins.c \ widget.c \ dtkcvt.c \ @@ -76,7 +90,7 @@ SRCS = \ msgs.c OBJS = \ - $(KSH93OBJ) \ + pmain.o \ libshell.a \ widget.o \ dtkcvt.o \ @@ -93,24 +107,19 @@ OBJS = \ all:: dtksh -$(KSH93SRC)/ksh93.o: - cd $(KSH93SRC); $(MAKE) - -XCOMM -XCOMM Must replace standard ksh tables of builtins and aliases -XCOMM with our augmented versions. -XCOMM - -libshell.a: $(KSH93SLIBSHELL) userinit.o builtins.o +libshell.a: $(KSH93LIBSHELL) init.o builtins.o $(CP) $(KSH93LIBSHELL) libshell.a; \ - ar d libshell.a userinit.o builtins.o ; \ - $(AR) libshell.a userinit.o builtins.o + ar d libshell.a init.o builtins.o; \ + $(AR) libshell.a init.o builtins.o -SpecialObjectRule(userinit.o,$(NULL),-DSHOPT_VSH -DKSHELL -D_TRACE_ ) -SpecialObjectRule(builtins.o,$(NULL),-DSHOPT_VSH -DKSHELL -D_TRACE_ ) +pmain.o: + cp ./ksh93/arch/$(HOSTDIR)/src/cmd/ksh93/pmain.o pmain.o + cp ./ksh93/arch/$(HOSTDIR)/bin/suid_exec suid_exec + +SpecialObjectRule(init.o, $(NULL), -DSHOPT_STATS -DSHOPT_NAMESPACE -DSHOPT_2DMATCH -DSHOPT_PFSH -DSHOPT_MULTIBYTE -DSHOPT_BGX -DSHOPT_AUDIT '-D_API_ast=20100309' -D_PACKAGE_ast -DSHOPT_DYNAMIC -D_BLD_shell -DSHOPT_KIA -DKSHELL -DSHOPT_HISTEXPAND -DSHOPT_EDPREDICT -DSHOPT_ESH -DSHOPT_VSH -DSHOPT_FIXEDARRAY '-DERROR_CONTEXT_T=Error_context_t' -DSHOPT_SUID_EXEC -DSHOPT_BRACEPAT -DBUILD_DTKSH -l$(KSH93SRC)/arch/$(HOSTDIR)/lib/libcmd.a -l$(KSH93SRC)/arch/$(HOSTDIR)/lib/libast.a -l$(KSH93SRC)/arch/$(HOSTDIR)/lib/libdll.a) +SpecialObjectRule(builtins.o, $(NULL), -DSHOPT_TYPEDEF -DSHOPT_KIA -DSHOPT_PFSH -DSHOPT_BRACEPAT -DSHOPT_HISTEXPAND '-D_API_ast=20100309' -D_PACKAGE_ast -DSHOPT_BGX -DSHOPT_MULTIBYTE -D_BLD_shell -DSHOPT_DYNAMIC -DKSHELL -DSHOPT_FIXEDARRAY -DSHOPT_STATS -DSHOPT_NAMESPACE '-DERROR_CONTEXT_T=Error_context_t' -DSHOPT_ESH -DBUILD_DTKSH -l$(KSH93SRC)/arch/$(HOSTDIR)/lib/libcmd.a -l$(KSH93SRC)/arch/$(HOSTDIR)/lib/libast.a -l$(KSH93SRC)/arch/$(HOSTDIR)/lib/libdll.a) ComplexProgramTarget($(PROGRAMS)) clean:: - @echo " Cleaning ksh directories" - $(SHELL) MakeClean + rm -f suid_exec diff --git a/cde/programs/dtksh/MakeClean b/cde/programs/dtksh/MakeClean deleted file mode 100755 index 229299704..000000000 --- a/cde/programs/dtksh/MakeClean +++ /dev/null @@ -1,131 +0,0 @@ -#! /bin/ksh - -echo -find . -name MAM.time -print -exec rm -f {} \; -echo -echo "******************" -echo -find . -name in.log -print -exec rm -f {} \; -echo -echo "******************" -echo -find . -name \*.a -print -exec rm -f {} \; -echo -echo "******************" -echo -find . -name \*.o -print -exec rm -f {} \; -echo -echo "******************" -echo -find . -name BUILT -print -exec rm -f {} \; -echo -echo "******************" -echo -find . -name ERROR -print -exec rm -f {} \; -echo -echo "******************" -echo -echo "rm ksh93/bin/*" -rm -f ksh93/bin/feature -rm -f ksh93/bin/iffe -rm -f ksh93/bin/ignore -rm -f ksh93/bin/pax -rm -f ksh93/bin/bax -rm -f ksh93/bin/pax.save -rm -f ksh93/bin/proto -rm -f ksh93/bin/silent -rm -f ksh93/bin/suid_exec -rm -f ksh93/bin/shcomp -rm -f ksh93/bin/nocom -rm -f ksh93/bin/*.old -echo -echo "rm ksh93/src/cmd/ksh93/suid_exec" -rm -f ksh93/src/cmd/ksh93/suid_exec -echo "rm ksh93/src/cmd/ksh93/shcomp" -rm -f ksh93/src/cmd/ksh93/shcomp -echo "rm ksh93/src/cmd/ksh93/ksh.msg" -rm -f ksh93/src/cmd/ksh93/ksh.msg -echo "rm ksh93/src/cmd/pax/pax" -rm -f ksh93/src/cmd/pax/pax -echo "rm ksh93/src/cmd/pax/bax" -rm -f ksh93/src/cmd/pax/bax -echo "rm ksh93/src/cmd/pax/nocom" -rm -f ksh93/src/cmd/pax/nocom -echo "rm ksh93/src/cmd/pax/cpio" -rm -f ksh93/src/cmd/pax/cpio -echo "rm ksh93/src/cmd/pax/tar" -rm -f ksh93/src/cmd/pax/tar -#echo "rm ksh93/src/lib/libcmd/cmd.h" -#rm -f ksh93/src/lib/libcmd/cmd.h -echo "rm ksh93/src/lib/libcmd/cmd.req" -rm -f ksh93/src/lib/libcmd/cmd.req -echo "rm ksh93/src/cmd/ksh" -rm -f ksh93/src/cmd/ksh -echo "rm ksh93/bin/ksh" -rm -f ksh93/bin/ksh -echo "rm ksh93/ship/shipslog/!t_gryphon_dgk" -rm -f ksh93/ship/shipslog/!t_gryphon_dgk -echo "rm ksh93/ship/shipslog/!t_gryphon_gsf" -rm -f ksh93/ship/shipslog/!t_gryphon_gsf - -echo "rm ksh93/src/cmd/ksh93/FEATURE/*" -rm -f ksh93/src/cmd/ksh93/FEATURE/* -echo "mkdir ksh93/src/cmd/ksh93/FEATURE" -mkdir -p ksh93/src/cmd/ksh93/FEATURE -echo "cp /dev/null ksh93/src/cmd/ksh93/FEATURE/options" -cp /dev/null ksh93/src/cmd/ksh93/FEATURE/options -echo "cp /dev/null ksh93/src/cmd/ksh93/FEATURE/setjmp" -cp /dev/null ksh93/src/cmd/ksh93/FEATURE/setjmp -echo "cp /dev/null ksh93/src/cmd/ksh93/FEATURE/sigfeatures" -cp /dev/null ksh93/src/cmd/ksh93/FEATURE/sigfeatures -echo "cp /dev/null ksh93/src/cmd/ksh93/FEATURE/dynamic" -cp /dev/null ksh93/src/cmd/ksh93/FEATURE/dynamic - -echo "mkdir ksh93/include/ast" -mkdir -p ksh93/include/ast -echo "cp /dev/null ksh93/include/ast/ast.h" -cp /dev/null ksh93/include/ast/ast.h -echo "cp /dev/null ksh93/include/ast/cmd.h" -cp /dev/null ksh93/include/ast/cmd.h -echo "cp /dev/null ksh93/include/ast/error.h" -cp /dev/null ksh93/include/ast/error.h -echo "cp /dev/null ksh93/include/ast/hash.h" -cp /dev/null ksh93/include/ast/hash.h -echo "cp /dev/null ksh93/include/ast/option.h" -cp /dev/null ksh93/include/ast/option.h -echo "cp /dev/null ksh93/include/ast/sfio.h" -cp /dev/null ksh93/include/ast/sfio.h -echo "cp /dev/null ksh93/include/ast/sig.h" -cp /dev/null ksh93/include/ast/sig.h -echo "cp /dev/null ksh93/include/ast/stak.h" -cp /dev/null ksh93/include/ast/stak.h - -echo "rm ksh93/src/cmd/pax/FEATURE/*" -rm -f ksh93/src/cmd/pax/FEATURE/* - -echo "rm ksh93/src/lib/libast/FEATURE/*" -rm -f ksh93/src/lib/libast/FEATURE/* - -echo "rm ksh93/src/lib/libcmd/FEATURE/*" -rm -f ksh93/src/lib/libcmd/FEATURE/* - -echo "rm ksh93/src/lib/libast/*.h" -rm -f ksh93/src/lib/libast/*.h - -echo "rm ksh93/src/lib/libast/conf" -rm -f ksh93/src/lib/libast/conf - -echo "rm ksh93/src/lib/lib0ast/hostinfo" -rm -f ksh93/src/lib/lib0ast/hostinfo - -echo "rm ksh93/src/cmd/ksh93/ksh" -rm -f ksh93/src/cmd/ksh93/ksh - -echo "rm ksh93/ship/SHIP*" -rm -f ksh93/ship/SHIP* - -echo "rm ksh93/ship/shipfeature" -rm -f ksh93/ship/shipfeature - -echo "rm ksh93/ship/shipproto" -rm -f ksh93/ship/shipproto diff --git a/cde/programs/dtksh/README-DEVELOPER b/cde/programs/dtksh/README-DEVELOPER index 10ce00e64..af5667d2b 100644 --- a/cde/programs/dtksh/README-DEVELOPER +++ b/cde/programs/dtksh/README-DEVELOPER @@ -1,5 +1,13 @@ /* $XConsortium: README-DEVELOPER /main/3 1996/07/15 14:12:13 drk $ */ +(NOTE: As of CDE 2.3.1 and later, this entire document is obsolete and only kept + for historical purposes, the updating process has been streamlined to a simple + three step process: + 1. cd ksh93; git pull + 2. Merge upstream init.c with ours, keeping all of our changes. + 3. Merge upstream builtins.c. doing the same as init.c + and thats all there is to it.) + IMPORTANT!!! PLEASE READ ON!! ------------------------------ diff --git a/cde/programs/dtksh/XtCvtrs.c b/cde/programs/dtksh/XtCvtrs.c index 570b9586e..3807d1abf 100644 --- a/cde/programs/dtksh/XtCvtrs.c +++ b/cde/programs/dtksh/XtCvtrs.c @@ -49,11 +49,11 @@ SOFTWARE. /* Conversion.c - implementations of resource type conversion procs */ +#include #include #include #include #include -#include "stdio.h" #include #include #include "msgs.h" diff --git a/cde/programs/dtksh/builtins.c b/cde/programs/dtksh/builtins.c index b2683d90a..a78210c16 100644 --- a/cde/programs/dtksh/builtins.c +++ b/cde/programs/dtksh/builtins.c @@ -1,123 +1,51 @@ -/* - * CDE - Common Desktop Environment - * - * Copyright (c) 1993-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these libraries and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - */ -/* $XConsortium: builtins.c /main/3 1995/11/01 15:50:47 rswiston $ */ -/*************************************************************** -* * -* AT&T - PROPRIETARY * -* * -* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF * -* AT&T BELL LABORATORIES * -* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN * -* ACCORDANCE WITH APPLICABLE AGREEMENTS * -* * -* Copyright (c) 1994 AT&T Bell Laboratories * -* Unpublished & Not for Publication * -* All Rights Reserved * -* * -* The copyright notice above does not evidence any * -* actual or intended publication of such source code * -* * -* This software was created by the * -* Advanced Software Technology Department * -* AT&T Bell Laboratories * -* * -* For further information contact * -* {research,attmail}!dgk * -* dgk@research.att.com * -* David Korn 908-582-7975 * -* * -***************************************************************/ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1982-2012 AT&T Intellectual Property * +* and is licensed under the * +* Eclipse Public License, Version 1.0 * +* by AT&T Intellectual Property * +* * +* A copy of the License is available at * +* http://www.eclipse.org/org/documents/epl-v10.html * +* (with md5 checksum b35adb5213ca9657e911e9befb180842) * +* * +* Information and Software Systems Research * +* AT&T Research * +* Florham Park NJ * +* * +* David Korn * +* * +***********************************************************************/ +#pragma prototyped -/* : : generated by proto : : */ -#line 1 - -#if !defined(__PROTO__) -#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) -#if defined(__cplusplus) -#define __MANGLE__ "C" -#else -#define __MANGLE__ -#endif -#define __STDARG__ -#define __PROTO__(x) x -#define __OTORP__(x) -#define __PARAM__(n,o) n -#if !defined(__STDC__) && !defined(__cplusplus) -#if !defined(c_plusplus) -#define const -#endif -#define signed -#define void int -#define volatile -#define __V_ char -#else -#define __V_ void -#endif -#else -#define __PROTO__(x) () -#define __OTORP__(x) x -#define __PARAM__(n,o) o -#define __MANGLE__ -#define __V_ char -#define const -#define signed -#define void int -#define volatile -#endif -#if defined(__cplusplus) || defined(c_plusplus) -#define __VARARG__ ... -#else -#define __VARARG__ -#endif -#if defined(__STDARG__) -#define __VA_START__(p,a) va_start(p,a) -#else -#define __VA_START__(p,a) va_start(p) -#endif -#endif - -#line 3 -#define mount _AST_mount -#include -#include +#include "defs.h" #include "shtable.h" +#include +#include "ulimit.h" #include "name.h" -#ifdef KSHELL +#include "version.h" +#if KSHELL # include "builtins.h" # include "jobs.h" # include "FEATURE/cmds" -#if defined(__STDC__) || defined(__STDPP__) # define bltin(x) (b_##x) -#else -# define bltin(x) (b_/**/x) -#endif - -#line 13 + /* The following is for builtins that do not accept -- options */ +# define Bltin(x) (B_##x) #else # define bltin(x) 0 #endif +#ifndef SHOPT_CMDLIB_DIR +# define SHOPT_CMDLIB_DIR SH_CMDLIB_DIR +#else +# ifndef SHOPT_CMDLIB_HDR +# define SHOPT_CMDLIB_HDR +# endif +#endif + +#ifdef BUILD_DTKSH #include #include #include @@ -127,174 +55,2036 @@ #include "dtextra.h" #include "xmextra.h" #include "msgs.h" +#endif +#define USAGE_LICENSE "[-author?David Korn ][-copyright?Copyright (c) 1982-2012 AT&T Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?libshell]" + +#define Q(f) #f /* libpp cpp workaround -- fixed 2005-04-11 */ +#define CMDLIST(f) SH_CMDLIB_DIR "/" Q(f), NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f), + +#undef basename +#undef dirname /* - * The order up through "[" is significant + * IMPORTANT: The order of these struct members must be synchronous + * with the offsets on the macros defined in include/builtins.h! + * The order up through "local" is significant. */ const struct shtable3 shtab_builtins[] = { - "login", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(login), "exec", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(exec), + "redirect", NV_BLTIN|BLT_ENV, bltin(exec), "set", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(set), ":", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(true), "true", NV_BLTIN|BLT_ENV, bltin(true), "command", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(command), "cd", NV_BLTIN|BLT_ENV, bltin(cd), - "break", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(brk_cont), - "continue", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(brk_cont), + "break", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(break), + "continue", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(break), "typeset", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(typeset), - "test", NV_BLTIN|BLT_ENV|NV_NOFREE, bltin(test), + "autoload", NV_BLTIN|BLT_ENV, bltin(typeset), + "compound", NV_BLTIN|BLT_ENV|BLT_DCL, bltin(typeset), + "float", NV_BLTIN|BLT_ENV|BLT_DCL, bltin(typeset), + "functions", NV_BLTIN|BLT_ENV, bltin(typeset), + "integer", NV_BLTIN|BLT_ENV|BLT_DCL, bltin(typeset), + "nameref", NV_BLTIN|BLT_ENV|BLT_DCL, bltin(typeset), + "test", NV_BLTIN|BLT_ENV, bltin(test), "[", NV_BLTIN|BLT_ENV, bltin(test), -#ifdef _bin_newgrp - "newgrp", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(login), -#endif /* _bin_newgrp */ + "let", NV_BLTIN|BLT_ENV, bltin(let), + "export", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(readonly), ".", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(dot_cmd), - "alias", NV_BLTIN|BLT_SPC|BLT_DCL, bltin(alias), - "hash", NV_BLTIN|BLT_SPC|BLT_DCL, bltin(alias), - "exit", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(ret_exit), - "export", NV_BLTIN|BLT_SPC|BLT_DCL, bltin(read_export), + "source", NV_BLTIN|BLT_ENV, bltin(dot_cmd), + "return", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(return), +#if SHOPT_BASH + "local", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(typeset), +#endif +/* + * Builtins without offset macros in include/builtins.h follow. + */ + "alias", NV_BLTIN|BLT_ENV, bltin(alias), + "hash", NV_BLTIN|BLT_ENV, bltin(alias), + "enum", NV_BLTIN|BLT_ENV|BLT_DCL, bltin(enum), "eval", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_EXIT,bltin(eval), - "fc", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(hist), + "exit", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(return), + "fc", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(hist), "hist", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(hist), - "readonly", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(read_export), - "return", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(ret_exit), + "history", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(hist), + "r", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(hist), + "readonly", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(readonly), "shift", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(shift), "trap", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(trap), - "unalias", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(unalias), + "unalias", NV_BLTIN|BLT_ENV, bltin(unalias), "unset", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(unset), "builtin", NV_BLTIN, bltin(builtin), -#ifdef SHOPT_ECHOPRINT +#if SHOPT_ECHOPRINT "echo", NV_BLTIN|BLT_ENV, bltin(print), #else - "echo", NV_BLTIN|BLT_ENV, bltin(echo), + "echo", NV_BLTIN|BLT_ENV, Bltin(echo), #endif /* SHOPT_ECHOPRINT */ #ifdef JOBS # ifdef SIGTSTP - "bg", NV_BLTIN|BLT_ENV, bltin(bg_fg), - "fg", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(bg_fg), - "disown", NV_BLTIN|BLT_ENV, bltin(bg_fg), - "kill", NV_BLTIN|BLT_ENV|NV_NOFREE, bltin(kill), + "bg", NV_BLTIN|BLT_ENV, bltin(bg), + "fg", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(bg), + "disown", NV_BLTIN|BLT_ENV, bltin(bg), + "kill", NV_BLTIN|BLT_ENV, bltin(kill), # else - "/bin/kill", NV_BLTIN|BLT_ENV|NV_NOFREE, bltin(kill), + "/bin/kill", NV_BLTIN|BLT_ENV, bltin(kill), # endif /* SIGTSTP */ "jobs", NV_BLTIN|BLT_ENV, bltin(jobs), +# ifdef SIGSTOP + "stop", NV_BLTIN|BLT_ENV, bltin(kill), + "suspend", NV_BLTIN|BLT_ENV, bltin(suspend), +# endif /* SIGSTOP */ #endif /* JOBS */ "false", NV_BLTIN|BLT_ENV, bltin(false), - "getconf", NV_BLTIN|BLT_ENV, bltin(getconf), "getopts", NV_BLTIN|BLT_ENV, bltin(getopts), - "let", NV_BLTIN|BLT_ENV, bltin(let), "print", NV_BLTIN|BLT_ENV, bltin(print), - "printf", NV_BLTIN|NV_NOFREE, bltin(printf), - "pwd", NV_BLTIN|NV_NOFREE, bltin(pwd), + "printf", NV_BLTIN|BLT_ENV, bltin(printf), + "pwd", NV_BLTIN, bltin(pwd), "read", NV_BLTIN|BLT_ENV, bltin(read), - "sleep", NV_BLTIN|NV_NOFREE, bltin(sleep), + "sleep", NV_BLTIN, bltin(sleep), "alarm", NV_BLTIN, bltin(alarm), + "times", NV_BLTIN|BLT_SPC, bltin(times), "ulimit", NV_BLTIN|BLT_ENV, bltin(ulimit), "umask", NV_BLTIN|BLT_ENV, bltin(umask), #ifdef _cmd_universe "universe", NV_BLTIN|BLT_ENV, bltin(universe), #endif /* _cmd_universe */ -#ifdef SHOPT_FS_3D - "vpath", NV_BLTIN|BLT_ENV, bltin(vpath_map), - "vmap", NV_BLTIN|BLT_ENV, bltin(vpath_map), -#endif /* SHOPT_FS_3D */ "wait", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(wait), - "type", NV_BLTIN|BLT_ENV, bltin(whence), + "type", NV_BLTIN|BLT_ENV, bltin(whence), "whence", NV_BLTIN|BLT_ENV, bltin(whence), - "/bin/basename",NV_BLTIN|NV_NOFREE, bltin(basename), - "/bin/chmod", NV_BLTIN|NV_NOFREE, bltin(chmod), - "/bin/dirname", NV_BLTIN|NV_NOFREE, bltin(dirname), - "/bin/head", NV_BLTIN|NV_NOFREE, bltin(head), - "/bin/mkdir", NV_BLTIN|NV_NOFREE, bltin(mkdir), -#if defined(_usr_bin_logname) && !defined(_bin_logname) - "/usr/bin/logname", NV_BLTIN|NV_NOFREE, bltin(logname), +#ifdef SHOPT_CMDLIB_HDR +#undef mktemp /* undo possible map-libc mktemp => _ast_mktemp */ +#include SHOPT_CMDLIB_HDR #else - "/bin/logname", NV_BLTIN|NV_NOFREE, bltin(logname), + CMDLIST(basename) + CMDLIST(chmod) + CMDLIST(dirname) + CMDLIST(getconf) + CMDLIST(head) + CMDLIST(mkdir) + CMDLIST(logname) + CMDLIST(cat) + CMDLIST(cmp) + CMDLIST(cut) + CMDLIST(uname) + CMDLIST(wc) + CMDLIST(sync) +#if !_std_malloc && !_AST_std_malloc + CMDLIST(vmstate) #endif - "/bin/cat", NV_BLTIN|NV_NOFREE, bltin(cat), - "/bin/cmp", NV_BLTIN|NV_NOFREE, bltin(cmp), -#if defined(_usr_bin_cut) && !defined(_bin_cut) - "/usr/bin/cut", NV_BLTIN|NV_NOFREE, bltin(cut), -#else - "/bin/cut", NV_BLTIN|NV_NOFREE, bltin(cut), #endif - "/bin/uname", NV_BLTIN|NV_NOFREE, bltin(uname), -#if defined(_usr_bin_wc) && !defined(_bin_wc) - "/usr/bin/wc", NV_BLTIN|NV_NOFREE, bltin(wc), -#else -# if defined(_usr_ucb_wc) && !defined(_bin_wc) - "/usr/ucb/wc", NV_BLTIN|NV_NOFREE, bltin(wc), -# else - "/bin/wc", NV_BLTIN|NV_NOFREE, bltin(wc), -# endif +#if SHOPT_REGRESS + "__regress__", NV_BLTIN|BLT_ENV, bltin(__regress__), +#endif +#ifdef BUILD_DTKSH + DTK_EXTRA_TABLE + DTK_EXTRA_TABLE2 + DTK_TK_EXTRA_TABLE + DTK_TK_LIST_TABLE + DTK_TK_TEXT_TABLE #endif -DTK_EXTRA_TABLE -DTK_EXTRA_TABLE2 -DTK_TK_EXTRA_TABLE -DTK_TK_LIST_TABLE -DTK_TK_TEXT_TABLE "", 0, 0 }; +#define _JOB_ "[+?Each \ajob\a can be specified as one of the following:]{" \ + "[+\anumber\a?\anumber\a refers to a process id.]" \ + "[+-\anumber\a?\anumber\a refers to a process group id.]" \ + "[+%\anumber\a?\anumber\a refer to a job number.]" \ + "[+%\astring\a?Refers to a job whose name begins with \astring\a.]" \ + "[+%??\astring\a?Refers to a job whose name contains \astring\a.]" \ + "[+%+ \bor\b %%?Refers to the current job.]" \ + "[+%-?Refers to the previous job.]" \ + "}" + + +const char sh_set[] = +"[a?Set the export attribute for each variable whose name does not " + "contain a \b.\b that you assign a value in the current shell " + "environment.]" +"[b?The shell writes a message to standard error as soon it detects that " + "a background job completes rather than waiting until the next prompt.]" +"[e?A simple command that has an non-zero exit status will cause the shell " + "to exit unless the simple command is:]{" + "[++?contained in an \b&&\b or \b||\b list.]" + "[++?the command immediately following \bif\b, \bwhile\b, or \buntil\b.]" + "[++?contained in the pipeline following \b!\b.]" +"}" +"[f?Pathname expansion is disabled.]" +"[h?Obsolete. Causes each command whose name has the syntax of an " + "alias to become a tracked alias when it is first encountered.]" +"[k?This is obsolete. All arguments of the form \aname\a\b=\b\avalue\a " + "are removed and placed in the variable assignment list for " + "the command. Ordinarily, variable assignments must precede " + "command arguments.]" +"[m?When enabled, the shell runs background jobs in a separate process " + "group and displays a line upon completion. This mode is enabled " + "by default for interactive shells on systems that support job " + "control.]" +"[n?The shell reads commands and checks for syntax errors, but does " + "not execute the command. Usually specified on command invocation.]" +"[o]:?[option?If \aoption\a is not specified, the list of options and " + "their current settings will be written to standard output. When " + "invoked with a \b+\b the options will be written in a format " + "that can be reinput to the shell to restore the settings. " + "Options \b-o\b \aname\a can also be specified with \b--\b\aname\a " + "and \b+o \aname\a can be specified with \b--no\b\aname\a except that " + "options names beginning with \bno\b are turned on by omitting \bno\b." + "This option can be repeated to enable/disable multiple options. " + "The value of \aoption\a must be one of the following:]{" + "[+allexport?Equivalent to \b-a\b.]" + "[+bgnice?Runs background jobs at lower priorities.]" + "[+braceexpand?Equivalent to \b-B\b.] " + "[+emacs?Enables/disables \bemacs\b editing mode.]" + "[+errexit?Equivalent to \b-e\b.]" + "[+globstar?Equivalent to \b-G\b.]" + "[+gmacs?Enables/disables \bgmacs\b editing mode. \bgmacs\b " + "editing mode is the same as \bemacs\b editing mode " + "except for the handling of \b^T\b.]" +#if SHOPT_BASH + "[+hashall?Equivalent to \b-h\b and \b-o trackall\b. Available " + "in bash compatibility mode only.]" + "[+history?Enable command history. Available in bash " + "compatibility mode only. On by default in interactive " + "shells.]" +#endif +#if SHOPT_HISTEXPAND + "[+histexpand?Equivalent to \b-H\b.]" +#endif + "[+ignoreeof?Prevents an interactive shell from exiting on " + "reading an end-of-file.]" + "[+keyword?Equivalent to \b-k\b.]" + "[+letoctal?The \blet\b builtin recognizes octal constants " + "with leading 0.]" + "[+markdirs?A trailing \b/\b is appended to directories " + "resulting from pathname expansion.]" + "[+monitor?Equivalent to \b-m\b.]" + "[+multiline?Use multiple lines when editing lines that are " + "longer than the window width.]" + "[+noclobber?Equivalent to \b-C\b.]" + "[+noexec?Equivalent to \b-n\b.]" + "[+noglob?Equivalent to \b-f\b.]" + "[+nolog?This has no effect. It is provided for backward " + "compatibility.]" + "[+notify?Equivalent to \b-b\b.]" + "[+nounset?Equivalent to \b-u\b.]" +#if SHOPT_BASH + "[+onecmd?Equivalent to \b-t\b. Available in bash compatibility " + "mode only.]" + "[+physical?Equivalent to \b-P\b. Available in bash " + "compatibility mode only.]" + "[+posix?Turn on POSIX compatibility. Available in bash " + "compatibility mode only. Bash in POSIX mode is not the " + "same as ksh.]" +#endif + "[+pipefail?A pipeline will not complete until all components " + "of the pipeline have completed, and the exit status " + "of the pipeline will be the value of the last " + "command to exit with non-zero exit status, or will " + "be zero if all commands return zero exit status.]" + "[+privileged?Equivalent to \b-p\b.]" + "[+rc?Do not run the \b.kshrc\b file for interactive shells.]" + "[+showme?Simple commands preceded by a \b;\b will be traced " + "as if \b-x\b were enabled but not executed.]" + "[+trackall?Equivalent to \b-h\b.]" + "[+verbose?Equivalent to \b-v\b.]" + "[+vi?Enables/disables \bvi\b editing mode.]" + "[+viraw?Does not use canonical input mode when using \bvi\b " + "edit mode.]" + "[+xtrace?Equivalent to \b-x\b.]" +"}" +"[p?Privileged mode. Disabling \b-p\b sets the effective user id to the " + "real user id, and the effective group id to the real group id. " + "Enabling \b-p\b restores the effective user and group ids to their " + "values when the shell was invoked. The \b-p\b option is on " + "whenever the real and effective user id is not equal or the " + "real and effective group id is not equal. User profiles are " + "not processed when \b-p\b is enabled.]" +"[r?restricted. Enables restricted shell. This option cannot be unset once " + "enabled.]" +"[t?Obsolete. The shell reads one command and then exits.]" +"[u?If enabled, the shell displays an error message when it tries to expand " + "a variable that is unset.]" +"[v?Verbose. The shell displays its input onto standard error as it " + "reads it.]" +"[x?Execution trace. The shell will display each command after all " + "expansion and before execution preceded by the expanded value " + "of the \bPS4\b parameter.]" +#if SHOPT_BASH + "\fbash1\f" +#endif +#if SHOPT_BRACEPAT +"[B?Enable {...} group expansion. On by default.]" +#endif +"[C?Prevents existing regular files from being overwritten using the \b>\b " + "redirection operator. The \b>|\b redirection overrides this " + "\bnoclobber\b option.]" +"[G?Causes \b**\b by itself to also match all sub-directories during pathname " + "expansion.]" +#if SHOPT_HISTEXPAND + "[H?Enable \b!\b-style history expansion similar to \bcsh\b.]" +#endif +; + +const char sh_optbreak[] = +"[-1c?\n@(#)$Id: break (AT&T Research) 1999-04-07 $\n]" +USAGE_LICENSE +"[+NAME?break - break out of loop ]" +"[+DESCRIPTION?\bbreak\b is a shell special built-in that exits the " + "smallest enclosing \bfor\b, \bselect\b, \bwhile\b, or \buntil\b loop, " + "or the \an\a-th enclosing loop if \an\a is specified. " + "Execution continues at the command following the loop(s).]" +"[+?If \an\a is given, it must be a positive integer >= 1. If \an\a " + "is larger than the number of enclosing loops, the last enclosing " + "loop will be exited.]" +"\n" +"\n[n]\n" +"\n" +"[+EXIT STATUS?0]" +"[+SEE ALSO?\bcontinue\b(1), \breturn\b(1)]" +; + +const char sh_optcont[] = +"[-1c?\n@(#)$Id: continue (AT&T Research) 1999-04-07 $\n]" +USAGE_LICENSE +"[+NAME?continue - continue execution at top of the loop]" +"[+DESCRIPTION?\bcontinue\b is a shell special built-in that continues " + "execution at the top of smallest enclosing enclosing \bfor\b, " + "\bselect\b, \bwhile\b, or \buntil\b loop, if any; or the top of " + "the \an\a-th enclosing loop if \an\a is specified.]" +"[+?If \an\a is given, it must be a positive integer >= 1. If \an\a " + "is larger than the number of enclosing loops, the last enclosing " + " loop will be used.]" + +"\n" +"\n[n]\n" +"\n" +"[+SEE ALSO?\bbreak\b(1)]" +; + const char sh_optalarm[] = "r [varname seconds]"; -const char sh_optalias[] = "ptx [name=[value]...]"; -const char sh_optbuiltin[] = "dsf:[library] [name...]"; -const char sh_optcd[] = "LP [dir] [change]"; -const char sh_optcflow[] = " [n]"; -const char sh_optcommand[] = "pvV name [arg]..."; -const char sh_optdot[] = " name [arg...]"; +const char sh_optalias[] = +"[-1c?\n@(#)$Id: alias (AT&T Research/ksh93) 2020-06-10 $\n]" +USAGE_LICENSE +"[+NAME?alias - define or display aliases]" +"[+DESCRIPTION?\balias\b creates or redefines alias definitions " + "or writes the existing alias definitions to standard output. " + "An alias definitions provides a string value that will replace " + "a command name when the command is read. Alias names can " + "contain any printable character which is not special to the shell. " + "If an alias value ends in a space or tab, then the word " + "following the command name the alias replaces is also checked " + "to see whether it is an alias.]" +"[+?If no \aname\as are specified then the names and values of all " + "aliases are written to standard output. Otherwise, for " + "each \aname\a that is specified, and \b=\b\avalue\a is not " + "specified, the current value of the alias corresponding to " + "\aname\a is written to standard output. If \b=\b\avalue\a is " + "specified, the alias \aname\a will be created or redefined.]" +"[+?\balias\b is built-in to the shell as a declaration command so that " + "field splitting and pathname expansion are not performed on " + "the arguments. Tilde expansion occurs on \avalue\a. An alias " + "definition only affects scripts read by the current shell " + "environment. It does not effect scripts run by this shell.]" +"[p?Causes the output to be in the form of alias commands that can be used " + "as input to the shell to recreate the current aliases.]" +"[t?Each \aname\a is looked up as a command in \b$PATH\b and its path is " + "added to the hash table as a 'tracked alias'. If no \aname\a is " + "given, this prints the hash table. See \bhash(1)\b.]" +"[x?Ignored, this option is obsolete.]" +"\n" +"\n[name[=value]...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?Successful completion.]" + "[+>0?One or more \aname\a operands did not have an alias " + "definition, or an error occurred.]" +"}" +"[+SEE ALSO?\bsh\b(1), \bhash\b(1), \bunalias\b(1)]" +; + +const char sh_optbuiltin[] = +"[-1c?\n@(#)$Id: builtin (AT&T Research) 2010-08-04 $\n]" +USAGE_LICENSE +"[+NAME?builtin - add, delete, or display shell built-ins]" +"[+DESCRIPTION?\bbuiltin\b can be used to add, delete, or display " + "built-in commands in the current shell environment. A built-in command " + "executes in the current shell process and can have side effects in the " + "current shell. On most systems, the invocation time for built-in " + "commands is one or two orders of magnitude less than commands that " + "create a separate process.]" +"[+?For each \apathname\a specified, the basename of the pathname " + "determines the name of the built-in. For each basename, the shell looks " + "for a C level function in the current shell whose name is determined by " + "prepending \bb_\b to the built-in name. If \apathname\a contains a " + "\b/\b, then the built-in is bound to this pathname. A built-in bound to " + "a pathname will only be executed if \apathname\a is the first " + "executable found during a path search. Otherwise, built-ins are found " + "prior to performing the path search.]" +"[+?If no \apathname\a operands are specified, then \bbuiltin\b displays " + "the current list of built-ins, or just the special built-ins if \b-s\b " + "is specified, on standard output. The full pathname for built-ins that " + "are bound to pathnames are displayed.]" +"[+?Libraries containing built-ins can be specified with the \b-f\b " + "option. If the library contains a function named \blib_init\b(), this " + "function will be invoked with argument \b0\b when the library is " + "loaded. The \blib_init\b() function can load built-ins by invoking an " + "appropriate C level function. In this case there is no restriction on " + "the C level function name.]" +"[+?The C level function will be invoked with three arguments. The first " + "two are the same as \bmain\b() and the third one is a pointer.]" +"[+?\bbuiltin\b cannot be invoked from a restricted shell.]" +"[d?Deletes each of the specified built-ins. Special built-ins cannot be " + "deleted.]" +"[f]:[lib?On systems with dynamic linking, \alib\a names a shared " + "library to load and search for built-ins. Libraries are searched for " + "in \b../lib/ksh\b and \b../lib\b on \b$PATH\b and in system dependent " + "library directories. The system " + "dependent shared library prefix and/or suffix may be omitted. Once a " + "library is loaded, its symbols become available for the current and " + "subsequent invocations of \bbuiltin\b. Multiple libraries can be " + "specified with separate invocations of \bbuiltin\b. Libraries are " + "searched in the reverse order in which they are specified.]" +"[l?List the library base name, plugin YYYYMMDD version stamp, and full " + "path for \b-f\b\alib\a on one line on the standard output.]" +"[s?Display only the special built-ins.]" +"\n" +"\n[pathname ...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?All \apathname\a operands and \b-f\b options processed " + "successfully.]" + "[+>0?An error occurred.]" +"}" +"[+SEE ALSO?\bwhence\b(1)]" +; + +const char sh_optcd[] = +"[-1c?\n@(#)$Id: cd (AT&T Research) 1999-06-05 $\n]" +USAGE_LICENSE +"[+NAME?cd - change working directory ]" +"[+DESCRIPTION?\bcd\b changes the current working directory of the " + "current shell environment.]" +"[+?In the first form with one operand, if \adirectory\a begins with " + "\b/\b, or if the first component is \b.\b or \b..\b, the " + "directory will be changed to this directory. If directory is \b-\b, " + "the directory will be changed to the last directory visited. " + "Otherwise, if the \bCDPATH\b environment variable is set, \bcd\b " + "searches for \adirectory\a relative to each directory named in " + "the colon separated list of directories defined by \bCDPATH\b. " + "If \bCDPATH\b not set, \bcd\b changes to the directory specified " + "by \adirectory\a.]" +"[+?In the second form, the first occurrence of the string \aold\a " + "contained in the pathname of the present working directory " + "is replaced by the string \anew\a and the resulting string " + "is used as the directory to which to change.]" +"[+?When invoked without operands and when the \bHOME\b environment " + "variable is set to a nonempty value, the directory named by " + "the \bHOME\b environment variable will be used. If \bHOME\b " + "is empty or unset, \bcd\b will fail.]" +"[+?When \bcd\b is successful, the \bPWD\b environment variable will be set " + "to the name of an absolute pathname that does not contain any " + "\b..\b components corresponding to the new directory. The " + "environment variable \bOLDPWD\b will be set to the previous " + "value of \bPWD\b. If the new directory is found by searching " + "the directories named by \bCDPATH\b, or if \adirectory\a is \b-\b, " + "or if the two operand form is used, the new value of \bPWD\b will be " + "written to standard output.]" +"[+?If both \b-L\b and \b-P\b are specified, the last one specified will " + "be used. If neither \b-P\b or \b-L\b is specified then the " + "behavior will be determined by the \bgetconf\b parameter " + "\bPATH_RESOLVE\b. If \bPATH_RESOLVE\b is \bphysical\b, " + "then the behavior will be as if \b-P\b were specified. Otherwise, " + "the behavior will be as if \b-L\b were specified.]" +"[L?Handle each pathname component \b..\b in a logical fashion by moving " + "up one level by name in the present working directory.]" +"[P?The present working directory is first converted to an absolute pathname " + "that does not contain symbolic link components and symbolic name " + "components are expanded in the resulting directory name.]" +"\n" +"\n[directory]\n" +"old new\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?Directory successfully changed.]" + "[+>0?An error occurred.]" +"}" +"[+SEE ALSO?\bpwd\b(1), \bgetconf\b(1)]" +; + +const char sh_optcommand[] = +"[-1c?\n@(#)$Id: command (AT&T Research) 2003-08-01 $\n]" +USAGE_LICENSE +"[+NAME?command - execute a simple command]" +"[+DESCRIPTION?Without \b-v\b or \b-V\b, \bcommand\b executes \acommand\a " + "with arguments given by \aarg\a, suppressing the shell function lookup " + "that normally occurs. In addition, if \acommand\a is a special " + "built-in command, then the special properties are removed so that " + "failures will not cause the script that executes it to terminate.]" +"[+?With the \b-v\b or \b-V\b options, \bcommand\b is equivalent to the " + "\bwhence\b(1) command.]" +"[p?Causes a default path to be searched rather than the one defined by the " + "value of \bPATH\b.]" +"[v?Equivalent to \bwhence\b \acommand\a [\aarg\a ...]].]" +"[x?If \acommand\a fails because there are too many \aarg\as, it will be " + "invoked multiple times with a subset of the arguments on each " + "invocation. Arguments that occur prior to the first word that expand " + "to multiple arguments and arguments that occur after the last word " + "that expands to multiple arguments will be passed on each invocation. " + "The exit status will be the maximum invocation exit status.]" +"[V?Equivalent to \bwhence \b-v\b \acommand\a [\aarg\a ...]].]" +"\n" +"\n[command [arg ...]]\n" +"\n" +"[+EXIT STATUS?If \acommand\a is invoked, the exit status of \bcommand\b " + "will be that of \acommand\a. Otherwise, it will be one of " + "the following:]{" + "[+0?\bcommand\b completed successfully.]" + "[+>0?\b-v\b or \b-V\b has been specified and an error occurred.]" + "[+126?\acommand\a was found but could not be invoked.]" + "[+127?\acommand\a could not be found.]" +"}" + +"[+SEE ALSO?\bwhence\b(1), \bgetconf\b(1)]" +; + +const char sh_optdot[] = +"[-1c?@(#)$Id: \b.\b (AT&T Research/ksh93) 2020-06-15 $\n]" +USAGE_LICENSE +"[+NAME?\f?\f - execute commands in the current environment]" +"[+DESCRIPTION?\b.\b and \bsource\b are built-in commands that execute " + "commands from a function or a file in the current environment. \b.\b " + "is a special built-in, whereas \bsource\b is a regular built-in.]" +"[+?If \aname\a refers to a function defined with the \bfunction\b \aname\a " + "syntax, the function executes in the current environment as " + "if it had been defined with the \aname\a\b()\b syntax so that " + "there is no scoping. Otherwise, commands from the file defined " + "by \aname\a are executed in the current environment. Note that " + "the complete script is read before it begins to execute so that " + "any aliases defined in this script will not take effect until " + "the script completes execution.]" +"[+?When \aname\a refers to a file, the \bPATH\b variable is searched " + "for the file containing commands. In this case execute permission " + "is not required for \aname\a.]" +"[+?If any \aarg\as are specified, these become the positional parameters " + "for the duration of the function or script and are restored " + "upon completion.]" +"\n" +"\n name [arg ...]\n" +"\n" +"[+EXIT STATUS?If \aname\a is found, then the exit status is that of the last " + "command executed. Otherwise, it is non-zero. \b.\b, being a special " + "built-in, will exit the current shell environment or abort execution " + "of the interactive command line upon error, whereas \bsource\b will " + "allow execution to continue.]" +"[+SEE ALSO?\bcommand\b(1), \bksh\b(1)]" +; + #ifndef ECHOPRINT const char sh_optecho[] = " [-n] [arg...]"; #endif /* !ECHOPRINT */ -const char sh_opteval[] = " [arg...]"; -const char sh_optexec[] = "a:[name]c [command [args...] ]"; -const char sh_optexport[] = "p [name[=value]...]"; -const char sh_optgetopts[] = ":a:[name] optstring name [args...]"; -const char sh_optgetconf[] = " [name [pathname] ]"; -const char sh_optjoblist[] = " [job...]"; -const char sh_opthist[] = "e:[editor]lnrsN# [first] [last]"; -const char sh_optjobs[] = "nlp [job...]"; -const char sh_optkill[] = "ln#[signum]s:[signame] sig..."; -const char sh_optlet[] = " expr..."; -const char sh_optprint[] = "f:[format]enprsu:[filenum] [arg...]"; -const char sh_optprintf[] = " format [arg...]"; -const char sh_optpwd[] = "LP"; -const char sh_optread[] = "Ad:[delim]prst#[timeout]u#[filenum] [name...]"; -#ifdef SHOPT_KIA - const char sh_optksh[] = "+DircabefhkmnpstuvxCR:[file]o:?[option] [arg...]"; - const char sh_optset[] = "+abefhkmnpstuvxCR:[file]o:?[option]A:[name] [arg...]"; -#else - const char sh_optksh[] = "+DircabefhkmnpstuvxCo:?[option] [arg...]"; - const char sh_optset[] = "+abefhkmnpstuvxCo:?[option]A:[name] [arg...]"; -#endif /* SHOPT_KIA */ -const char sh_optsleep[] = " seconds"; -const char sh_opttrap[] = "p [action condition...]"; -#ifdef SHOPT_OO - const char sh_opttypeset[] = "+AC:E#?F#?H:[name]L#?R#?Z#?fi#?[base]lnprtux [name=[value]...]"; -#else - const char sh_opttypeset[] = "+AE#?F#?HL#?R#?Z#?fi#?[base]lnprtux [name=[value]...]"; -#endif /* SHOPT_OO */ -const char sh_optulimit[] = "HSacdfmnstv [limit]"; -const char sh_optumask[] = "S [mask]"; -const char sh_optuniverse[] = " [name]"; -const char sh_optunset[] = "fnv name..."; -const char sh_optunalias[] = "a name..."; -#ifdef SHOPT_FS_3D - const char sh_optvpath[] = " [top] [base]"; - const char sh_optvmap[] = " [dir] [list]"; -#endif /* SHOPT_FS_3D */ -const char sh_optwhence[] = "afpv name..."; +const char sh_opteval[] = +"[-1c?\n@(#)$Id: eval (AT&T Research) 1999-07-07 $\n]" +USAGE_LICENSE +"[+NAME?eval - create a shell command and process it]" +"[+DESCRIPTION?\beval\b is a shell special built-in command that constructs " + "a command by concatenating the \aarg\as together, separating each " + "with a space. The resulting string is then taken as input to " + "the shell and evaluated in the current environment. Note that " + "command words are expanded twice; once to construct \aarg\a, and " + "again when the shell executes the constructed command.]" +"[+?It is not an error if \aarg\a is not given.]" +"\n" +"\n[arg...]\n" +"\n" +"[+EXIT STATUS?If \aarg\a is not specified, the exit status is \b0\b. " + "Otherwise, it is the exit status of the command defined by the " + "\aarg\a operands.]" +"[+SEE ALSO?\bexec\b(1), \btrap\b(1), \b.\b(1)]" +; + +const char sh_optexec[] = +"[-1c?\n@(#)$Id: exec (AT&T Research/ksh93) 2020-06-11 $\n]" +USAGE_LICENSE +"[+NAME?exec - execute command, open/close and duplicate file descriptors]" +"[+DESCRIPTION?\bexec\b is a special built-in command that can be used to " + "manipulate file descriptors or to replace the current shell " + "with a new command.]" +"[+?If \acommand\a is specified, then the current shell process will be " + "replaced by \acommand\a rather than running \acommand\a and waiting " + "for it to complete. Note that there is no need to use " + "\bexec\b to enhance performance since the shell implicitly " + "uses the exec mechanism internally whenever possible.]" +"[+?If no operands are specified, \bexec\b can be used to persistently open " + "or close files or manipulate file descriptors as in \bredirect\b(1).]" +"[c?Clear all environment variables before executions except variable " + "assignments that are part of the current \bexec\b command.]" +"[a]:[name?\bargv[0]]\b will be set to \aname\a for \acommand\a]" +"\n" +"\n[command [arg ...]]\n" +"\n" +"[+EXIT STATUS?If \acommand\a is specified, \bexec\b does not return. " + "Otherwise, the exit status is one of the following:]{" + "[+0?All I/O redirections were successful.]" + "[+>0?An error occurred.]" +"}" +"[+?Because \bexec\b is a special built-in command, any failure will cause the " + "script or command line that invokes it to be aborted. This can be " + "prevented by invoking \bexec\b from the \bcommand\b utility.]" +"[+SEE ALSO?\bcommand\b(1), \beval\b(1), \bredirect(1)\b]" +; + +const char sh_optexit[] = +"[-1c?\n@(#)$Id: exit (AT&T Research) 1999-07-07 $\n]" +USAGE_LICENSE +"[+NAME?exit - exit the current shell]" +"[+DESCRIPTION?\bexit\b is shell special built-in that causes the " + "shell that invokes it to exit. Before exiting the shell, if the " + "\bEXIT\b trap is set it will be invoked.]" +"[+?If \an\a is given, it will be used to set the exit status.]" +"\n" +"\n[n]\n" +"\n" +"[+EXIT STATUS?If \an\a is specified, the exit status is the least significant " + "eight bits of the value of \an\a. Otherwise, the exit status is the " + "exit status of preceding command. When invoked inside a trap, the " + "preceding command means the command that invoked the trap.]" +"[+SEE ALSO?\bbreak\b(1), \breturn\b(1)]" +; + +const char sh_optexport[] = +"[-1c?\n@(#)$Id: export (AT&T Research) 1999-07-07 $\n]" +USAGE_LICENSE +"[+NAME?export - set export attribute on variables]" +"[+DESCRIPTION?\bexport\b sets the export attribute on each of " + "the variables specified by \aname\a which causes them " + "to be in the environment of subsequently executed commands. " + "If \b=\b\avalue\a is specified, the variable \aname\a is " + "set to \avalue\a.]" +"[+?If no \aname\as are specified then the names and values of all " + "exported variables are written to standard output.]" +"[+?\bexport\b is built-in to the shell as a declaration command so that " + "field splitting and pathname expansion are not performed on " + "the arguments. Tilde expansion occurs on \avalue\a.]" +"[p?Causes the output to be in the form of \bexport\b commands that can be " + "used as input to the shell to recreate the current exports.]" +"\n" +"\n[name[=value]...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" +"}" + +"[+SEE ALSO?\bsh\b(1), \btypeset\b(1)]" +; + +const char sh_optgetopts[] = +":[-1c?\n@(#)$Id: getopts (AT&T Research) 2005-01-01 $\n]" +"[-author?Glenn Fowler ]" +USAGE_LICENSE +"[+NAME?\f?\f - parse utility options]" +"[+DESCRIPTION?The \bgetopts\b utility can be used to retrieve options and " + "arguments from a list of arguments given by \aargs\a or the positional " + "parameters if \aargs\a is omitted. It can also generate usage messages " + "and a man page for the command based on the information in \aoptstring\a.]" +"[+?Each time it is invoked, the \bgetopts\b utility places the value " + "of the next option in the shell variable specified by the \aname\a " + "operand and the index of the next argument to be processed in the " + "shell variable \bOPTIND\b. When the shell is invoked \bOPTIND\b " + "is initialized to \b1\b. When an option requires or permits an option " + "argument, \bgetopts\b places the option argument in the shell " + "variable \bOPTARG\b. Otherwise \bOPTARG\b is set to \b1\b when the " + "option is set and \b0\b when the option is unset.]" +"[+?The \aoptstring\a string consists of alpha-numeric characters, " + "the special characters +, -, ?, :, and , or character groups " + "enclosed in [...]]. Character groups may be nested in {...}. " + "Outside of a [...]] group, a single new-line followed by zero or " + "more blanks is ignored. One or more blank lines separate the " + "options from the command argument synopsis.]" +"[+?Each [...]] group consists of an optional label, " + "optional attributes separated by :, and an " + "optional description string following ?. The characters from the ? " + "to the end of the next ]] are ignored for option parsing and short " + "usage messages. They are used for generating verbose help or man pages. " + "The : character may not appear in the label. " + "The ? character must be specified as ?? in the label and the ]] character " + "must be specified as ]]]] in the description string. " + "Text between two \\b (backspace) characters indicates " + "that the text should be emboldened when displayed. " + "Text between two \\a (bell) characters indicates that the text should " + "be emphasized or italicized when displayed. " + "Text between two \\v (vertical tab) characters indicates " + "that the text should displayed in a fixed width font. " + "Text between two \\f (formfeed) characters will be replaced by the " + "output from the shell function whose name is that of the enclosed text.]" +"[+?All output from this interface is written to the standard error.]" +"[+?There are several group types:]{" + "[+1.?A group of the form " + "[-[\aversion\a]][\aflag\a[\anumber\a]]]]...[?\atext\a]]]] " + "appearing as the first group enables the extended interface. \aversion\a " + "specifies the interface version, currently \b1\b. The latest version is " + "assumed if \aversion\a is omitted. Future enhancements " + "may increment \aversion\a, but all versions will be supported. \atext\a " + "typically specifies an SCCS or CVS identification string. Zero or more " + "\aflags\a with optional \anumber\a values may be specified to control " + "option parsing. " + "The flags are:]{" + "[++?Arguments beginning with + are considered options.]" + "[+c?Cache this \aoptstring\a for multiple passes. Used to optimize " + "builtins that may be called many times within the same process.]" + "[+i?Ignore this \aoptstring\a when generating help. Used when " + "combining \aoptstring\a values from multiple passes.]" + "[+l?Display only \alongname\a options in help messages.]" + "[+n?Associate -\anumber\a and +\anumber\a options with the first " + "option with numeric arguments.]" + "[+o?The \b-\b option character prefix is optional (supports " + "obsolete \bps\b(1) option syntax.)]" + "[+p?\anumber\a specifies the number of \b-\b characters that must " + "prefix long option names. The default is \b2\b; \b0\b, \b1\b or " + "\b2\b are accepted (e.g., \bp0\b for \bdd\b(1) and \bp1\b for " + "\bfind\b(1).)]" + "[+s?\anumber\a specifies the \b--??man\b section number, " + "\b1\b by default.]" + "}" + "[+2.?An option specification of the form " + "[\aoption\a[!]][=\anumber\a]][:\alongname\a]][?\atext\a]]]]. In this " + "case the first field is the option character; this is the value returned " + "in the \aname\a operand when the option is matched. If there is no " + "option character then a two or more digit number should be specified. " + "This number will be returned as the value of the \aname\a operand if the " + "long option is matched. If \aoption\a is followed by \b!\b then the option " + "character sense is the inverse of the longname sense. For options that do " + "not take values \bOPTARG\b will be set to \b0\b for \b!\b inverted option " + "characters and \b1\b otherwise. =\anumber\a optionally specifies a number to " + "be returned in the \aname\a operand instead of the option character. A " + "longname is specified by \b--\b\alongname\a and is matched by the shortest " + "non-ambiguous prefix of all long options. * in the \alongname\a field " + "indicates that only characters up to that point need to match, provided " + "any additional characters match exactly. The enclosing [ and ]] can be " + "omitted for an option that does not have a longname or descriptive text.]" + "[+3.?An option argument specification. " + "Options that take arguments can be followed by : (string value) or # " + "(numeric value) and an option argument specification. An option argument " + "specification consists of the option argument name as field 1. " + "The remaining \b:\b separated fields are a type name and zero or more of " + "the special attribute words \blistof\b, \boneof\b, and \bignorecase\b. " + "A default option value may be specified in the final field as " + "\b:=\b\adefault\a. The option argument specification may be followed " + "by a list of option value descriptions enclosed in braces. " + "A long option that takes an argument is specified as " + "\b--\b\alongname\a=\avalue\a. If the : or # is followed by ? then the " + "option argument is optional. If only the option character form is " + "specified then the optional argument value is not set if the next " + "argument starts with - or +. The special attributes are currently " + "informational with respect to \boptget\b(3), but may be useful to " + "applications that parse \b--api\b output. The special attributes are:]{" + "[+listof?zero or more of the possible option values may be specified, " + "separated by \b,\b or space.]" + "[+oneof?exactly one of the possible option values must be specified]" + "[+ignorecase?case ignored in matching the long option name]" + "}" + "[+4.?A option value description.]" + "[+5.?A argument specification. A list of valid option argument values " + "can be specified by enclosing them inside a {...} following " + "the option argument specification. Each of the permitted " + "values can be specified with a [...]] containing the " + "value followed by a description.]" + "[+6.?A group of the form [+\\n...]] will display the characters " + "representing ... in fixed with font without adding line breaks.]" + "[+7.?A group of the form [+\aname\a?\atext\a]] specifies a section " + "\aname\a with descriptive \atext\a. If \aname\a is omitted then " + "\atext\a is placed in a new paragraph.]" + "[+8.?A group of the form [-\aname\a?\atext\a]] specifies entries " + "for the \bIMPLEMENTATION\b section.]" +"}" +"[+?A leading : character in \aoptstring\a " + "affects the way errors are handled. If an option character or longname " + "argument not specified in \aoptstring\a is encountered when processing " + "options, the shell variable whose name is \aname\a will be set to the ? " + "character. The shell variable \bOPTARG\b will be set to " + "the character found. If an option argument is missing or has an invalid " + "value, then \aname\a will be set to the : character and the shell variable " + "\bOPTARG\b will be set to the option character found. " + "Without the leading :, \aname\a will be set to the ? character, \bOPTARG\b " + "will be unset, and an error message will be written to standard error " + "when errors are encountered.]" +"[+?A leading + character or a + following a leading : in \aoptstring\a " + "specifies that arguments beginning with + will also be considered options.]" +"[+?The end of options occurs when:]{" + "[+1.?The special argument \b--\b is encountered.]" + "[+2.?An argument that does not begin with a \b-\b is encountered.]" + "[+3.?A help argument is specified.]" + "[+4.?An error is encountered.]" +"}" +"[+?If \bOPTIND\b is set to the value \b1\b, a new set of arguments " + "can be used.]" +"[+?\bgetopts\b can also be used to generate help messages containing command " + "usage and detailed descriptions. Specify \aargs\a as:]" +"{ " + "[+-???To generate a usage synopsis.]" + "[+--?????To generate a verbose usage message.]" + "[+--????man?To generate a formatted man page.]" + "[+--????api?To generate an easy to parse usage message.]" + "[+--????html?To generate a man page in \bhtml\b format.]" + "[+--????nroff?To generate a man page in \bnroff\b format.]" + "[+--????usage?List the current \aoptstring\a.]" + "[+--??????\aname\a?List \bversion=\b\an\a, \an\a>0, " + "if the option \aname\a is recognized by \bgetopts\b.]" +"}" +"[+?When the end of options is encountered, \bgetopts\b exits with a " + "non-zero return value and the variable \bOPTIND\b is set to the " + "index of the first non-option argument.]" +"[+?The obsolete long option forms \aflag\a(\along-name\a) and " + "\aflag\a:(\along-name\a) for options that take arguments is supported " + "for backwards compatibility.]" +"a:[name?Use \aname\a instead of the command name in usage messages.]" +"\n" +"\noptstring name [args...]\n" +"\n" +"[+EXIT STATUS]{" + "[+0?An option specified was found.]" + "[+1?An end of options was encountered.]" + "[+2?A usage or information message was generated.]" +"}" +; + +const char sh_optbg[] = +"[-1c?@(#)$Id: bg (AT&T Research) 2000-04-02 $\n]" +USAGE_LICENSE +"[+NAME?bg - resume jobs in the background]" +"[+DESCRIPTION?\bbg\b places the given \ajob\as into the background " + "and sends them a \bCONT\b signal to start them running.]" +"[+?If \ajob\a is omitted, the most recently started or stopped " + "background job is resumed or continued in the background.]" +_JOB_ +"\n" +"\n[job ...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?If all background jobs are started.]" + "[+>0?If one more jobs does not exist or there are no background " + "jobs.]" +"}" + +"[+SEE ALSO?\bwait\b(1), \bfg\b(1), \bdisown\b(1), \bjobs\b(1)]" +; + +const char sh_optfg[] = +"[-1c?@(#)$Id: fg (AT&T Research) 2000-04-02 $\n]" +USAGE_LICENSE +"[+NAME?fg - move jobs to the foreground]" +"[+DESCRIPTION?\bfg\b places the given \ajob\as into the foreground " + "in sequence and sends them a \bCONT\b signal to start each running.]" +"[+?If \ajob\a is omitted, the most recently started or stopped " + "background job is moved to the foreground.]" +_JOB_ +"\n" +"\n[job ...]\n" +"\n" +"[+EXIT STATUS?If \bfg\b brings one or more jobs into the foreground, " + "the exit status of \bfg\b will be that of the last \ajob\a. " + "If one or more jobs does not exist or has completed, \bfg\b will " + "return a non-zero exit status.]" +"}" + +"[+SEE ALSO?\bwait\b(1), \bbg\b(1), \bjobs\b(1)]" +; + +const char sh_optdisown[] = +"[-1c?@(#)$Id: disown (AT&T Research) 2000-04-02 $\n]" +USAGE_LICENSE +"[+NAME?disown - disassociate a job with the current shell]" +"[+DESCRIPTION?\bdisown\b prevents the current shell from sending " + "a \bHUP\b signal to each of the given \ajob\as when " + "the current shell terminates a login session.]" +"[+?If \ajob\a is omitted, the most recently started or stopped " + "background job is used.]" +_JOB_ +"\n" +"\n[job ...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?If all jobs are successfully disowned.]" + "[+>0?If one more \ajob\as does not exist.]" +"}" + +"[+SEE ALSO?\bwait\b(1), \bbg\b(1), \bjobs\b(1)]" +; + +const char sh_optjobs[] = +"[-1c?@(#)$Id: jobs (AT&T Research) 2000-04-02 $\n]" +USAGE_LICENSE +"[+NAME?jobs - display status of jobs]" +"[+DESCRIPTION?\bjobs\b displays information about specified \ajob\as " + "that were started by the current shell environment on standard " + "output. The information contains the job number enclosed in " + "[...]], the status, and the command line that started the job.]" +"[+?If \ajob\a is omitted, \bjobs\b displays the status of all stopped jobs, " + "background jobs, and all jobs whose status has changed since last " + "reported by the shell.]" +"[+?When \bjobs\b reports the termination status of a job, the " + "shell removes the jobs from the list of known jobs in " + "the current shell environment.]" +_JOB_ +"[l?\bjobs\b displays process id's after the job number in addition " + "to the usual information]" +"[n?Only the jobs whose status has changed since the last prompt " + "is displayed.]" +"[p?The process group leader id's for the specified jobs are displayed.]" +"\n" +"\n[job ...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?The information for each job is written to standard output.]" + "[+>0?One or more jobs does not exist.]" +"}" + +"[+SEE ALSO?\bwait\b(1), \bps\b(1), \bfg\b(1), \bbg\b(1)]" +; + +const char sh_opthash[] = +"[-1c?\n@(#)$Id: hash (ksh93) 2020-06-10 $\n]" +"[+NAME?hash - display the locations of recently used programs]" +"[+DESCRIPTION?\bhash\b displays or modifies the hash table with the " + "locations of recently used programs. If given no arguments, it lists " + "all command/path associations (a.k.a. 'tracked aliases') in the hash " + "table. Otherwise, \bhash\b performs a \bPATH\b search for each " + "\autility\a supplied and adds the result to the hash table.]" +"[r?Empty the hash table. This can also be achieved by resetting \bPATH\b.]" +"\n" +"\n[utility...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" +"}" +"[+SEE ALSO?\bsh\b(1), \balias\b(1)]" +; + +const char sh_opthist[] = +"[-1cn?@(#)$Id: hist (AT&T Research/ksh93) 2020-07-16 $\n]" +USAGE_LICENSE +"[+NAME?fc, hist, history, r - process command history list]" +"[+DESCRIPTION?\bhist\b lists, edits, or re-executes commands " + "previously entered into the current shell environment.]" +"[+?The following command equivalents exist: " + "\bfc\b is \bhist\b; " + "\bhistory\b is \bhist -l\b (list history); " + "and \br\b is \bhist -s\b (reexecute command).]" +"[+?The command history list references commands by number. The first number " + "in the list is selected arbitrarily. The relationship of a number " + "to its command does not change during a login session. When the " + "number reaches 32767 the number wraps around to 1 but " + "maintains the ordering.]" +"[+?When commands are edited (when the \b-l\b option is not specified), the " + "resulting lines will be entered at the end of the history list and " + "then reexecuted by the current shell. The \bhist\b command that " + "caused the editing will not be entered into the history list. If the " + "editor returns a non-zero exit status, this will suppress the " + "entry into the history list and the command reexecution. Command " + "line variable assignments and redirections affect both the \bhist\b " + "command and the commands that are reexecuted.]" +"[+?\afirst\a and \alast\a define the range of commands. \afirst\a and " + "\alast\a can be one of the following:]{" + "[+\anumber\a?A positive number representing a command " + "number. A \b+\b sign can precede \anumber\a.]" + "[+-\anumber\a?A negative number representing a command " + "that was executed \anumber\a commands previously. " + "For example, \b-1\b is the previous command.]" + "[+\astring\a?\astring\a indicates the most recently " + "entered command that begins with \astring\a. " + "\astring\a should not contain an \b=\b.]" + "}" +"[+?If \afirst\a is omitted, the previous command is used, unless \b-l\b " + "is specified, in which case it will default to \b-16\b and \alast\a " + "will default to \b-1\b.]" +"[+?If \afirst\a is specified and \alast\a is omitted, then \alast\a will " + "default to \afirst\a unless \b-l\b is specified in which case " + "it will default to \b-1\b.]" +"[+?If no editor is specified, then the editor specified by the \bHISTEDIT\b " + "variable will be used if set, or the \bFCEDIT\b variable will be " + "used if set, otherwise, \bed\b will be used.]" +"[e]:[editor?\aeditor\a specifies the editor to use to edit the history " + "command. A value of \b-\b for \aeditor\a is equivalent to " + "specifying the \b-s\b option.]" +"[l?List the commands rather than editing and reexecuting them.]" +"[N]#[num?Start at \anum\a commands back.]" +"[n?Suppress the command numbers when the commands are listed.]" +#if SHOPT_HISTEXPAND +"[p?Writes the result of history expansion for each operand to standard " + "output. All other options are ignored.]" +#endif +"[r?Reverse the order of the commands.]" +"[s?Reexecute the command without invoking an editor. In this case " + "an operand of the form \aold\a\b=\b\anew\a can be specified " + "to change the first occurrence of the string \aold\a in the " + "command to \anew\a before reexecuting the command.]" + +"\n" +"\n[first [last] ]\n" +"\n" +"[+EXIT STATUS?If a command is reexecuted, the exit status is that of " + "the command that gets reexecuted. Otherwise, it is one of the " + "following:]{" + "[+0?Successfully completion of the listing.]" + "[+>0?An error occurred.]" +"}" + +"[+SEE ALSO?\bksh\b(1), \bsh\b(1), \bed\b(1)]" +; + +const char sh_optkill[] = +"[-1c?\n@(#)$Id: kill (AT&T Research) 2012-04-13 $\n]" +USAGE_LICENSE +"[+NAME?kill - terminate or signal process]" +"[+DESCRIPTION?With the first form in which \b-l\b is not specified, " + "\bkill\b sends a signal to one or more processes specified by " + "\ajob\a. This normally terminates the processes unless the signal " + "is being caught or ignored.]" +_JOB_ +"[+?If the signal is not specified with either the \b-n\b or the \b-s\b " + "option, the \bSIGTERM\b signal is used.]" +"[+?If \b-l\b is specified, and no \aarg\a is specified, then \bkill\b " + "writes the list of signals to standard output. Otherwise, \aarg\a " + "can be either a signal name, or a number representing either a " + "signal number or exit status for a process that was terminated " + "due to a signal. If a name is given the corresponding signal " + "number will be written to standard output. If a number is given " + "the corresponding signal name will be written to standard output.]" +"[l?List signal names or signal numbers rather than sending signals as " + "described above. " + "The \b-n\b and \b-s\b options cannot be specified.]" +"[L?Same as \b-l\b except that of no argument is specified the signals will " + "be listed in menu format as with select compound command.]" +"[n]#[signum?Specify a signal number to send. Signal numbers are not " + "portable across platforms, except for the following:]{" + "[+0?No signal]" + "[+1?\bHUP\b]" + "[+2?\bINT\b]" + "[+3?\bQUIT\b]" + "[+6?\bABRT\b]" + "[+9?\bKILL\b]" + "[+14?\bALRM\b]" + "[+15?\bTERM\b]" + "}" +"[s]:[signame?Specify a signal name to send. The signal names are derived " + "from their names in \b\b without the \bSIG\b prefix and " + "are case insensitive. \bkill -l\b will generate the list of " + "signals on the current platform.]" +"\n" +"\njob ...\n" +" -l [arg ...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?At least one matching process was found for each \ajob\a " + "operand, and the specified signal was successfully sent to at " + "least one matching process.]" + "[+>0?An error occurred.]" +"}" +"[+SEE ALSO?\bps\b(1), \bjobs\b(1), \bkill\b(2), \bsignal\b(2)]" +; + +#if defined(JOBS) && defined(SIGSTOP) +const char sh_optstop[] = +"[-1c?\n@(#)$Id: stop (ksh93) 2020-06-22 $\n]" +"[+NAME?stop - suspend a process]" +"[+DESCRIPTION?\bstop\b sends a \bSIGSTOP\b signal to one or more processes " + "specified by \ajob\a, suspending them until they receive \bSIGCONT\b.]" +_JOB_ +"\n" +"\njob ...\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?At least one matching process was found for each \ajob\a " + "operand, and \bSIGSTOP\b was successfully sent to at least one " + "matching process.]" + "[+>0?An error occurred.]" +"}" +"[+SEE ALSO?\bkill\b(1)]" +; + +const char sh_optsuspend[] = +"[-1c?\n@(#)$Id: suspend (ksh93) 2020-06-22 $\n]" +"[+NAME?suspend - stop the shell]" +"[+DESCRIPTION?\bsuspend\b sends a \bSIGSTOP\b signal to the main shell " + "process, suspending the script or child shell session until it " + "receives \bSIGCONT\b (for instance, when typing \bfg\b in the " + "parent shell).]" +"[+?\bsuspend\b is equivalent to \bkill -s STOP \"$$\"\b, except that " + "it accepts no operands and refuses to suspend a login shell.]" +"[+EXIT STATUS?]{" + "[+0?The shell was successfully suspended and continued.]" + "[+>0?An error occurred.]" +"}" +"[+SEE ALSO?\bkill\b(1)]" +; +#endif /* defined(JOBS) && defined(SIGSTOP) */ + +const char sh_optlet[] = +"[-1c?@(#)$Id: let (AT&T Research) 2000-04-02 $\n]" +USAGE_LICENSE +"[+NAME?let - evaluate arithmetic expressions]" +"[+DESCRIPTION?\blet\b evaluates each \aexpr\a in the current " + "shell environment as an arithmetic expression using ANSI C " + "syntax. Variables names are shell variables and they " + "are recursively evaluated as arithmetic expressions to " + "get numerical values.]" +"[+?\blet\b has been made obsolete by the \b((\b...\b))\b syntax " + "of \bksh\b(1) which does not require quoting of the operators " + "to pass them as command arguments.]" +"\n" +"\n[expr ...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?The last \aexpr\a evaluates to a non-zero value.]" + "[+>0?The last \aexpr\a evaluates to \b0\b or an error occurred.]" +"}" + +"[+SEE ALSO?\bexpr\b(1), \btest\b(1), \bksh\b(1)]" +; + +const char sh_optprint[] = +"[-1c?\n@(#)$Id: print (AT&T Research) 2008-11-26 $\n]" +USAGE_LICENSE +"[+NAME?print - write arguments to standard output]" +"[+DESCRIPTION?By default, \bprint\b writes each \astring\a operand to " + "standard output and appends a newline character.]" +"[+?Unless, the \b-r\b or \b-f\b option is specified, each \b\\\b " + "character in each \astring\a operand is processed specially as " + "follows:]{" + "[+\\a?Alert character.]" + "[+\\b?Backspace character.]" + "[+\\c?Terminate output without appending newline. The " + "remaining \astring\a operands are ignored.]" + "[+\\f?Formfeed character.]" + "[+\\n?Newline character.]" + "[+\\t?Tab character.]" + "[+\\v?Vertical tab character.]" + "[+\\\\?Backslash character.]" + "[+\\E?Escape character (ASCII octal 033).]" + "[+\\0\ax\a?The 8-bit character whose ASCII code is the " + "1-, 2-, or 3-digit octal number \ax\a.]" + "}" +"[+?If both \b-e\b and \b-r\b are specified, the last one specified is " + "the one that is used.]" +"[+?When the \b-f\b option is specified and there are more \astring\a " + "operands than format specifiers, the format string is " + "reprocessed from the beginning. If there are fewer \astring\a " + "operands than format specifiers, then outputting will end " + "at the first unneeded format specifier.]" +"[e?Unless \b-f\b is specified, process \b\\\b sequences in each \astring\a " + "operand as described above. This is the default behavior.]" +"[n?Do not append a new-line character to the output.]" +"[f]:[format?Write the \astring\a arguments using the format string " + "\aformat\a and do not append a new-line. See \bprintf\b for " + "details on how to specify \aformat\a.]" +"[p?Write to the current co-process instead of standard output.]" +"[r?Do not process \b\\\b sequences in each \astring\a operand as described " + "above.]" +"[s?Write the output as an entry in the shell history file instead of " + "standard output.]" +"[u]:[fd:=1?Write to file descriptor number \afd\a instead of standard output.]" +"[v?Treat each \astring\a as a variable name and write the value in \b%B\b " + "format. Cannot be used with \b-f\b.]" +"[C?Treat each \astring\a as a variable name and write the value in \b%#B\b " + "format. Cannot be used with \b-f\b.]" +"\n" +"\n[string ...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" +"}" +"[+SEE ALSO?\becho\b(1), \bprintf\b(1), \bread\b(1)]" +; + +const char sh_optprintf[] = +"[-1c?\n@(#)$Id: printf (AT&T Research/ksh93) 2020-08-10 $\n]" +USAGE_LICENSE +"[+NAME?printf - write formatted output]" +"[+DESCRIPTION?\bprintf\b writes each \astring\a operand to " + "standard output using \aformat\a to control the output format.]" +"[+?The \aformat\a operands supports the full range of ANSI C formatting " + "specifiers plus the following additional specifiers:]{" + "[+%b?Each character in the \astring\a operand is processed " + "specially as follows:]{" + "[+\\a?Alert character.]" + "[+\\b?Backspace character.]" + "[+\\c?Terminate output without appending newline. " + "The remaining \astring\a operands are ignored.]" + "[+\\f?Formfeed character.]" + "[+\\n?Newline character.]" + "[+\\t?Tab character.]" + "[+\\v?Vertical tab character.]" + "[+\\\\?Backslash character.]" + "[+\\E?Escape character (ASCII octal 033).]" + "[+\\0\ax\a?The 8-bit character whose ASCII code is " + "the 1-, 2-, or 3-digit octal number \ax\a.]" + "}" + "[+%q?Output \astring\a quoted in a manner that it can be read in " + "by the shell to get back the same string. However, empty " + "strings resulting from missing \astring\a operands will " + "not be quoted. When \bq\b is preceded by the alternative " + "format specifier, \b#\b, the string is quoted in manner " + " suitable as a field in a \b.csv\b format file.]" + "[+%B?Treat the argument as a variable name and output the value " + "without converting it to a string. This is most useful for " + "variables of type \b-b\b.]" + "[+%H?Output \astring\a with characters \b<\b, \b&\b, \b>\b, \b'\b, " + "\b\"\b, and non-printable characters properly escaped for " + "use in HTML and XML documents. The alternate flag \b#\b " + "formats the output for use as a URI.]" + "[+%P?Treat \astring\a as an extended regular expression and " + "convert it to a shell pattern.]" + "[+%R?Treat \astring\a as an shell pattern expression and " + "convert it to an extended regular expression.]" + "[+%T?Treat \astring\a as a date/time string and format it. The " + "\bT\b can be preceded by \b(\b\adformat\a\b)\b, where " + "\adformat\a is a date format. The accepted date formats are " + "as follows:]{" + "[+%?% character]" + "[+a?abbreviated weekday name]" + "[+A?full weekday name]" + "[+b?abbreviated month name]" + "[+B?full month name]" + "[+c?\bctime\b(3) style date without the trailing newline]" + "[+C?2-digit century]" + "[+d?day of month number]" + "[+D?date as \amm/dd/yy\a]" + "[+e?blank padded day of month number]" + "[+f?print a date with the format '\%Y.\%m.\%d-\%H:\%M:\%S']" + "[+F?%ISO 8601:2000 standard date format; equivalent to Y-%m-%d]" + "[+g?\bls\b(1) \b-l\b recent date with \ahh:mm\a]" + "[+G?\bls\b(1) \b-l\b distant date with \ayyyy\a]" + "[+h?abbreviated month name]" + "[+H?24-hour clock hour, zero-padded]" + "[+i?international \bdate\b(1) date with time zone type name]" + "[+I?12-hour clock hour, zero-padded]" + "[+j?1-offset Julian date]" + "[+J?0-offset Julian date]" + "[+k?24-hour clock hour, blank-padded]" + "[+K?all numeric date; equivalent to \b%Y-%m-%d+%H:%M:%S\b; \b%_[EO]]K\b for space separator, %OK adds \b.%N\b, \b%EK\b adds \b%.N%z\b, \b%_EK\b adds \b.%N %z\b]" + "[+l?12-hour clock hour, blank-padded]" + "[+L?locale default date format]" + "[+m?month number]" + "[+M?minutes]" + "[+n?newline character]" + "[+N?nanoseconds 000000000-999999999]" + "[+p?meridian (e.g., \bAM\b or \bPM\b)]" + "[+q?quarter of the year]" + "[+Q?\arecentdistant\a: \a\a is a unique " + "delimter character; \arecent\a format for recent " + "dates, \adistant\a format otherwise]" + "[+r?12-hour time as \ahh:mm:ss meridian\a]" + "[+R?24-hour time as \ahh:mm\a]" + "[+s?number of seconds since the epoch; \a.prec\a preceding " + "\bs\b appends \aprec\a nanosecond digits, \b9\b if " + "\aprec\a is omitted]" + "[+S?seconds 00-60]" + "[+t?tab character]" + "[+T?24-hour time as \ahh:mm:ss\a]" + "[+u?weekday number 1(Monday)-7]" + "[+U?week number with Sunday as the first day]" + "[+V?ISO week number (i18n is \afun\a)]" + "[+w?weekday number 0(Sunday)-6]" + "[+W?week number with Monday as the first day]" + "[+x?locale date style that includes month, day and year]" + "[+X?locale time style that includes hours and minutes]" + "[+y?2-digit year (you'll be sorry)]" + "[+Y?4-digit year]" + "[+z?time zone \aSHHMM\a west of GMT offset where S is " + "\b+\b or \b-\b, use pad _ for \aSHH:MM\a]" + "[+Z?time zone name]" + "[+=[=]][-+]]flag?set (default or +) or clear (-) \aflag\a " + "for the remainder of \aformat\a, or for the remainder " + "of the process if \b==\b is specified. \aflag\a may be:]{" + "[+l?enable leap second adjustments]" + "[+n?convert \b%S\b as \b%S.%N\b]" + "[+u?UTC time zone]" + "}" + "[+#?equivalent to %s]" + "[+??alternate?use \aalternate\a format if a default format " + "override has not been specified, e.g., \bls\b(1) uses " + "\"%?%l\"; export TM_OPTIONS=\"format='\aoverride\a'\" " + "to override the default]" + "}" + "[+%Z?Output a byte whose value is \b0\b.]" + "\fextra\f" +"}" +"[+?The format modifier flag \bL\b can precede the width and/or precision " + "specifiers for the \bc\b and \bs\b to cause the width and/or " + "precision to be measured in character width rather than byte count.]" +"[+?When performing conversions of \astring\a to satisfy a numeric " + "format specifier, if the first character of \astring\a " + "is \b\"\b or \b'\b, then the value will be the numeric value " + "in the underlying code set of the character following the " + "\b\"\b or \b'\b. Otherwise, \astring\a is treated like a shell " + "arithmetic expression and evaluated.]" +"[+?If a \astring\a operand cannot be completely converted into a value " + "appropriate for that format specifier, an error will occur, " + "but remaining \astring\a operands will continue to be processed.]" +"[+?In addition to the format specifier extensions, the following " + "extensions of ANSI-C are permitted in format specifiers:]{" + "[+-?The escape sequences \b\\E\b and \b\\e\b expand to the escape " + "character which is octal \b033\b in ASCII.]" + "[+-?The escape sequence \b\\c\b\ax\a expands to Control-\ax\a.]" + "[+-?The escape sequence \b\\C[.\b\aname\a\b.]]\b expands to " + "the collating element \aname\a.]" + "[+-?The escape sequence \b\\x{\b\ahex\a\b}\b expands to the " + "character corresponding to the hexadecimal value \ahex\a.]" + "[+-?The escape sequence \b\\u{\b\ahex\a\b}\b expands to the unicode " + "character corresponding to the hexadecimal value \ahex\a.]" + "[+-?The format modifier flag \b=\b can be used to center a field to " + "a specified width.]" + "[+-?The format modifier flag \bL\b can be used with the \bc\b and " + "\bs\b formats to treat precision as character width instead " + "of byte count.]" + "[+-?The format modifier flag \b,\b can be used with \bd\b and \bf\b " + "formats to cause group of digits.]" + "[+-?Each of the integral format specifiers can have a third " + "modifier after width and precision that specifies the " + "base of the conversion from 2 to 64. In this case the " + "\b#\b modifier will cause \abase\a\b#\b to be prepended to " + "the value.]" + "[+-?The \b#\b modifier can be used with the \bd\b specifier when " + "no base is specified cause the output to be written in units " + "of \b1000\b with a suffix of one of \bk M G T P E\b.]" + "[+-?The \b#\b modifier can be used with the \bi\b specifier to " + "cause the output to be written in units of \b1024\b with " + "a suffix of one of \bKi Mi Gi Ti Pi Ei\b.]" + "}" +"[+?If there are more \astring\a operands than format specifiers, the " + "\aformat\a string is reprocessed from the beginning. If there are " + "fewer \astring\a operands than format specifiers, then string " + "specifiers will be treated as if empty strings were supplied, " + "numeric conversions will be treated as if 0 were supplied, and " + "time conversions will be treated as if \bnow\b were supplied.]" +"[+?\bprintf\b is equivalent to \bprint -f\b which allows additional " + "options to be specified.]" +"\n" +"\nformat [string ...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" +"}" +"[+SEE ALSO?\bdate\b(1), \bprint\b(1), \bread\b(1)]" +; + +const char sh_optpwd[] = +"[-1c?\n@(#)$Id: pwd (AT&T Research) 1999-06-07 $\n]" +USAGE_LICENSE +"[+NAME?pwd - write working directory name]" +"[+DESCRIPTION?\bpwd\b writes an absolute pathname of the current working " + "directory to standard output. An absolute pathname is a " + "pathname that begins with \b/\b that does not contains any " + "\b.\b or \b..\b components.]" +"[+?If both \b-L\b and \b-P\b are specified, the last one specified will " + "be used. If neither \b-P\b or \b-L\b is specified then the " + "behavior will be determined by the \bgetconf\b parameter " + "\bPATH_RESOLVE\b. If \bPATH_RESOLVE\b is \bphysical\b, " + "then the behavior will be as if \b-P\b were specified. Otherwise, " + "the behavior will be as if \b-L\b were specified.]" +"[L?The absolute pathname may contains symbolic link components. This is " + "the default.]" +"[P?The absolute pathname will not contain any symbolic link components.]" +"[+EXIT STATUS?]{" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" +"}" +"[+SEE ALSO?\bcd\b(1), \bgetconf\b(1)]" +; + +const char sh_optread[] = +"[-1c?\n@(#)$Id: read (AT&T Research) 2006-12-19 $\n]" +USAGE_LICENSE +"[+NAME?read - read a line from standard input]" +"[+DESCRIPTION?\bread\b reads a line from standard input and breaks it " + "into fields using the characters in value of the \bIFS\b variable " + "as separators. The escape character, \b\\\b, is used to remove " + "any special meaning for the next character and for line continuation " + "unless the \b-r\b option is specified.]" +"[+?If there are more variables than fields, the remaining variables are " + "set to empty strings. If there are fewer variables than fields, " + "the leftover fields and their intervening separators are assigned " + "to the last variable. If no \avar\a is specified then the variable " + "\bREPLY\b is used.]" +"[+?When \avar\a has the binary attribute and \b-n\b or \b-N\b is specified, " + "the bytes that are read are stored directly into \bvar\b.]" +"[+?If you specify \b?\b\aprompt\a after the first \avar\a, then \bread\b " + "will display \aprompt\a on standard error when standard input " + "is a terminal or pipe.]" +"[+?If an end of file is encountered while reading a line the data is " + "read and processed but \bread\b returns with a non-zero exit status.]" +"[A?Unset \avar\a and then create an indexed array containing each field in " + "the line starting at index 0.]" +"[C?Unset \avar\a and read \avar\a as a compound variable.]" +"[d]:[delim?Read until delimiter \adelim\a instead of to the end of line.]" +"[p?Read from the current co-process instead of standard input. An end of " + "file causes \bread\b to disconnect the co-process so that another " + "can be created.]" +"[r?Do not treat \b\\\b specially when processing the input line.]" +"[s?Save a copy of the input as an entry in the shell history file.]" +"[S?Treat the input as if it was saved from a spreadsheet in csv format.]" +"[u]#[fd:=0?Read from file descriptor number \afd\a instead of standard input.]" +"[t]:[timeout?Specify a timeout \atimeout\a in seconds when reading from " + "a terminal or pipe.]" +"[n]#[count?Read at most \acount\a characters. For binary fields \acount\a " + "is the number of bytes.]" +"[N]#[count?Read exactly \acount\a characters. For binary fields \acount\a " + "is the number of bytes.]" +"[v?When reading from a terminal the value of the first variable is displayed " + "and used as a default value.]" +"\n" +"\n[var?prompt] [var ...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0? Successful completion.]" + "[+>0?End of file was detected or an error occurred.]" +"}" +"[+SEE ALSO?\bprint\b(1), \bprintf\b(1), \bcat\b(1)]" +; + +const char sh_optreadonly[] = +"[-1c?\n@(#)$Id: readonly (AT&T Research/ksh93) 2020-06-28 $\n]" +USAGE_LICENSE +"[+NAME?readonly - set readonly attribute on variables]" +"[+DESCRIPTION?\breadonly\b sets the readonly attribute on each of " + "the variables specified by \aname\a which prevents their " + "values from being changed. If \b=\b\avalue\a is specified, " + "the variable \aname\a is set to \avalue\a before the variable " + "is made readonly.]" +"[+?Unlike \btypeset -r\b, \breadonly\b does not create a function-local " + "scope and the given \aname\as are marked globally read-only by " + "default.]" +"[+?Within a type definition, if the value is not specified, then a " + "value must be specified when creating each instance of the type " + "and the value is readonly for each instance.]" +"[+?If no \aname\as are specified then the names and values of all " + "readonly variables are written to standard output.]" +"[+?\breadonly\b is built-in to the shell as a declaration command so that " + "field splitting and pathname expansion are not performed on " + "the arguments. Tilde expansion occurs on \avalue\a.]" +"[p?Causes the output to be in a form of \breadonly\b commands that can be " + "used as input to the shell to recreate the current set of " + "readonly variables.]" +"\n" +"\n[name[=value]...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" +"}" + +"[+SEE ALSO?\bsh\b(1), \btypeset\b(1)]" +; + +const char sh_optredirect[] = +"[-1c?\n@(#)$Id: redirect (ksh93) 2020-08-08 $\n]" +"[+NAME?redirect - open/close and duplicate file descriptors]" +"[+DESCRIPTION?This command only accepts input/output redirections. " + "It can open and close files and modify file descriptors from \b0\b " + "to \b9\b using the standard redirection mechanism available to all " + "commands, with the difference that the effect persists past the " + "execution of the \bredirect\b command.]" +"[+?Any file descriptor numbers greater than \b2\b that are opened with this " + "mechanism are closed when invoking another program, unless " + "explicitly redirected to themselves as part of that invocation.]" +"[+?\bredirect\b cannot be invoked from a restricted shell to create " + "files or to open a file for writing or appending.]" +"\n" +"\n[redirection ...]\n" +"\n" +"[+EXIT STATUS?The exit status is one of the following:]{" + "[+0?All I/O redirections were successful.]" + "[+>0?An error occurred.]" +"}" +"[+?Unlike \bexec\b(1), \bredirect\b does not abort the script or command " + "line if an error occurs.]" +"[+SEE ALSO?\bexec\b(1)]" +; + +const char sh_optreturn[] = +"[-1c?\n@(#)$Id: return (AT&T Research) 1999-07-07 $\n]" +USAGE_LICENSE +"[+NAME?return - return from a function or dot script ]" +"[+DESCRIPTION?\breturn\b is a shell special built-in that causes the " + "function or dot script that invokes it to exit. " + "If \breturn\b is invoked outside of a function or dot script " + "it is equivalent to \bexit\b.]" +"[+?If \breturn\b is invoked inside a function defined with the \bfunction\b " + "reserved word syntax, then any \bEXIT\b trap set within the " + "then function will be invoked in the context of the caller " + "before the function returns.]" +"[+?If \an\a is given, it will be used to set the exit status.]" +"\n" +"\n[n]\n" +"\n" +"[+EXIT STATUS?If \an\a is specified, the exit status is the least significant " + "eight bits of the value of \an\a. Otherwise, the exit status is the " + "exit status of preceding command.]" +"[+SEE ALSO?\bbreak\b(1), \bexit\b(1)]" +; + + +const char sh_optksh[] = +"+[-1?\n@(#)$Id: sh (AT&T Research) "SH_RELEASE" $\n]" +USAGE_LICENSE +"[+NAME?\b\f?\f\b - Shell, the standard command language interpreter]" +"[+DESCRIPTION?\b\f?\f\b is a command language interpreter that " + "executes commands read from a command line string, the " + "standard input, or a specified file.]" +"[+?If the \b-i\b option is present, or there are no \aarg\as and " + "the standard input and standard error are attached to a " + "terminal, the shell is considered to be interactive.]" +"[+?The \b-s\b and \b-c\b options are mutually exclusive. If the \b-c\b " + "option is specified, the first \aarg\a is the command-line string " + "and must be specified. Any remaining \aarg\as will be used " + "to initialize \b$0\b and positional parameters.]" +"[+?If the neither \b-s\b nor \b-c\b is specified, then the first \barg\b " + "will be the pathname of the file containing commands and \b$0\b " + "will be set to this value. If there is no file with this pathname, " + "and this pathname does not contain a \b/\b, then the \bPATH\b " + "will be searched for an executable with this name. Any remaining " + "\aarg\as will be used to initialize the positional parameters.]" +"[+?Any option can use a \b+\b instead of a \b-\b to disable the corresponding " + "option.]" +"[c?Read the commands from the first \aarg\a.]" +"[i?Specifies that the shell is interactive.]" +"[l?Invoke the shell as a login shell; \b/etc/profile\b and \b$HOME/.profile\b, " + "if they exist, are read before the first command.]" +"[r\f:restricted\f?Invoke the shell in a restricted mode. A restricted " + "shell does not permit any of the following:]{" + "[+-?Changing the working directory.]" + "[+-?Setting values or attributes of the variables \bSHELL\b, " + "\bENV\b, \bFPATH\b, or \bPATH\b.]" + "[+-?Executing any command whose name as a \b/\b in it.]" + "[+-?Redirecting output of a command with \b>\b, \b>|\b, " + "\b<>\b, or \b>>\b.]" + "[+-?Adding or deleting built-in commands or libraries with " + "\bbuiltin\b.]" + "[+-?Executing \bcommand -p\b \a...\a .]" + "}" +"[s?Read the commands from standard input. The positional parameters will be " + "initialized from \aarg\a.]" +"[D\f:dump-strings\f?Do not execute the script, but output the set of double " + "quoted strings preceded by a \b$\b. These strings are needed for " + "localization of the script to different locales.]" +"[E?Reads the file " +#if SHOPT_SYSRC + "\b/etc/ksh.kshrc\b, if it exists, as a profile, followed by " +#endif + "\b${ENV-$HOME/.kshrc}\b, if it exists, as a profile. " + "On by default for interactive shells; use \b+E\b to disable.]" +#if SHOPT_PFSH +"[P?Invoke the shell as a profile shell. See \bpfexec\b(1).]" +#endif +#if SHOPT_KIA +"[R]:[file?Do not execute the script, but create a cross reference database " + "in \afile\a that can be used a separate shell script browser. The " + "-R option requires a script to be specified as the first operand.]" +#endif /* SHOPT_KIA */ +#if SHOPT_REGRESS +"[I:regress]:[intercept?Enable the regression test \aintercept\a. Must be " + "the first command line option(s).]" +#endif +#if SHOPT_BASH + "\fbash2\f" +#endif +"\fabc\f" +"?" +"[T?Enable implementation specific test code defined by mask.]#[mask]" +"\n" +"\n[arg ...]\n" +"\n" +"[+EXIT STATUS?If \b\f?\f\b executes command, the exit status will be that " + "of the last command executed. Otherwise, it will be one of " + "the following:]{" + "[+0?The script or command line to be executed consists entirely " + "of zero or more blank lines or comments.]" + "[+>1-125?A noninteractive shell detected a syntax error, a variable " + "assignment error, or an error in a special built-in.]" + "[+126?\b-c\b and \b-s\b were not specified and the command script " + "was found on \bPATH\b but was not executable.]" + "[+127?\b-c\b and \b-s\b were not specified and the command script " + "corresponding to \aarg\a could not be found.]" +"}" + +"[+SEE ALSO?\bset\b(1), \bbuiltin\b(1)]" +; +const char sh_optset[] = +"+[-1c?\n@(#)$Id: set (AT&T Research) 1999-09-28 $\n]" +USAGE_LICENSE +"[+NAME?set - set/unset options and positional parameters]" +"[+DESCRIPTION?\bset\b sets or unsets options and positional parameters. " + "Options that are specified with a \b-\b cause the options to " + "be set. Options that are specified with a \b+\b cause the " + "option to be unset.]" +"[+?\bset\b without any options or arguments displays the names and " + "values of all shell variables in the order of the collation " + "sequence in the current locale. The values are quoted so that " + "they are suitable for reinput to the shell.]" +"[+?If no \aarg\as are specified, not even the end of options argument \b--\b, " + "the positional parameters are unchanged. Otherwise, unless " + "the \b-A\b options has been specified, the positional parameters " + "are replaced by the list of \aarg\as. A first \aarg\a of " + "\b--\b is ignored when setting positional parameters.]" +"[+?For backward compatibility, a \bset\b command without any options " + "specified whose first \aarg\a is \b-\b will turn off " + "the \b-v\b and \b-x\b options. If any additional \aarg\as " + "are specified, they will replace the positional parameters.]" +"[s?Sort the positional parameters.]" +"[A]:[name?Assign the arguments sequentially to the array named by \aname\a " + "starting at subscript 0 rather than to the positional parameters.]" +"\fabc\f" +"[06:default?Restore all non-command line options to the default settings.]" +"[07:state?List the current option state in the form of a \bset\b command " + "that can be executed to restore the state.]" +"\n" +"\n[arg ...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?No errors occurred.]" + "[+>0?An error occurred.]" +"}" + +"[+SEE ALSO?\btypeset\b(1), \bshift\b(1)]" +; + + + +const char sh_optshift[] = +"[-1c?\n@(#)$Id: shift (AT&T Research) 1999-07-07 $\n]" +USAGE_LICENSE +"[+NAME?shift - shift positional parameters]" +"[+DESCRIPTION?\bshift\b is a shell special built-in that shifts the " + "positional parameters to the left by the number of places " + "defined by \an\a, or \b1\b if \an\a is omitted. The number of " + "positional parameters remaining will be reduced by the " + "number of places that are shifted.]" +"[+?If \an\a is given, it will be evaluated as an arithmetic expression " + "to determinate the number of places to shift. It is an error " + "to shift more than the number of positional parameters or a " + "negative number of places.]" +"\n" +"\n[n]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?The positional parameters were successfully shifted.]" + "[+>0?An error occurred.]" +"}" +"[+SEE ALSO?\bset\b(1)]" +; + +const char sh_optsleep[] = +"[-1c?\n@(#)$Id: sleep (AT&T Research) 2009-03-12 $\n]" +USAGE_LICENSE +"[+NAME?sleep - suspend execution for an interval]" +"[+DESCRIPTION?\bsleep\b suspends execution for at least the time specified " + "by \aduration\a or until a \bSIGALRM\b signal is received. " + "\aduration\a may be one of the following:]" +"{" + "[+integer?The number of seconds to sleep.]" + "[+floating point?The number of seconds to sleep. The actual " + "granularity depends on the underlying system, normally " + "around 1 millisecond.]" + "[+P\an\a\bY\b\an\a\bM\b\an\a\bDT\b\an\a\bH\b\an\a\bM\b\an\a\bS?An ISO 8601 duration " + "where at least one of the duration parts must be specified.]" + "[+P\an\a\bW?An ISO 8601 duration specifying \an\a weeks.]" + "[+p\an\a\bY\b\an\a\bM\b\an\a\bDT\b\an\a\bH\b\an\a\bm\b\an\a\bS?A case insensitive " + "ISO 8601 duration except that \bM\b specifies months, \bm\b before \bs\b or \bS\b " + "specifies minutes and after specifies milliseconds, \bu\b or \bU\b specifies " + "microseconds, and \bn\b specifies nanoseconds.]" + "[+date/time?Sleep until the \bdate\b(1) compatible date/time.]" +"}" +"[s?Sleep until a signal or a timeout is received. If \aduration\a is omitted " + "or 0 then no timeout will be used.]" +"\n" +"\n[ duration ]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?The execution was successfully suspended for at least \aduration\a " + "or a \bSIGALRM\b signal was received.]" + "[+>0?An error occurred.]" +"}" +"[+SEE ALSO?\bdate\b(1), \btime\b(1), \bwait\b(1)]" +; + +const char sh_opttrap[] = +"[-1c?\n@(#)$Id: trap (AT&T Research) 1999-07-17 $\n]" +USAGE_LICENSE +"[+NAME?trap - trap signals and conditions]" +"[+DESCRIPTION?\btrap\b is a special built-in that defines actions to be " + "taken when conditions such as receiving a signal occur. Also, " + "\btrap\b can be used to display the current trap settings on " + "standard output.]" +"[+?If \aaction\a is \b-\b, \btrap\b resets each \acondition\a " + "to the default value. If \aaction\a is an empty string, the " + "shell ignores each of the \acondition\as if they arise. " + "Otherwise, the argument \aaction\a will be read and executed " + "by the shell as if it were processed by \beval\b(1) when one " + "of the corresponding conditions arise. The action of the trap " + "will override any previous action associated with each specified " + "\acondition\a. The value of \b$?\b is not altered by the trap " + "execution.]" +"[+?\acondition\a can be the name or number of a signal, or one of the " + "following:]{" + "[+EXIT?This trap is executed when the shell exits. If defined " + "within a function defined with the \bfunction\b reserved " + "word, the trap is executed in the caller's environment " + "when the function returns and the trap action is restored " + "to the value it had when it called the function.]" + "[+0?Same as EXIT.]" + "[+DEBUG?Executed before each simple command is executed but after " + "the arguments are expanded.]" + "[+ERR?Executed whenever \bset -e\b would cause the shell to exit.]" + "[+KEYBD?Executed when a key is entered from a terminal device.]" +"}" +"[+?Signal names are case insensitive and the \bsig\b prefix is optional. " + "Signals that were ignored on entry to a noninteractive shell cannot " + "trapped or reset although doing so will not report an error. The " + "use of signal numbers other than \b1\b, \b2\b, \b3\b, \b6\b, " + "\b9\b, \b14\b, and \b15\b is not portable.]" +"[+?Although \btrap\b is a special built-in, specifying a condition that " + "the shell does not know about causes \btrap\b to exit with a " + "non-zero exit status, but does not terminate the invoking shell.]" +"[+?If no \aaction\a or \acondition\as are specified then all the current " + "trap settings are written to standard output.]" +"[p?Causes the current traps to be output in a format that can be processed " + "as input to the shell to recreate the current traps.]" +"\n" +"\n[action condition ...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" +"}" + +"[+SEE ALSO?\bkill\b(1), \beval\b(1), \bsignal\b(3)]" +; + +const char sh_opttypeset[] = +"+[-1c?\n@(#)$Id: typeset (AT&T Research/ksh93) 2020-07-15 $\n]" +USAGE_LICENSE +"[+NAME?typeset - declare or display variables with attributes]" +"[+DESCRIPTION?Without the \b-f\b option, \btypeset\b sets, unsets, " + "or displays attributes of variables as specified with the " + "options. If the first option is specified with a \b-\b " + "then the attributes are set for each of the given \aname\as. " + "If the first option is specified with a \b+\b, then the specified " + "attributes are unset. If \b=\b\avalue\a is specified value is " + "assigned before the attributes are set.]" +"[+?When \btypeset\b is called inside a function defined with the " + "\bfunction\b reserved word, and \aname\a does not contain a " + "\b.\b, then a local variable statically scoped to that function " + "will be created.]" +"[+?Not all option combinations are possible. For example, the numeric " + "options \b-i\b, \b-E\b, and \b-F\b cannot be specified with " + "the justification options \b-L\b, \b-R\b, and \b-Z\b.]" +"[+?Note also the following builtin command equivalents:]{" + "[+autoload?\btypeset -fu\b]" + "[+compound?\btypeset -C\b]" + "[+float?\btypeset -lE\b]" + "[+functions?\btypeset -f\b]" + "[+integer?\btypeset -li\b]" + "[+nameref?\btypeset -n\b]" +"}" +"[+?If no \aname\as are specified then variables that have the specified " + "options are displayed. If the first option is specified with " + "a leading \b-\b then the name and value of each variable is " + "written to standard output. Otherwise, only the names are " + "written. If no options are specified or just \b-p\b is " + "specified, then the names and attributes of all variables that have " + "attributes are written to standard output. When \b-f\b is specified, " + "the names displayed will be function names.]" +"[+?If \b-f\b is specified, then each \aname\a refers to a function " + "and the only valid options are \b-u\b and \b-t\b. In this " + "case no \b=\b\avalue\a can be specified.]" +"[+?\btypeset\b is built in to the shell as a declaration command so that " + "field splitting and pathname expansion are not performed on " + "the arguments. Tilde expansion occurs on \avalue\a.]" +#if 1 +"[a]:?[type?Indexed array. This is the default. If \b[\b\atype\a\b]]\b is " + "specified, each subscript is interpreted as a value of type \atype\a.]" +#else +"[a?Indexed array. this is the default.]" +#endif +"[b?Each \aname\a may contain binary data. Its value is the mime " + "base64 encoding of the data. It can be used with \b-Z\b, " + "to specify fixed sized fields.]" +"[f?Each of the options and \aname\as refers to a function.]" +"[i]#?[base:=10?An integer. \abase\a represents the arithmetic base " + "from 2 to 64.]" +"[l?Without \b-i\b, sets character mapping to \btolower\b. When used " + "with \b-i\b, \b-E\b, or \b-F\b indicates long variant.]" +"[m?Move. The value is the name of a variable whose value will be " + "moved to \aname\a. The original variable will be unset. Cannot be " + "used with any other options.]" +"[n?Name reference. The value is the name of a variable that \aname\a " + "references. \aname\a cannot contain a \b.\b. Cannot be used with " + "any other options.]" +"[p?Causes the output to be in a format that can be used as input to the " + "shell to recreate the attributes for variables.]" +"[r?Enables readonly. Once enabled it cannot be disabled. See " + "\breadonly\b(1).]" +"[s?Used with \b-i\b to restrict integer size to short.]" +"[t?When used with \b-f\b, enables tracing for each of the specified " + "functions. Otherwise, \b-t\b is a user defined attribute and " + "has no meaning to the shell.]" +"[u?Without \b-f\b or \b-i\b, sets character mapping to \btoupper\b. When " + "used with \b-f\b specifies that \aname\a is a function " + "that hasn't been loaded yet. With \b-i\b specifies that the " + "value will be displayed as an unsigned integer.]" +"[x?Puts each \aname\a on the export list. See \bexport\b(1). \aname\a " + "cannot contain a \b.\b.]" +"[A?Associative array. Each \aname\a will converted to an associate " + "array. If a variable already exists, the current value will " + "become index \b0\b.]" +"[C?Compound variable. Each \aname\a will be a compound variable. If " + "\avalue\a names a compound variable it will be copied to \aname\a. " + "Otherwise if the variable already exists, it will first be unset.]" +"[E]#?[n:=10?Floating point number represented in scientific notation. " + "\an\a specifies the number of significant figures when the " + "value is expanded.]" +"[F]#?[n:=10?Floating point. \an\a is the number of places after the " + "decimal point when the value is expanded.]" +"[H?Hostname mapping. Each \aname\a holds a native pathname. Assigning a " + "UNIX format pathname will cause it to be converted to a pathname " + "suitable for the current host. This has no effect when the " + "native system is UNIX.]" +"[L]#?[n?Left justify. If \an\a is given it represents the field width. If " + "the \b-Z\b attribute is also specified, then leading zeros are " + "stripped.]" +"[M]:?[mapping?\amapping\a is the name of a character mapping known by " + "\bwctrans\b(3) such as \btolower\b or \btoupper\b. When the option " + "value \bmapping\b is omitted and there are no operands, all mapped " + "variables are displayed.]" +"[R]#?[n?Right justify. If \an\a is given it represents the field width. If " + "the \b-Z\b attribute is also specified, then zeros will " + "be used as the fill character. Otherwise, spaces are used.]" +"[X]#?[n:=2*sizeof(long long)?Floating point number represented in hexadecimal " + "notation. \an\a specifies the number of significant figures when the " + "value is expanded.]" + +#ifdef SHOPT_TYPEDEF +"[h]:[string?Used within a type definition to provide a help string " + "for variable \aname\a. Otherwise, it is ignored.]" +"[S?Used with a type definition to indicate that the variable is shared by " + "each instance of the type. When used inside a function defined " + "with the \bfunction\b reserved word, the specified variables " + "will have function static scope. Otherwise, the variable is " + "unset prior to processing the assignment list.]" +#endif +"[T]:?[tname?\atname\a is the name of a type name given to each \aname\a.]" +"[Z]#?[n?Zero fill. If \an\a is given it represents the field width.]" +"\n" +"\n[name[=value]...]\n" +" -f [name...]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?No errors occurred.]" + "[+>0?An error occurred.]" +"}" + +"[+SEE ALSO?\breadonly\b(1), \bexport\b(1)]" +; + +const char sh_optulimit[] = +"[-1c?@(#)$Id: ulimit (AT&T Research) 2003-06-21 $\n]" +USAGE_LICENSE +"[+NAME?ulimit - set or display resource limits]" +"[+DESCRIPTION?\bulimit\b sets or displays resource limits. These " + "limits apply to the current process and to each child process " + "created after the resource limit has been set. If \alimit\a " + "is specified, the resource limit is set, otherwise, its current value " + "is displayed on standard output.]" +"[+?Increasing the limit for a resource usually requires special privileges. " + "Some systems allow you to lower resource limits and later increase " + "them. These are called soft limits. Once a hard limit is " + "set the resource can not be increased.]" +"[+?Different systems allow you to specify different resources and some " + "restrict how much you can raise the limit of the resource.]" +"[+?The value of \alimit\a depends on the unit of the resource listed " + "for each resource. In addition, \alimit\a can be \bunlimited\b " + "to indicate no limit for that resource.]" +"[+?If you do not specify \b-H\b or \b-S\b, then \b-S\b is used for " + "listing and both \b-S\b and \b-H\b are used for setting resources.]" +"[+?If you do not specify any resource, the default is \b-f\b.]" +"[H?A hard limit is set or displayed.]" +"[S?A soft limit is set or displayed.]" +"[a?Displays all current resource limits]" +"\flimits\f" +"\n" +"\n[limit]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?Successful completion.]" + "[+>0?A request for a higher limit was rejected or an error occurred.]" +"}" + +"[+SEE ALSO?\bulimit\b(2), \bgetrlimit\b(2)]" +; + +const char sh_opttimes[] = +"[-1c?@(#)$Id: times (ksh93) 2020-07-14 $\n]" +"[+NAME?times - display CPU usage by the shell and child processes]" +"[+DESCRIPTION?\btimes\b displays the accumulated user and system CPU times, " +"one line with the times used by the shell and another with those used by " +"all of the shell's child processes. No options are supported.]" +"[+SEE ALSO?\btime\b(1)]" +; + +const char sh_optumask[] = +"[-1c?\n@(#)$Id: umask (AT&T Research) 1999-04-07 $\n]" +USAGE_LICENSE +"[+NAME?umask - get or set the file creation mask]" +"[+DESCRIPTION?\bumask\b sets the file creation mask of the current " + "shell execution environment to the value specified by the " + "\amask\a operand. This mask affects the file permission bits " + "of subsequently created files. \amask\a can either be an " + "octal number or a symbolic value as described in \bchmod\b(1). " + "If a symbolic value is given, the new file creation mask is the " + "complement of the result of applying \amask\a to the complement " + "of the current file creation mask.]" +"[+?If \amask\a is not specified, \bumask\b writes the value of the " + "file creation mask for the current process to standard output.]" +"[S?Causes the file creation mask to be written or treated as a symbolic value " + "rather than an octal number.]" +"\n" +"\n[mask]\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?The file creation mask was successfully changed, or no " + "\amask\a operand was supplied.]" + "[+>0?An error occurred.]" +"}" +"[+SEE ALSO?\bchmod\b(1)]" +; +const char sh_optuniverse[] = " [name]"; +const char sh_optunset[] = +"[-1c?\n@(#)$Id: unset (AT&T Research) 1999-07-07 $\n]" +USAGE_LICENSE +"[+NAME?unset - unset values and attributes of variables and functions]" +"[+DESCRIPTION?For each \aname\a specified, \bunset\b unsets the variable, " + "or function if \b-f\b is specified, from the current shell " + "execution environment. Readonly variables cannot be unset.]" +"[n?If \aname\a refers to variable that is a reference, the variable \aname\a " + "will be unset rather than the variable it references. Otherwise, " + "is is equivalent to \b-v\b.]" +"[f?\aname\a refers to a function name and the shell will unset the " + "function definition.]" +"[v?\aname\a refers to a variable name and the shell will unset it and " + "remove it from the environment. This is the default behavior.]" +"\n" +"\nname...\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?All \aname\as were successfully unset.]" + "[+>0?One or more \aname\a operands could not be unset " + "or an error occurred.]" +"}" + +"[+SEE ALSO?\btypeset\b(1)]" +; + +const char sh_optunalias[] = +"[-1c?\n@(#)$Id: unalias (AT&T Research) 1999-07-07 $\n]" +USAGE_LICENSE +"[+NAME?unalias - remove alias definitions]" +"[+DESCRIPTION?\bunalias\b removes the definition of each named alias " + "from the current shell execution environment, or all aliases if " + "\b-a\b is specified. It will not affect any commands that " + "have already been read and subsequently executed.]" +"[a?Causes all alias definitions to be removed. \aname\a operands " + "are optional and ignored in this case.]" +"\n" +"\nname...\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?Successful completion.]" + "[+>0?\b-a\b was not specified and one or more \aname\a operands " + "did not have an alias definition, or an error occurred.]" +"}" + +"[+SEE ALSO?\balias\b(1)]" +; + +const char sh_optwait[] = +"[-1c?\n@(#)$Id: wait (AT&T Research) 1999-06-17 $\n]" +USAGE_LICENSE +"[+NAME?wait - wait for process or job completion]" +"[+DESCRIPTION?\bwait\b with no operands, waits until all jobs " + "known to the invoking shell have terminated. If one or more " + "\ajob\a operands are specified, \bwait\b waits until all of them " + "have completed.]" +_JOB_ +"[+?If one ore more \ajob\a operands is a process id or process group id " + "not known by the current shell environment, \bwait\b treats each " + "of them as if it were a process that exited with status 127.]" +"\n" +"\n[job ...]\n" +"\n" +"[+EXIT STATUS?If \await\a is invoked with one or more \ajob\as, and all of " + "them have terminated or were not known by the invoking shell, " + "the exit status of \bwait\b will be that of the last \ajob\a. " + "Otherwise, it will be one of the following:]{" + "[+0?\bwait\b utility was invoked with no operands and all " + "processes known by the invoking process have terminated.]" + "[+127?\ajob\a is a process id or process group id that is unknown " + "to the current shell environment.]" +"}" + +"[+SEE ALSO?\bjobs\b(1), \bps\b(1)]" +; + +const char sh_optwhence[] = +"[-1c?\n@(#)$Id: whence (AT&T Research/ksh93) 2020-07-20 $\n]" +USAGE_LICENSE +"[+NAME?whence, type - locate a command and describe its type]" +"[+DESCRIPTION?Without \b-v\b, \bwhence\b writes on standard output an " + "absolute pathname, if any, corresponding to \aname\a based " + "on the complete search order that the shell uses. If \aname\a " + "is not found, then no output is produced.]" +"[+?If \b-v\b is specified, the output will also contain information " + "that indicates how the given \aname\a would be interpreted by " + "the shell in the current execution environment.]" +"[+?The \btype\b command is equivalent to \bwhence -v\b.]" +"[a?Like \b-v\b but displays all uses for each \aname\a rather than the first.]" +"[f?Do not check for functions.]" +"[p?Do not check to see if \aname\a is a reserved word, a built-in, " + "an alias, or a function. This turns off the \b-v\b option.]" +"[q?Quiet mode. Returns 0 if all arguments are built-ins, functions, or are " + "programs found on the path.]" +"[v?For each name you specify, the shell displays a line that indicates " + "if that name is one of the following:]{" + "[+?Reserved word]" + "[+?Alias]" + "[+?Built-in]" + "[+?Undefined function]" + "[+?Function]" + "[+?Tracked alias]" + "[+?Program]" +"}" +"\n" +"\nname ...\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?Each \aname\a was found by the shell.]" + "[+1?One or more \aname\as were not found by the shell.]" + "[+>1?An error occurred.]" +"}" + +"[+SEE ALSO?\bcommand\b(1)]" +; const char e_alrm1[] = "alarm -r %s +%.3g\n"; const char e_alrm2[] = "alarm %s %.3f\n"; -const char e_badfun[] = "%s: illegal function name"; const char e_baddisc[] = "%s: invalid discipline function"; const char e_nospace[] = "out of memory"; const char e_nofork[] = "cannot fork"; const char e_nosignal[] = "%s: unknown signal name"; -const char e_numeric[] = "*([0-9])?(.)*([0-9])"; const char e_condition[] = "condition(s) required"; const char e_cneedsarg[] = "-c requires argument"; diff --git a/cde/programs/dtksh/dtextra.h b/cde/programs/dtksh/dtextra.h index dc187c8b3..9940c181c 100644 --- a/cde/programs/dtksh/dtextra.h +++ b/cde/programs/dtksh/dtextra.h @@ -45,7 +45,7 @@ */ #if defined(bltin) && ( defined(__STDC__) || defined(__STDPP__) ) -#define lcl_cast(x) ((int (*)__PROTO__((int, char*[], __V_*)))x) +#define lcl_cast(x) ((int (*)__PROTO__((int, char*[], Shbltin_t*)))x) #else #define lcl_cast(x) x #endif diff --git a/cde/programs/dtksh/dtkcmds.c b/cde/programs/dtksh/dtkcmds.c index b47ee1606..976096e7b 100644 --- a/cde/programs/dtksh/dtkcmds.c +++ b/cde/programs/dtksh/dtkcmds.c @@ -31,8 +31,8 @@ /* X includes */ -#include "name.h" -#include "shell.h" +#include "name.h" +#include "shell.h" #include #include #include diff --git a/cde/programs/dtksh/dtkcvt.c b/cde/programs/dtksh/dtkcvt.c index 04a695949..299e84788 100644 --- a/cde/programs/dtksh/dtkcvt.c +++ b/cde/programs/dtksh/dtkcvt.c @@ -32,7 +32,7 @@ /* X includes */ -#include "shell.h" +#include "shell.h" #include #include #include diff --git a/cde/programs/dtksh/extra.c b/cde/programs/dtksh/extra.c index 28c40f309..3a0594bcf 100644 --- a/cde/programs/dtksh/extra.c +++ b/cde/programs/dtksh/extra.c @@ -70,7 +70,7 @@ int ksh_eval( char *cmd ) { - sh_eval(sfopen(NIL(Sfile_t*),cmd,"s"),0); + sh_eval(sfopen(NIL(Sfio_t*),cmd,"s"),0); sfsync(sh.outpool); return(sh.exitval); } diff --git a/cde/programs/dtksh/findsym.c b/cde/programs/dtksh/findsym.c index 8f9396661..266e8c0c3 100644 --- a/cde/programs/dtksh/findsym.c +++ b/cde/programs/dtksh/findsym.c @@ -30,6 +30,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ +#include "shell.h" #include "stdio.h" #include @@ -39,8 +40,6 @@ #else #include #endif -/* from ksh93/include/ast/shell.h */ -extern void **sh_getliblist(void); #endif #ifdef HPUX_DYNLIB #include @@ -65,7 +64,6 @@ fsym( int lib ) { #ifdef DYNLIB - void ** liblist; int i = 0; long addr; #endif @@ -75,12 +73,11 @@ fsym( #endif #ifdef DYNLIB - if ((liblist = sh_getliblist()) == NULL) - return(NULL); - - while (liblist[i]) + if (liblist == NULL) + return (NULL); + while (liblist[i].dll) { - if (addr = dlsym(liblist[i], str)) + if (addr = dlsym(liblist[i].dll, str)) return((unsigned long)addr); i++; } diff --git a/cde/programs/dtksh/init.c b/cde/programs/dtksh/init.c new file mode 100644 index 000000000..0a5b848ec --- /dev/null +++ b/cde/programs/dtksh/init.c @@ -0,0 +1,2746 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1982-2012 AT&T Intellectual Property * +* and is licensed under the * +* Eclipse Public License, Version 1.0 * +* by AT&T Intellectual Property * +* * +* A copy of the License is available at * +* http://www.eclipse.org/org/documents/epl-v10.html * +* (with md5 checksum b35adb5213ca9657e911e9befb180842) * +* * +* Information and Software Systems Research * +* AT&T Research * +* Florham Park NJ * +* * +* David Korn * +* * +***********************************************************************/ +#pragma prototyped +/* + * + * Shell initialization + * + * David Korn + * AT&T Labs + * + */ + +#include "defs.h" +#include +#include +#include +#include +#include +#include "variables.h" +#include "path.h" +#include "fault.h" +#include "name.h" +#include "edit.h" +#include "jobs.h" +#include "io.h" +#include "shlex.h" +#include "builtins.h" +#include "FEATURE/time" +#include "FEATURE/dynamic" +#include "FEATURE/externs" +#include "lexstates.h" +#include "version.h" + +#ifdef BUILD_DTKSH +#include
+#include
+#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "hash.h" +#include "stdio.h" + +#define NO_AST +#include "dtksh.h" +#undef NO_AST +#include "xmksh.h" +#include "dtkcmds.h" +#include "xmcvt.h" +#include "widget.h" +#include "extra.h" +#include "xmwidgets.h" +#include "msgs.h" +#include +#endif + +#if _hdr_wctype +#include +#include +#endif +#if !_typ_wctrans_t +#undef wctrans_t +#define wctrans_t sh_wctrans_t +typedef long wctrans_t; +#endif +#if !_lib_wctrans +#undef wctrans +#define wctrans sh_wctrans +static wctrans_t wctrans(const char *name) +{ + if(strcmp(name,e_tolower)==0) + return(1); + else if(strcmp(name,e_toupper)==0) + return(2); + return(0); +} +#endif +#if !_lib_towctrans +#undef towctrans +#define towctrans sh_towctrans +static int towctrans(int c, wctrans_t t) +{ + if(t==1 && isupper(c)) + c = tolower(c); + else if(t==2 && islower(c)) + c = toupper(c); + return(c); +} +#endif + +char e_version[] = "\n@(#)$Id: Version " +#if SHOPT_AUDIT +#define ATTRS 1 + "A" +#endif +#if SHOPT_BASH +#define ATTRS 1 + "B" +#endif +#if SHOPT_BGX +#define ATTRS 1 + "J" +#endif +#if SHOPT_ACCT +#define ATTRS 1 + "L" +#endif +#if SHOPT_MULTIBYTE +#define ATTRS 1 + "M" +#endif +#if SHOPT_PFSH && _hdr_exec_attr +#define ATTRS 1 + "P" +#endif +#if SHOPT_REGRESS +#define ATTRS 1 + "R" +#endif +#if ATTRS + " " +#endif + SH_RELEASE " $\0\n"; + +#if SHOPT_BASH + extern void bash_init(Shell_t*,int); +#endif + +#define RANDMASK 0x7fff + +#ifndef ARG_MAX +# define ARG_MAX (1*1024*1024) +#endif +#ifndef CHILD_MAX +# define CHILD_MAX (1*1024) +#endif +#ifndef CLK_TCK +# define CLK_TCK 60 +#endif /* CLK_TCK */ + +#ifndef environ + extern char **environ; +#endif + +#undef getconf +#define getconf(x) strtol(astconf(x,NiL,NiL),NiL,0) + +struct seconds +{ + Namfun_t hdr; + Shell_t *sh; +}; + +struct rand +{ + Namfun_t hdr; + Shell_t *sh; + int32_t rand_last; +}; + +struct ifs +{ + Namfun_t hdr; + Namval_t *ifsnp; +}; + +struct match +{ + Namfun_t hdr; + const char *v; + char *val; + char *rval[2]; + regoff_t *match; + char node[NV_MINSZ+sizeof(char*)]; + regoff_t first; + int vsize; + int nmatch; + int index; + int lastsub[2]; +}; + +typedef struct _init_ +{ + Shell_t *sh; + struct ifs IFS_init; + Namfun_t PATH_init; + Namfun_t FPATH_init; + Namfun_t CDPATH_init; + Namfun_t SHELL_init; + Namfun_t ENV_init; + Namfun_t VISUAL_init; + Namfun_t EDITOR_init; + Namfun_t HISTFILE_init; + Namfun_t HISTSIZE_init; + Namfun_t OPTINDEX_init; + struct seconds SECONDS_init; + struct rand RAND_init; + Namfun_t LINENO_init; + Namfun_t L_ARG_init; + Namfun_t SH_VERSION_init; + struct match SH_MATCH_init; + Namfun_t SH_MATH_init; +#ifdef _hdr_locale + Namfun_t LC_TYPE_init; + Namfun_t LC_NUM_init; + Namfun_t LC_COLL_init; + Namfun_t LC_MSG_init; + Namfun_t LC_ALL_init; + Namfun_t LANG_init; +#endif /* _hdr_locale */ +} Init_t; + +static Init_t *ip; +static int lctype; +static int nbltins; +static void env_init(Shell_t*); +static Init_t *nv_init(Shell_t*); +static Dt_t *inittree(Shell_t*,const struct shtable2*); +static int shlvl; + +#ifdef _WINIX +# define EXE "?(.exe)" +#else +# define EXE +#endif + +static int rand_shift; + + +/* + * out of memory routine for stak routines + */ +static char *nospace(int unused) +{ + NOT_USED(unused); + errormsg(SH_DICT,ERROR_exit(3),e_nospace); + return(NIL(char*)); +} + +/* Trap for VISUAL and EDITOR variables */ +static void put_ed(register Namval_t* np,const char *val,int flags,Namfun_t *fp) +{ + register const char *cp, *name=nv_name(np); + register int newopt=0; + Shell_t *shp = nv_shell(np); + if(*name=='E' && nv_getval(sh_scoped(shp,VISINOD))) + goto done; + if(!(cp=val) && (*name=='E' || !(cp=nv_getval(sh_scoped(shp,EDITNOD))))) + goto done; + /* turn on vi or emacs option if editor name is either*/ + cp = path_basename(cp); + if(strmatch(cp,"*[Vv][Ii]*")) + newopt=SH_VI; + else if(strmatch(cp,"*gmacs*")) + newopt=SH_GMACS; + else if(strmatch(cp,"*macs*")) + newopt=SH_EMACS; + if(newopt) + { + sh_offoption(SH_VI); + sh_offoption(SH_EMACS); + sh_offoption(SH_GMACS); + sh_onoption(newopt); + } +done: + nv_putv(np, val, flags, fp); +} + +/* Trap for HISTFILE and HISTSIZE variables */ +static void put_history(register Namval_t* np,const char *val,int flags,Namfun_t *fp) +{ + Shell_t *shp = nv_shell(np); + void *histopen = shp->gd->hist_ptr; + char *cp; + if(val && histopen) + { + if(np==HISTFILE && (cp=nv_getval(np)) && strcmp(val,cp)==0) + return; + if(np==HISTSIZE && sh_arith(shp,val)==nv_getnum(HISTSIZE)) + return; + hist_close(shp->gd->hist_ptr); + } + nv_putv(np, val, flags, fp); + if(histopen) + { + if(val) + sh_histinit(shp); + else + hist_close(histopen); + } +} + +/* Trap for OPTINDEX */ +static void put_optindex(Namval_t* np,const char *val,int flags,Namfun_t *fp) +{ + Shell_t *shp = nv_shell(np); + shp->st.opterror = shp->st.optchar = 0; + nv_putv(np, val, flags, fp); + if(!val) + nv_disc(np,fp,NV_POP); +} + +static Sfdouble_t nget_optindex(register Namval_t* np, Namfun_t *fp) +{ + return((Sfdouble_t)*np->nvalue.lp); +} + +static Namfun_t *clone_optindex(Namval_t* np, Namval_t *mp, int flags, Namfun_t *fp) +{ + Namfun_t *dp = (Namfun_t*)malloc(sizeof(Namfun_t)); + memcpy((void*)dp,(void*)fp,sizeof(Namfun_t)); + mp->nvalue.lp = np->nvalue.lp; + dp->nofree = 0; + return(dp); +} + + +/* Trap for restricted variables FPATH, PATH, SHELL, ENV */ +static void put_restricted(register Namval_t* np,const char *val,int flags,Namfun_t *fp) +{ + Shell_t *shp = nv_shell(np); + int path_scoped = 0, fpath_scoped=0; + Pathcomp_t *pp; + char *name = nv_name(np); + if(!(flags&NV_RDONLY) && sh_isoption(SH_RESTRICTED)) + errormsg(SH_DICT,ERROR_exit(1),e_restricted,nv_name(np)); + if(np==PATHNOD || (path_scoped=(strcmp(name,PATHNOD->nvname)==0))) + { + /* Clear the hash table */ + nv_scan(shp->track_tree,nv_rehash,(void*)0,NV_TAGGED,NV_TAGGED); + if(path_scoped && !val) + val = PATHNOD->nvalue.cp; + } + if(val && !(flags&NV_RDONLY) && np->nvalue.cp && strcmp(val,np->nvalue.cp)==0) + return; + if(np==FPATHNOD || (fpath_scoped=(strcmp(name,FPATHNOD->nvname)==0))) + shp->pathlist = (void*)path_unsetfpath(shp); + nv_putv(np, val, flags, fp); + shp->universe = 0; + if(shp->pathlist) + { + val = np->nvalue.cp; + if(np==PATHNOD || path_scoped) + pp = (void*)path_addpath(shp,(Pathcomp_t*)shp->pathlist,val,PATH_PATH); + else if(val && (np==FPATHNOD || fpath_scoped)) + pp = (void*)path_addpath(shp,(Pathcomp_t*)shp->pathlist,val,PATH_FPATH); + else + return; + if(shp->pathlist = (void*)pp) + pp->shp = shp; + if(!val && (flags&NV_NOSCOPE)) + { + Namval_t *mp = dtsearch(shp->var_tree,np); + if(mp && (val=nv_getval(mp))) + nv_putval(mp,val,NV_RDONLY); + } +#if 0 +sfprintf(sfstderr,"%d: name=%s val=%s\n",getpid(),name,val); +path_dump((Pathcomp_t*)shp->pathlist); +#endif + } +} + +static void put_cdpath(register Namval_t* np,const char *val,int flags,Namfun_t *fp) +{ + Pathcomp_t *pp; + Shell_t *shp = nv_shell(np); + nv_putv(np, val, flags, fp); + if(!shp->cdpathlist) + return; + val = np->nvalue.cp; + pp = (void*)path_addpath(shp,(Pathcomp_t*)shp->cdpathlist,val,PATH_CDPATH); + if(shp->cdpathlist = (void*)pp) + pp->shp = shp; +} + +#ifdef _hdr_locale + +#ifdef BUILD_DTKSH +/* + * This version of putenv uses the hash storage to assign environment values + * + * The original ksh93 code had this routine called "putenv". This hid + * the libc version of putenv, which caused problems for dtksh on systems + * with shared libraries, as it caused the existence of two separate and + * non-overlapping environments. To the best of my knowledge there are + * no calls to this routine. - harry phinney 8/15/1994. + */ +int ksh_putenv(const char *name) +{ + Namval_t *np; + if(name) + { + np = nv_open(name,sh.var_tree,NV_EXPORT|NV_IDENT|NV_ARRAY|NV_ASSIGN); + if(!strchr(name,'=')) + nv_unset(np); + } + return(0); +} + +void +SyncEnv( + char *name) +{ + char *value, *buf; + + value = getenv(name); + if(value != (char *)NULL) + { + buf = malloc(strlen(name) + strlen(value) + 2); + strcpy(buf, name); + strcat(buf, "="); + strcat(buf, value); + ksh_putenv(buf); + free(buf); /* I hope it's legal to free this! */ + } +} + +/* + * The following struct is based on an alphanumerically sorted list of + * all ksh-generated messages which might be displayed, and + * must be looked up in a message catalog. The point of this is to + * translate from the AT&T/UI style of string-based message indexing + * to the X/OPEN style of message number lookup. The following struct + * allows us to do a binary search on the strings to find the associated + * set number and message ID. While we could have used the string index + * as the message number, that would cause headaches if/when we + * need to add more messages, as all following messages would have to + * be renumbered. + */ +typedef struct { + char *string; + int setNum; + int msgNum; +} MsgStr, *MsgPtr; + +static MsgStr allmsgs[] = { + {" Done", 25, 1}, + {" Running", 25, 3}, + {" [-n] [arg...]", 25, 4}, + {" [arg...]", 25, 5}, + {" [dir] [list]", 25, 6}, + {" [job...]", 25, 7}, + {" [n]", 25, 8}, + {" [name [pathname] ]", 25, 9}, + {" [name]", 25, 10}, + {" [top] [base]", 25, 11}, + {" expr...", 25, 12}, + {" format [arg...]", 25, 13}, + {" is a function", 25, 14}, + {" is a keyword", 25, 15}, + {" is a shell builtin", 25, 16}, + {" is an exported function", 25, 17}, + {" is an undefined function", 25, 18}, + {" name [arg...]", 25, 19}, + {":a:[name] optstring name [args...]", 25, 20}, + {" seconds", 25, 21}, + {"${HOME:-.}/.profile", 25, 23}, + {"%c: invalid character in expression - %s", 25, 24}, + {"%c: unknown format specifier", 25, 25}, + {"%d-%d: invalid range", 25, 26}, + {"%d: invalid binary script version", 25, 27}, + {"%s is an alias for ", 25, 28}, + {"%s is an exported alias for ", 25, 29}, + {"%s missing", 25, 30}, + {"%s unknown base", 25, 31}, + {"%s: ':' expected for '?' operator", 25, 32}, + {"%s: Ambiguous", 25, 33}, + {"%s: Arguments must be %job or process ids", 25, 34}, + {"%s: alias not found\n", 25, 35}, + {"%s: arithmetic syntax error", 25, 36}, + {"%s: assignment requires lvalue", 25, 37}, + {"%s: bad file unit number", 25, 38}, + {"%s: bad format", 25, 39}, + {"%s: bad number", 25, 40}, + {"%s: bad option(s)", 25, 41}, + {"%s: bad substitution", 25, 42}, + {"%s: bad trap", 25, 43}, + {"%s: cannot create", 25, 44}, + {"%s: cannot execute", 25, 45}, + {"%s: cannot open", 25, 46}, + {"%s: divide by zero", 25, 47}, + {"%s: domain exception", 25, 48}, + {"%s: fails %s", 25, 49}, + {"%s: file already exists", 25, 50}, + {"%s: illegal function name", 25, 51}, + {"%s: invalid alias name", 25, 52}, + {"%s: invalid discipline function", 25, 53}, + {"%s: invalid export name", 25, 54}, + {"%s: invalid function name", 25, 55}, + {"%s: invalid name", 25, 56}, + {"%s: invalid regular expression", 25, 57}, + {"%s: invalid self reference", 25, 58}, + {"%s: invalid use of :", 25, 59}, + {"%s: invalid variable name", 25, 60}, + {"%s: is not an identifier", 25, 61}, + {"%s: is read only", 25, 62}, + {"%s: label not implemented", 25, 63}, + {"%s: limit exceeded", 25, 64}, + {"%s: more tokens expected", 25, 65}, + {"%s: no parent", 25, 66}, + {"%s: no reference name", 25, 67}, + {"%s: not found", 25, 68}, + {"%s: not implemented", 25, 69}, + {"%s: operands have incompatible types", 25, 70}, + {"%s: overflow exception", 25, 71}, + {"%s: parameter not set", 25, 72}, + {"%s: parameter null or not set", 25, 73}, + {"%s: recursion too deep", 25, 74}, + {"%s: reference variable cannot be an array", 25, 75}, + {"%s: requires pathname argument", 25, 76}, + {"%s: restricted", 25, 77}, + {"%s: singularity exception", 25, 78}, + {"%s: subscript out of range", 25, 79}, + {"%s: unbalanced parenthesis", 25, 80}, + {"%s: unknown function", 25, 81}, + {"%s: unknown locale", 25, 82}, + {"%s: unknown operator", 25, 83}, + {"%s: unknown signal name", 25, 84}, + {"%s: would cause loop", 25, 85}, + {"(coredump)", 25, 86}, + {"-c requires argument", 25, 87}, + {"-e - requires single argument", 25, 88}, + {"/vpix", 25, 89}, + {"", 25, 90}, + {"AC:E#?F#?H:[name]L#?R#?Z#?fi#?[base]lnprtux [name=[value]...]", 25, 91}, + {"AE#?F#?HL#?R#?Z#?fi#?[base]lnprtux [name=[value]...]", 25, 92}, + {"Abort", 25, 93}, + {"Ad:[delim]prst#[timeout]u#[filenum] [name...]", 25, 94}, + {"Alarm call", 25, 95}, + {"Bad root node specification", 25, 96}, + {"Bad system call", 25, 97}, + {"Broken Pipe", 25, 98}, + {"Bus error", 25, 99}, + {"Cannot start job control", 25, 100}, + {"Current option settings", 25, 101}, + {"DIL signal", 25, 102}, + {"Death of Child", 25, 103}, + {"DircabefhkmnpstuvxCR:[file]o:?[option] [arg...]", 25, 104}, + {"DircabefhkmnpstuvxCo:?[option] [arg...]", 25, 105}, + {"EMT trap", 25, 106}, + {"Exceeded CPU time limit", 25, 107}, + {"Exceeded file size limit", 25, 108}, + {"Floating exception", 25, 109}, + {"HSacdfmnstv [limit]", 25, 110}, + {"Hangup", 25, 111}, + {"IO signal", 25, 112}, + {"Illegal instruction", 25, 113}, + {"Interrupt", 25, 114}, + {"Killed", 25, 115}, + {"LP [dir] [change]", 25, 116}, + {"Memory fault", 25, 117}, + {"Migrate process", 25, 118}, + {"No job control", 25, 119}, + {"Phone interrupt", 25, 120}, + {"Polling alarm", 25, 121}, + {"Power fail", 25, 122}, + {"Profiling time alarm", 25, 123}, + {"Quit", 25, 124}, + {"Resources lost", 25, 125}, + {"Reverting to old tty driver...", 25, 126}, + {"S [mask]", 25, 127}, + {"Security label changed", 25, 129}, + {"Socket interrupt", 25, 130}, + {"Sound completed", 25, 131}, + {"Stopped (signal)", 25, 132}, + {"Stopped (tty input)", 25, 133}, + {"Stopped process continued", 25, 134}, + {"Stopped", 25, 135}, + {"Stopped(tty output)", 25, 136}, + {"Switching to new tty driver...", 25, 137}, + {"System crash soon", 25, 138}, + {"Terminated", 25, 139}, + {"Trace/BPT trap", 25, 140}, + {"Unrecognized version", 25, 141}, + {"Use 'exit' to terminate this shell", 25, 142}, + {"User signal 1", 25, 143}, + {"User signal 2", 25, 144}, + {"Version not defined", 25, 145}, + {"Virtual time alarm", 25, 146}, + {"Window size change", 25, 147}, + {"You have running jobs", 25, 148}, + {"You have stopped jobs", 25, 149}, + {"[_[:alpha:]]*([_[:alnum:]])", 25, 150}, + {"\n@(#)Version 12/28/93\0\n", 25, 151}, + {"\n@(#)Version M-12/28/93\0\n", 25, 152}, + {"\nreal", 25, 153}, + {"\r\n\007shell will timeout in 60 seconds due to inactivity", 25, 154}, + {"a name...", 25, 155}, + {"a:c [command [args...] ]", 25, 156}, + {"afpv name...", 25, 157}, + {"alarm %s %.3f\n", 25, 158}, + {"alarm -r %s +%.3g\n", 25, 159}, + {"argument expected", 25, 160}, + {"bad directory", 25, 161}, + {"bad file unit number", 25, 162}, + {"bad substitution", 25, 163}, + {"cannot access parent directories", 25, 164}, + {"cannot create pipe", 25, 165}, + {"cannot create tempory file", 25, 166}, + {"cannot fork", 25, 167}, + {"cannot get %s", 25, 168}, + {"cannot set %s", 25, 169}, + {"cannot set alarm", 25, 170}, + {"condition(s) required", 25, 171}, + {"dsf:[library] [name...]", 25, 172}, + {"e:[editor]lnrsN# [first] [last]", 25, 173}, + {"end of file", 25, 174}, + {"f:[format]enprsu:[filenum] [arg...]", 25, 175}, + {"fnv name...", 25, 176}, + {"hist -e \"${VISUAL:-${EDITOR:-vi}}\" ", 25, 177}, + {"history file cannot open", 25, 178}, + {"incorrect syntax", 25, 179}, + {"invalid argument of type %c", 25, 180}, + {"is a shell builtin version of", 25, 181}, + {"is a tracked alias for", 25, 182}, + {"kill", 25, 183}, + {"line %d: $ not preceded by \\", 25, 184}, + {"line %d: %c within ${} should be quoted", 25, 185}, + {"line %d: %s unknown label", 25, 186}, + {"line %d: %s within [[...]] obsolete, use ((...))", 25, 187}, + {"line %d: '=' obsolete, use '=='", 25, 188}, + {"line %d: -a obsolete, use -e", 25, 189}, + {"line %d: \\ in front of %c reserved for future use", 25, 190}, + {"line %d: `...` obsolete, use $(...)", 25, 191}, + {"line %d: escape %c to avoid ambiguities", 25, 192}, + {"line %d: label %s ignored", 25, 193}, + {"line %d: quote %c to avoid ambiguities", 25, 194}, + {"line %d: set %s obsolete", 25, 195}, + {"line %d: spaces required for nested subshell", 25, 196}, + {"line %d: use braces to avoid ambiguities with $id[...]", 25, 197}, + {"line %d: use space or tab to separate operators %c and %c", 25, 198}, + {"ln#[signum]s:[signame] sig...", 25, 199}, + {"login setuid/setgid shells prohibited", 25, 200}, + {"mapping", 25, 201}, + {"newline", 25, 202}, + {"nlp [job...]", 25, 203}, + {"no history file", 25, 204}, + {"no query process", 25, 205}, + {"no such job", 25, 206}, + {"no such process", 25, 207}, + {"not supported", 25, 208}, + {"off", 25, 209}, + {"on", 25, 210}, + {"open file limit exceeded", 25, 211}, + {"out of memory", 25, 212}, + {"p [action condition...]", 25, 213}, + {"p [name[=value]...]", 25, 214}, + {"parameter not set", 25, 215}, + {"permission denied", 25, 216}, + {"process already exists", 25, 217}, + {"ptx [name=[value]...]", 25, 218}, + {"pvV name [arg]...", 25, 219}, + {"r [varname seconds]", 25, 220}, + {"syntax error at line %d: `%s' %s", 25, 221}, + {"syntax error at line %d: duplicate label %s", 25, 222}, + {"syntax error: `%s' %s", 25, 223}, + {"sys", 25, 224}, + {"timed out waiting for input", 25, 225}, + {"unexpected", 25, 226}, + {"universe not accessible", 25, 227}, + {"unlimited", 25, 228}, + {"unmatched", 25, 229}, + {"user", 25, 230}, + {"versions", 25, 231}, + {"write to %d failed", 25, 232}, + {"you have mail in $_", 25, 233}, + {"zero byte", 25, 234}, +}; +#define _CLIENT_CAT_NAME "dtksh" + +/* + * Without this proto, standard C says that _DtGetMessage() returns + * an int, even though it really returns a pointer. The compiler is + * then free to use the high 32-bits of the return for + * something else (like scratch), and that can garble the pointer. + */ +char *_DtGetMessage(char *filename, int set, int n, char *s); +#define GETMESSAGE(set, number, string)\ + (_DtGetMessage(_CLIENT_CAT_NAME, set, number, string)) + +static int localeChanged = 1; + +void LocaleChanged(Namval_t *np, const char *val, int flags, Namfun_t *fp) +{ + localeChanged = 1; + nv_putv(np, val, flags, fp); + setlocale(LC_ALL, ""); +} + +static Namdisc_t localeDisc = { 0, LocaleChanged, NULL, NULL, NULL, NULL, NULL, NULL }; +static Namfun_t localeFun = {NULL, NULL }; + +/**************************************************************************** + * + * The following two functions are ugly, but necessary. Ksh reserves file + * descriptors 0 - 9 for use by shell scripts, and has intimate knowledge + * of how and when they were opened. Unfortunately, certain dtksh functions + * (XtInitialize, catopen, ttdt_open, _DtActionInvoke, others) open file + * descriptors which are not known to ksh. We can't let these file + * descriptors fall in the 0 - 9 range, because we can't afford to have + * the shell script overriding our file descriptors. Therefore, any of + * our commands which open files must first lock our file descriptors 0 - 9, + * thus forcing the command to get a file descriptor out of the shell's + * range. After the command has opened its file descriptor, it then needs + * to unlock file descriptors 0 - 9, so that the shell script will have + * access to them again. + * + **************************************************************************/ + + +/* + * Return a list of the file descriptors we had to open, to lock out file + * descriptors 0 - 9; this list should be freed (and the file descriptors + * closed) by calling UnlockkshFileDescriptors(). + */ + +int *LockKshFileDescriptors(void) +{ + int * fdList; + int i; + int fd, newfd; + + fdList = (int *)malloc(sizeof(int) * 10); + for (i = 0; i < 10; i++) + fdList[i] = -1; + + if ((fd = open("/dev/null", O_RDONLY)) >= 0) + { + if (fd < 10) + { + fdList[0] = fd; + for (i = 1; i < 10; i++) + { + if ((newfd = dup(fd)) < 10) + fdList[i] = newfd; + else + { + close(newfd); + break; + } + } + } + else + close(fd); + } + + return(fdList); +} + +void UnlockKshFileDescriptors(int *fdList) +{ + int i; + + for (i = 0; i < 10; i++) + { + if (fdList[i] != (-1)) + close(fdList[i]); + } + + free((char *)fdList); +} + +/* + * This function overrides the traditional libDtSvc version of this function. + * Since ksh dynamically changes to match the user's locale, we potentially + * need to change our message catalog in the middle of running. + */ +char *savedNlsPath; + +char *_DtGetMessage(char *filename, int set, int n, char *s) +{ + nl_catd catopen(); + char *catgets(); + int catclose(); + + static nl_catd nlmsg_fd = (nl_catd)-1; + static char *lang = NULL; + char *msg; + char * newLang; + int * lockedFds; + int swappedNlsPath = 0; + char *pEqual; + static char pathBuf[1024] = {(char)'N', (char)'L', (char)'S', (char)'P', + (char)'A', (char)'T', (char)'H', (char)'='}; + + if ( localeChanged ) + { + char *oldPath; + localeChanged = 0; + + newLang = (char *) getenv ("LANG"); + if (lang) + free(lang); + if (newLang) + lang = strdup(newLang); + else + lang = NULL; + + if (nlmsg_fd != (nl_catd)-1) + catclose(nlmsg_fd); + if(strcmp((oldPath = getenv("NLSPATH")), savedNlsPath) != 0) + { + swappedNlsPath = 1; + pEqual = strchr(pathBuf, '='); + strcpy(pEqual + 1, savedNlsPath); + /* + * Only call putenv if pathBuf isn't already holding NLSPATH + * in the environment. + */ + if(oldPath != (pEqual + 1)) + putenv(pathBuf); + } + lockedFds = LockKshFileDescriptors(); + nlmsg_fd = catopen(filename, 0); + UnlockKshFileDescriptors(lockedFds); + if(swappedNlsPath != 0) + { + swappedNlsPath = 0; + pEqual = strchr(pathBuf, '='); + strcpy(pEqual + 1, oldPath); + if(oldPath != (pEqual + 1)) + putenv(pathBuf); + } + } + msg=catgets(nlmsg_fd,set,n,s); + return (msg); +} + + /* + * This function needs to be modified to handle international + * error message translations + */ +static char *msg_translate(const char *message,int type) +{ + int startIndex = 0, endIndex = sizeof(allmsgs)/sizeof(MsgStr) - 1, + midIndex, res, weFoundIt = 0; + + if(type != 1) /* if it's not a shell message, don't translate */ + return((char*)message); + + while(startIndex != endIndex) + { + midIndex = (startIndex + endIndex) / 2; + if(midIndex == startIndex) + { + if((res = strcmp(allmsgs[startIndex].string, message)) == 0) + { + weFoundIt = 1; + midIndex = startIndex; + break; + } + else if(res < 0) + { + if((res = strcmp(allmsgs[endIndex].string, message)) == 0) + { + weFoundIt = 1; + midIndex = endIndex; + break; + } + } + /* we didn't find a match in the table */ + weFoundIt = 0; + break; + } + else + { + if((res = strcmp(allmsgs[midIndex].string, message)) == 0) + { + weFoundIt = 1; + break; /* we found it */ + } + else if(res < 0) + startIndex = midIndex; + else + endIndex = midIndex; + } + } + if(weFoundIt) + return GETMESSAGE(allmsgs[midIndex].setNum, allmsgs[midIndex].msgNum, (char *)message); + + return((char*)message); + +} + +#else + +#if ERROR_VERSION >= 20000101L + static char* msg_translate(const char* catalog, const char* message) + { + NOT_USED(catalog); + return((char*)message); + } +#else + static char* msg_translate(const char* message, int type) + { + NOT_USED(type); + return((char*)message); + } +#endif + +#endif /* BUILD_DTKSH */ + + /* Trap for LC_ALL, LC_CTYPE, LC_MESSAGES, LC_COLLATE and LANG */ + static void put_lang(Namval_t* np,const char *val,int flags,Namfun_t *fp) + { + Shell_t *shp = nv_shell(np); + int type; + char *name = nv_name(np); + if(name==(LCALLNOD)->nvname) + type = LC_ALL; + else if(name==(LCTYPENOD)->nvname) + type = LC_CTYPE; + else if(name==(LCMSGNOD)->nvname) + type = LC_MESSAGES; + else if(name==(LCCOLLNOD)->nvname) + type = LC_COLLATE; + else if(name==(LCNUMNOD)->nvname) + type = LC_NUMERIC; +#ifdef LC_LANG + else if(name==(LANGNOD)->nvname) + type = LC_LANG; +#else +#define LC_LANG LC_ALL + else if(name==(LANGNOD)->nvname && (!(name=nv_getval(LCALLNOD)) || !*name)) + type = LC_LANG; +#endif + else + type= -1; + if(!sh_isstate(SH_INIT) && (type>=0 || type==LC_ALL || type==LC_LANG)) + { + char* r; +#ifdef AST_LC_setenv + ast.locale.set |= AST_LC_setenv; +#endif + r = setlocale(type,val?val:""); +#ifdef AST_LC_setenv + ast.locale.set ^= AST_LC_setenv; +#endif + if(!r && val) + { + if(!sh_isstate(SH_INIT) || shp->login_sh==0) + errormsg(SH_DICT,0,e_badlocale,val); + return; + } + } + nv_putv(np, val, flags, fp); + if(CC_NATIVE!=CC_ASCII && (type==LC_ALL || type==LC_LANG || type==LC_CTYPE)) + { + if(sh_lexstates[ST_BEGIN]!=sh_lexrstates[ST_BEGIN]) + free((void*)sh_lexstates[ST_BEGIN]); + lctype++; + if(ast.locale.set&(1<ifsnp = 0; + if(!val) + { + fp = nv_stack(np, NIL(Namfun_t*)); + if(fp && !fp->nofree) + { + free((void*)fp); + fp = 0; + } + } + if(val != np->nvalue.cp) + nv_putv(np, val, flags, fp); + if(!val) + { + if(fp) + fp->next = np->nvfun; + np->nvfun = fp; + } +} + +/* + * This is the lookup function for IFS + * It keeps the sh.ifstable up to date + */ +static char* get_ifs(register Namval_t* np, Namfun_t *fp) +{ + register struct ifs *ip = (struct ifs*)fp; + register char *cp, *value; + register int c,n; + register Shell_t *shp = nv_shell(np); + value = nv_getv(np,fp); + if(np!=ip->ifsnp) + { + ip->ifsnp = np; + memset(shp->ifstable,0,(1<1) + { + cp += (n-1); + shp->ifstable[c] = S_MBYTE; + continue; + } +#endif /* SHOPT_MULTIBYTE */ + n = S_DELIM; + if(c== *cp) + cp++; + else if(c=='\n') + n = S_NL; + else if(isspace(c)) + n = S_SPACE; + shp->ifstable[c] = n; + } + } + else + { + shp->ifstable[' '] = shp->ifstable['\t'] = S_SPACE; + shp->ifstable['\n'] = S_NL; + } + } + return(value); +} + +/* + * these functions are used to get and set the SECONDS variable + */ +#ifdef timeofday +# define dtime(tp) ((double)((tp)->tv_sec)+1e-6*((double)((tp)->tv_usec))) +# define tms timeval +#else +# define dtime(tp) (((double)times(tp))/shgd->lim.clk_tck) +# define timeofday(a) +#endif + +static void put_seconds(register Namval_t* np,const char *val,int flags,Namfun_t *fp) +{ + double d; + struct tms tp; + if(!val) + { + nv_putv(np, val, flags, fp); + fp = nv_stack(np, NIL(Namfun_t*)); + if(fp && !fp->nofree) + free((void*)fp); + return; + } + if(!np->nvalue.dp) + { + nv_setsize(np,3); + nv_onattr(np,NV_DOUBLE); + np->nvalue.dp = new_of(double,0); + } + nv_putv(np, val, flags, fp); + d = *np->nvalue.dp; + timeofday(&tp); + *np->nvalue.dp = dtime(&tp)-d; +} + +static char* get_seconds(register Namval_t* np, Namfun_t *fp) +{ + Shell_t *shp = nv_shell(np); + register int places = nv_size(np); + struct tms tp; + double d, offset = (np->nvalue.dp?*np->nvalue.dp:0); + NOT_USED(fp); + timeofday(&tp); + d = dtime(&tp)- offset; + sfprintf(shp->strbuf,"%.*f",places,d); + return(sfstruse(shp->strbuf)); +} + +static Sfdouble_t nget_seconds(register Namval_t* np, Namfun_t *fp) +{ + struct tms tp; + double offset = (np->nvalue.dp?*np->nvalue.dp:0); + NOT_USED(fp); + timeofday(&tp); + return(dtime(&tp)- offset); +} + +/* + * These three functions are used to get and set the RANDOM variable + */ +static void put_rand(register Namval_t* np,const char *val,int flags,Namfun_t *fp) +{ + struct rand *rp = (struct rand*)fp; + register long n; + if(!val) + { + fp = nv_stack(np, NIL(Namfun_t*)); + if(fp && !fp->nofree) + free((void*)fp); + _nv_unset(np,NV_RDONLY); + return; + } + if(flags&NV_INTEGER) + n = *(double*)val; + else + n = sh_arith(rp->sh,val); + srand((int)(n&RANDMASK)); + rp->rand_last = -1; + if(!np->nvalue.lp) + np->nvalue.lp = &rp->rand_last; +} + +/* + * get random number in range of 0 - 2**15 + * never pick same number twice in a row + */ +static Sfdouble_t nget_rand(register Namval_t* np, Namfun_t *fp) +{ + register long cur, last= *np->nvalue.lp; + NOT_USED(fp); + do + cur = (rand()>>rand_shift)&RANDMASK; + while(cur==last); + *np->nvalue.lp = cur; + return((Sfdouble_t)cur); +} + +static char* get_rand(register Namval_t* np, Namfun_t *fp) +{ + register long n = nget_rand(np,fp); + return(fmtbase(n, 10, 0)); +} + +/* + * These three routines are for LINENO + */ +static Sfdouble_t nget_lineno(Namval_t* np, Namfun_t *fp) +{ + double d=1; + if(error_info.line >0) + d = error_info.line; + else if(error_info.context && error_info.context->line>0) + d = error_info.context->line; + NOT_USED(np); + NOT_USED(fp); + return(d); +} + +static void put_lineno(Namval_t* np,const char *val,int flags,Namfun_t *fp) +{ + register long n; + Shell_t *shp = nv_shell(np); + if(!val) + { + fp = nv_stack(np, NIL(Namfun_t*)); + if(fp && !fp->nofree) + free((void*)fp); + _nv_unset(np,NV_RDONLY); + return; + } + if(flags&NV_INTEGER) + n = *(double*)val; + else + n = sh_arith(shp,val); + shp->st.firstline += nget_lineno(np,fp)+1-n; +} + +static char* get_lineno(register Namval_t* np, Namfun_t *fp) +{ + register long n = nget_lineno(np,fp); + return(fmtbase(n, 10, 0)); +} + +static char* get_lastarg(Namval_t* np, Namfun_t *fp) +{ + Shell_t *shp = nv_shell(np); + char *cp; + int pid; + if(sh_isstate(SH_INIT) && (cp=shp->lastarg) && *cp=='*' && (pid=strtol(cp+1,&cp,10)) && *cp=='*') + nv_putval(np,cp+1,0); + return(shp->lastarg); +} + +static void put_lastarg(Namval_t* np,const char *val,int flags,Namfun_t *fp) +{ + Shell_t *shp = nv_shell(np); + if(flags&NV_INTEGER) + { + sfprintf(shp->strbuf,"%.*g",12,*((double*)val)); + val = sfstruse(shp->strbuf); + } + if(val) + val = strdup(val); + if(shp->lastarg && !nv_isattr(np,NV_NOFREE)) + free((void*)shp->lastarg); + else + nv_offattr(np,NV_NOFREE); + shp->lastarg = (char*)val; + nv_offattr(np,NV_EXPORT); + np->nvenv = 0; +} + +static int hasgetdisc(register Namfun_t *fp) +{ + while(fp && !fp->disc->getnum && !fp->disc->getval) + fp = fp->next; + return(fp!=0); +} + +/* + * store the most recent value for use in .sh.match + * treat .sh.match as a two dimensional array + */ +void sh_setmatch(Shell_t *shp,const char *v, int vsize, int nmatch, regoff_t match[],int index) +{ + struct match *mp = &ip->SH_MATCH_init; + Namval_t *np = nv_namptr(mp->node,0); + register int i,n,x; + unsigned int savesub = shp->subshell; + Namarr_t *ap = nv_arrayptr(SH_MATCHNOD); + shp->subshell = 0; +#ifndef SHOPT_2DMATCH + index = 0; +#else + if(index==0) +#endif /* SHOPT_2DMATCH */ + { + if(ap->hdr.next != &mp->hdr) + { + free((void*)ap); + ap = nv_arrayptr(np); + SH_MATCHNOD->nvfun = &ap->hdr; + } + if(ap) + { + ap->nelem &= ~ARRAY_SCAN; + i = array_elem(ap); + ap->nelem++; + while(--i>= 0) + { + nv_putsub(SH_MATCHNOD, (char*)0,i); + _nv_unset(SH_MATCHNOD,NV_RDONLY); + } + ap->nelem--; + } + if(!nv_hasdisc(SH_MATCHNOD,mp->hdr.disc)) + nv_disc(SH_MATCHNOD,&mp->hdr,NV_LAST); + if(nmatch) + nv_putsub(SH_MATCHNOD, NIL(char*), (nmatch-1)|ARRAY_FILL|ARRAY_SETSUB); + ap = nv_arrayptr(SH_MATCHNOD); + ap->nelem = mp->nmatch = nmatch; + mp->v = v; + mp->first = match[0]; + } +#ifdef SHOPT_2DMATCH + else + { + if(index==1) + { + np->nvalue.cp = Empty; + np->nvfun = SH_MATCHNOD->nvfun; + nv_onattr(np,NV_NOFREE|NV_ARRAY); + SH_MATCHNOD->nvfun = 0; + for(i=0; i < mp->nmatch; i++) + { + nv_putsub(SH_MATCHNOD, (char*)0, i); + nv_arraychild(SH_MATCHNOD, np,0); + } + if(ap = nv_arrayptr(SH_MATCHNOD)) + ap->nelem = mp->nmatch; + } + ap = nv_arrayptr(np); + nv_putsub(np, NIL(char*), index|ARRAY_FILL|ARRAY_SETSUB); + } +#endif /* SHOPT_2DMATCH */ + shp->subshell = savesub; + index *= 2*mp->nmatch; + if(mp->nmatch) + { + for(n=mp->first+(mp->v-v),vsize=0,i=0; i < 2*nmatch; i++) + { + if(match[i]>=0 && (match[i] - n) > vsize) + vsize = match[i] -n; + } + i = (index+2*mp->nmatch)*sizeof(match[0]); + if((i+vsize) >= mp->vsize) + { + if(mp->vsize) + mp->match = (int*)realloc(mp->match,i+vsize+1); + else + mp->match = (int*)malloc(i+vsize+1); + mp->vsize = i+vsize+1; + } + mp->val = ((char*)mp->match)+i; + memcpy(mp->match+index,match,nmatch*2*sizeof(match[0])); + for(x=0,i=0; i < 2*nmatch; i++) + { + if(match[i]>=0) + mp->match[index+i] -= n; + else + x=1; + + } + ap->nelem -= x; + while(i < 2*mp->nmatch) + mp->match[index+i++] = -1; + memcpy(mp->val,v+n,vsize); + mp->val[vsize] = 0; + mp->lastsub[0] = mp->lastsub[1] = -1; + } +} + +#define array_scan(np) ((nv_arrayptr(np)->nelem&ARRAY_SCAN)) + +static char* get_match(register Namval_t* np, Namfun_t *fp) +{ + struct match *mp = (struct match*)fp; + int sub,sub2=0,n,i =!mp->index; + char *val; + sub = nv_aindex(SH_MATCHNOD); + if(np!=SH_MATCHNOD) + sub2 = nv_aindex(np); + if(sub>=mp->nmatch) + return(0); + if(sub2>0) + sub += sub2*mp->nmatch; + if(sub==mp->lastsub[!i]) + return(mp->rval[!i]); + else if(sub==mp->lastsub[i]) + return(mp->rval[i]); + n = mp->match[2*sub+1]-mp->match[2*sub]; + if(n<=0) + return(mp->match[2*sub]<0?Empty:""); + val = mp->val+mp->match[2*sub]; + if(mp->val[mp->match[2*sub+1]]==0) + return(val); + mp->index = i; + if(mp->rval[i]) + { + free((void*)mp->rval[i]); + mp->rval[i] = 0; + } + mp->rval[i] = (char*)malloc(n+1); + mp->lastsub[i] = sub; + memcpy(mp->rval[i],val,n); + mp->rval[i][n] = 0; + return(mp->rval[i]); +} + +static const Namdisc_t SH_MATCH_disc = { sizeof(struct match), 0, get_match }; + +static char* get_version(register Namval_t* np, Namfun_t *fp) +{ + return(nv_getv(np,fp)); +} + +static Sfdouble_t nget_version(register Namval_t* np, Namfun_t *fp) +{ + register const char *cp = e_version + strlen(e_version)-10; + register int c; + Sflong_t t = 0; + NOT_USED(fp); + + while (c = *cp++) + if (c >= '0' && c <= '9') + { + t *= 10; + t += c - '0'; + } + return((Sfdouble_t)t); +} + +static const Namdisc_t SH_VERSION_disc = { 0, 0, get_version, nget_version }; + + +static const Namdisc_t IFS_disc = { sizeof(struct ifs), put_ifs, get_ifs }; +const Namdisc_t RESTRICTED_disc = { sizeof(Namfun_t), put_restricted }; +static const Namdisc_t CDPATH_disc = { sizeof(Namfun_t), put_cdpath }; +static const Namdisc_t EDITOR_disc = { sizeof(Namfun_t), put_ed }; +static const Namdisc_t HISTFILE_disc = { sizeof(Namfun_t), put_history }; +static const Namdisc_t OPTINDEX_disc = { sizeof(Namfun_t), put_optindex, 0, nget_optindex, 0, 0, clone_optindex }; +static const Namdisc_t SECONDS_disc = { sizeof(struct seconds), put_seconds, get_seconds, nget_seconds }; +static const Namdisc_t RAND_disc = { sizeof(struct rand), put_rand, get_rand, nget_rand }; +static const Namdisc_t LINENO_disc = { sizeof(Namfun_t), put_lineno, get_lineno, nget_lineno }; +static const Namdisc_t L_ARG_disc = { sizeof(Namfun_t), put_lastarg, get_lastarg }; + + +#define MAX_MATH_ARGS 3 + +static char *name_math(Namval_t *np, Namfun_t *fp) +{ + Shell_t *shp = sh_getinterp(); + sfprintf(shp->strbuf,".sh.math.%s",np->nvname); + return(sfstruse(shp->strbuf)); +} + +static const Namdisc_t math_child_disc = +{ + 0,0,0,0,0,0,0, + name_math +}; + +static Namfun_t math_child_fun = +{ + &math_child_disc, 1, 0, sizeof(Namfun_t) +}; + +static void math_init(Shell_t *shp) +{ + Namval_t *np; + char *name; + int i; + shp->mathnodes = (char*)calloc(1,MAX_MATH_ARGS*(NV_MINSZ+5)); + name = shp->mathnodes+MAX_MATH_ARGS*NV_MINSZ; + for(i=0; i < MAX_MATH_ARGS; i++) + { + np = nv_namptr(shp->mathnodes,i); + np->nvfun = &math_child_fun; + memcpy(name,"arg",3); + name[3] = '1'+i; + np->nvname = name; + name+=5; + nv_onattr(np,NV_MINIMAL|NV_NOFREE|NV_LDOUBLE|NV_RDONLY); + } +} + +static Namval_t *create_math(Namval_t *np,const char *name,int flag,Namfun_t *fp) +{ + Shell_t *shp = nv_shell(np); + if(!name) + return(SH_MATHNOD); + if(name[0]!='a' || name[1]!='r' || name[2]!='g' || name[4] || !isdigit(name[3]) || (name[3]=='0' || (name[3]-'0')>MAX_MATH_ARGS)) + return(0); + fp->last = (char*)&name[4]; + return(nv_namptr(shp->mathnodes,name[3]-'1')); +} + +static char* get_math(register Namval_t* np, Namfun_t *fp) +{ + Shell_t *shp = nv_shell(np); + Namval_t *mp,fake; + char *val; + int first=0; + fake.nvname = ".sh.math."; + mp = (Namval_t*)dtprev(shp->fun_tree,&fake); + while(mp=(Namval_t*)dtnext(shp->fun_tree,mp)) + { + if(memcmp(mp->nvname,".sh.math.",9)) + break; + if(first++) + sfputc(shp->strbuf,' '); + sfputr(shp->strbuf,mp->nvname+9,-1); + } + val = sfstruse(shp->strbuf); + return(val); + +} + +static char *setdisc_any(Namval_t *np, const char *event, Namval_t *action, Namfun_t *fp) +{ + Shell_t *shp=nv_shell(np); + Namval_t *mp,fake; + char *name; + int getname=0, off=staktell(); + fake.nvname = nv_name(np); + if(!event) + { + if(!action) + { + mp = (Namval_t*)dtprev(shp->fun_tree,&fake); + return((char*)dtnext(shp->fun_tree,mp)); + } + getname = 1; + } + stakputs(fake.nvname); + stakputc('.'); + stakputs(event); + stakputc(0); + name = stakptr(off); + mp = nv_search(name, shp->fun_tree, action?NV_ADD:0); + stakseek(off); + if(getname) + return(mp?(char*)dtnext(shp->fun_tree,mp):0); + if(action==np) + action = mp; + return(action?(char*)action:""); +} + +static const Namdisc_t SH_MATH_disc = { 0, 0, get_math, 0, setdisc_any, create_math, }; + +#if SHOPT_NAMESPACE + static char* get_nspace(Namval_t* np, Namfun_t *fp) + { + if(sh.namespace) + return(nv_name(sh.namespace)); + return((char*)np->nvalue.cp); + } + static const Namdisc_t NSPACE_disc = { 0, 0, get_nspace }; + static Namfun_t NSPACE_init = { &NSPACE_disc, 1}; +#endif /* SHOPT_NAMESPACE */ + +#ifdef _hdr_locale + static const Namdisc_t LC_disc = { sizeof(Namfun_t), put_lang }; +#endif /* _hdr_locale */ + +/* + * This function will get called whenever a configuration parameter changes + */ +static int newconf(const char *name, const char *path, const char *value) +{ + Shell_t *shp = sh_getinterp(); + register char *arg; + if(!name) + setenviron(value); + else if(strcmp(name,"UNIVERSE")==0 && strcmp(astconf(name,0,0),value)) + { + shp->universe = 0; + /* set directory in new universe */ + if(*(arg = path_pwd(shp,0))=='/') + chdir(arg); + /* clear out old tracked alias */ + stakseek(0); + stakputs(nv_getval(PATHNOD)); + stakputc(0); + nv_putval(PATHNOD,stakseek(0),NV_RDONLY); + } + return(1); +} + +#if (CC_NATIVE != CC_ASCII) + static void a2e(char *d, const char *s) + { + register const unsigned char *t; + register int i; + t = CCMAP(CC_ASCII, CC_NATIVE); + for(i=0; i<(1<current_pid = shgd->pid = getpid(); + shgd->ppid = getppid(); + shgd->userid=getuid(); + shgd->euserid=geteuid(); + shgd->groupid=getgid(); + shgd->egroupid=getegid(); + shgd->lim.clk_tck = getconf("CLK_TCK"); + shgd->lim.arg_max = getconf("ARG_MAX"); + shgd->lim.child_max = getconf("CHILD_MAX"); + shgd->lim.ngroups_max = getconf("NGROUPS_MAX"); + shgd->lim.posix_version = getconf("VERSION"); + shgd->lim.posix_jobcontrol = getconf("JOB_CONTROL"); + if(shgd->lim.arg_max <=0) + shgd->lim.arg_max = ARG_MAX; + if(shgd->lim.child_max <=0) + shgd->lim.child_max = CHILD_MAX; + if(shgd->lim.clk_tck <=0) + shgd->lim.clk_tck = CLK_TCK; + shgd->ed_context = (void*)ed_open(shp); + error_info.exit = sh_exit; + error_info.id = path_basename(argv[0]); + } + else + shp = newof(0,Shell_t,1,0); + umask(shp->mask=umask(0)); + shp->gd = shgd; + shp->mac_context = sh_macopen(shp); + shp->arg_context = sh_argopen(shp); + shp->lex_context = (void*)sh_lexopen(0,shp,1); + shp->strbuf = sfstropen(); + shp->stk = stkstd; + sfsetbuf(shp->strbuf,(char*)0,64); + sh_onstate(SH_INIT); +#if ERROR_VERSION >= 20000102L + error_info.catalog = e_dict; +#endif +#if SHOPT_REGRESS + { + Opt_t* nopt; + Opt_t* oopt; + char* a; + char** av = argv; + char* regress[3]; + + sh_regress_init(shp); + regress[0] = "__regress__"; + regress[2] = 0; + /* NOTE: only shp is used by __regress__ at this point */ + shp->bltindata.shp = shp; + while ((a = *++av) && a[0] == '-' && (a[1] == 'I' || a[1] == '-' && a[2] == 'r')) + { + if (a[1] == 'I') + { + if (a[2]) + regress[1] = a + 2; + else if (!(regress[1] = *++av)) + break; + } + else if (strncmp(a+2, "regress", 7)) + break; + else if (a[9] == '=') + regress[1] = a + 10; + else if (!(regress[1] = *++av)) + break; + nopt = optctx(0, 0); + oopt = optctx(nopt, 0); + b___regress__(2, regress, &shp->bltindata); + optctx(oopt, nopt); + } + } +#endif + shp->cpipe[0] = -1; + shp->coutpipe = -1; + for(n=0;n < 10; n++) + { + /* don't use lower bits when rand() generates large numbers */ + if(rand() > RANDMASK) + { + rand_shift = 3; + break; + } + } + sh_ioinit(shp); + /* initialize signal handling */ + sh_siginit(shp); + stakinstall(NIL(Stak_t*),nospace); + /* set up memory for name-value pairs */ + shp->init_context = nv_init(shp); + /* read the environment */ + if(argc>0) + { + type = sh_type(*argv); + if(type&SH_TYPE_LOGIN) + shp->login_sh = 2; + } + env_init(shp); + if(!ENVNOD->nvalue.cp) + { + sfprintf(shp->strbuf,"%s/.kshrc",nv_getval(HOME)); + nv_putval(ENVNOD,sfstruse(shp->strbuf),NV_RDONLY); + } + *SHLVL->nvalue.ip +=1; + nv_offattr(SHLVL,NV_IMPORT); +#if SHOPT_SPAWN + { + /* + * try to find the pathname for this interpreter + * try using environment variable _ or argv[0] + */ + char *cp=nv_getval(L_ARGNOD); + char buff[PATH_MAX+1]; + shp->gd->shpath = 0; +#if _AST_VERSION >= 20090202L + if((n = pathprog(NiL, buff, sizeof(buff))) > 0 && n <= sizeof(buff)) + shp->gd->shpath = strdup(buff); +#else + sfprintf(shp->strbuf,"/proc/%d/exe",getpid()); + if((n=readlink(sfstruse(shp->strbuf),buff,sizeof(buff)-1))>0) + { + buff[n] = 0; + shp->gd->shpath = strdup(buff); + } +#endif + else if((cp && (sh_type(cp)&SH_TYPE_SH)) || (argc>0 && strchr(cp= *argv,'/'))) + { + if(*cp=='/') + shp->gd->shpath = strdup(cp); + else if(cp = nv_getval(PWDNOD)) + { + int offset = staktell(); + stakputs(cp); + stakputc('/'); + stakputs(argv[0]); + pathcanon(stakptr(offset),PATH_DOTDOT); + shp->gd->shpath = strdup(stakptr(offset)); + stakseek(offset); + } + } + } +#endif + nv_putval(IFSNOD,(char*)e_sptbnl,NV_RDONLY); + astconfdisc(newconf); +#if SHOPT_TIMEOUT + shp->st.tmout = SHOPT_TIMEOUT; +#endif /* SHOPT_TIMEOUT */ + /* initialize jobs table */ + job_clear(); + sh_onoption(SH_MULTILINE); + if(argc>0) + { + /* check for restricted shell */ + if(type&SH_TYPE_RESTRICTED) + sh_onoption(SH_RESTRICTED); +#if SHOPT_PFSH + /* check for profile shell */ + else if(type&SH_TYPE_PROFILE) + sh_onoption(SH_PFSH); +#endif +#if SHOPT_BASH + /* check for invocation as bash */ + if(type&SH_TYPE_BASH) + { + shp>userinit = userinit = bash_init; + sh_onoption(SH_BASH); + sh_onstate(SH_PREINIT); + (*userinit)(shp, 0); + sh_offstate(SH_PREINIT); + } +#endif + /* look for options */ + /* shp->st.dolc is $# */ + if((shp->st.dolc = sh_argopts(-argc,argv,shp)) < 0) + { + shp->exitval = 2; + sh_done(shp,0); + } + opt_info.disc = 0; + shp->st.dolv=argv+(argc-1)-shp->st.dolc; + shp->st.dolv[0] = argv[0]; + if(shp->st.dolc < 1) + sh_onoption(SH_SFLAG); + if(!sh_isoption(SH_SFLAG)) + { + shp->st.dolc--; + shp->st.dolv++; +#if _WINIX + { + char* name; + name = shp->st.dolv[0]; + if(name[1]==':' && (name[2]=='/' || name[2]=='\\')) + { +#if _lib_pathposix + char* p; + + if((n = pathposix(name, NIL(char*), 0)) > 0 && (p = (char*)malloc(++n))) + { + pathposix(name, p, n); + name = p; + } + else +#endif + { + name[1] = name[0]; + name[0] = name[2] = '/'; + } + } + } +#endif /* _WINIX */ + } + if(beenhere==1) + { + struct lconv* lc; + shp->decomma = (lc=localeconv()) && lc->decimal_point && *lc->decimal_point==','; + beenhere = 2; + } + } +#if SHOPT_PFSH + if (sh_isoption(SH_PFSH)) + { + struct passwd *pw = getpwuid(shp->gd->userid); + if(pw) + shp->gd->user = strdup(pw->pw_name); + + } +#endif + /* set[ug]id scripts require the -p flag */ + if(shp->gd->userid!=shp->gd->euserid || shp->gd->groupid!=shp->gd->egroupid) + { +#ifdef SHOPT_P_SUID + /* require sh -p to run setuid and/or setgid */ + if(!sh_isoption(SH_PRIVILEGED) && shp->gd->userid >= SHOPT_P_SUID) + { + setuid(shp->gd->euserid=shp->gd->userid); + setgid(shp->gd->egroupid=shp->gd->groupid); + } + else +#endif /* SHOPT_P_SUID */ + sh_onoption(SH_PRIVILEGED); +#ifdef SHELLMAGIC + /* careful of #! setuid scripts with name beginning with - */ + if(shp->login_sh && argv[1] && strcmp(argv[0],argv[1])==0) + errormsg(SH_DICT,ERROR_exit(1),e_prohibited); +#endif /*SHELLMAGIC*/ + } + else + sh_offoption(SH_PRIVILEGED); + /* shname for $0 in profiles and . scripts */ + if(sh_isdevfd(argv[1])) + shp->shname = strdup(argv[0]); + else + shp->shname = strdup(shp->st.dolv[0]); + /* + * return here for shell script execution + * but not for parenthesis subshells + */ + error_info.id = strdup(shp->st.dolv[0]); /* error_info.id is $0 */ + shp->jmpbuffer = (void*)&shp->checkbase; + sh_pushcontext(shp,&shp->checkbase,SH_JMPSCRIPT); + shp->st.self = &shp->global; + shp->topscope = (Shscope_t*)shp->st.self; + sh_offstate(SH_INIT); + login_files[0] = (char*)e_profile; + login_files[1] = ".profile"; + shp->gd->login_files = login_files; + shp->bltindata.version = SH_VERSION; + shp->bltindata.shp = shp; + shp->bltindata.shrun = sh_run; + shp->bltindata.shtrap = sh_trap; + shp->bltindata.shexit = sh_exit; + shp->bltindata.shbltin = sh_addbuiltin; +#if _AST_VERSION >= 20080617L + shp->bltindata.shgetenv = sh_getenv; + shp->bltindata.shsetenv = sh_setenviron; + astintercept(&shp->bltindata,1); +#endif +#if 0 +#define NV_MKINTTYPE(x,y,z) nv_mkinttype(#x,sizeof(x),(x)-1<0,(y),(Namdisc_t*)z); + NV_MKINTTYPE(pid_t,"process id",0); + NV_MKINTTYPE(gid_t,"group id",0); + NV_MKINTTYPE(uid_t,"user id",0); + NV_MKINTTYPE(size_t,(const char*)0,0); + NV_MKINTTYPE(ssize_t,(const char*)0,0); + NV_MKINTTYPE(off_t,"offset in bytes",0); + NV_MKINTTYPE(ino_t,"\ai-\anode number",0); + NV_MKINTTYPE(mode_t,(const char*)0,&modedisc); + NV_MKINTTYPE(dev_t,"device id",0); + NV_MKINTTYPE(nlink_t,"hard link count",0); + NV_MKINTTYPE(blkcnt_t,"block count",0); + NV_MKINTTYPE(time_t,"seconds since the epoch",0); + nv_mkstat(); +#endif + if(shp->userinit=userinit) + (*userinit)(shp, 0); + +#ifdef BUILD_DTKSH + int * lockedFds; + + lockedFds = LockKshFileDescriptors(); + (void) XtSetLanguageProc((XtAppContext)NULL, (XtLanguageProc)NULL, + (XtPointer)NULL); + setlocale(LC_ALL, ""); + DtNlInitialize(); + _DtEnvControl(DT_ENV_SET); + localeFun.disc = &localeDisc; + nv_stack(LANGNOD, &localeFun); + UnlockKshFileDescriptors(lockedFds); + + /* + * Save the current setting of NLSPATH. The user/script may want to + * set its own NLSPATH to access its message catalog, so we need to + * remember where to find our own catalog(s). This saved path is used + * in ksh93/src/cmd/ksh93/sh/init.c: _DtGetMessage(). We don't mess + * with the user/script's setting of LANG as we want to track changes + * in LANG. + */ + savedNlsPath = strdup(getenv("NLSPATH")); + + /* + * Sync the libc environment (set up by DtEnvControl) with our internal + * hash table environment. + */ + SyncEnv("NLSPATH"); + SyncEnv("LANG"); +#endif + + return(shp); +} + +Shell_t *sh_getinterp(void) +{ + return(&sh); +} + +/* + * reinitialize before executing a script + */ +int sh_reinit(char *argv[]) +{ + Shell_t *shp = sh_getinterp(); + Shopt_t opt; + Namval_t *np,*npnext; + Dt_t *dp; + struct adata + { + Shell_t *sh; + void *extra[2]; + } data; + for(np=dtfirst(shp->fun_tree);np;np=npnext) + { + if((dp=shp->fun_tree)->walk) + dp = dp->walk; + npnext = (Namval_t*)dtnext(shp->fun_tree,np); + if(np>= shgd->bltin_cmds && np < &shgd->bltin_cmds[nbltins]) + continue; + if(is_abuiltin(np) && nv_isattr(np,NV_EXPORT)) + continue; + if(*np->nvname=='/') + continue; + nv_delete(np,dp,NV_NOFREE); + } + dtclose(shp->alias_tree); + shp->alias_tree = dtopen(&_Nvdisc,Dtoset); + shp->last_root = shp->var_tree; + shp->inuse_bits = 0; + if(shp->userinit) + (*shp->userinit)(shp, 1); + if(shp->heredocs) + { + sfclose(shp->heredocs); + shp->heredocs = 0; + } + /* remove locals */ + sh_onstate(SH_INIT); + memset(&data,0,sizeof(data)); + data.sh = shp; + nv_scan(shp->var_tree,sh_envnolocal,(void*)&data,NV_EXPORT,0); + nv_scan(shp->var_tree,sh_envnolocal,(void*)&data,NV_ARRAY,NV_ARRAY); + sh_offstate(SH_INIT); + memset(shp->st.trapcom,0,(shp->st.trapmax+1)*sizeof(char*)); + memset((void*)&opt,0,sizeof(opt)); +#if SHOPT_NAMESPACE + if(shp->namespace) + { + dp=nv_dict(shp->namespace); + if(dp==shp->var_tree) + shp->var_tree = dtview(dp,0); + _nv_unset(shp->namespace,NV_RDONLY); + shp->namespace = 0; + } +#endif /* SHOPT_NAMESPACE */ + if(sh_isoption(SH_TRACKALL)) + on_option(&opt,SH_TRACKALL); + if(sh_isoption(SH_EMACS)) + on_option(&opt,SH_EMACS); + if(sh_isoption(SH_GMACS)) + on_option(&opt,SH_GMACS); + if(sh_isoption(SH_VI)) + on_option(&opt,SH_VI); + if(sh_isoption(SH_VIRAW)) + on_option(&opt,SH_VIRAW); + shp->options = opt; + /* set up new args */ + if(argv) + shp->arglist = sh_argcreate(argv); + if(shp->arglist) + sh_argreset(shp,shp->arglist,NIL(struct dolnod*)); + shp->envlist=0; + shp->curenv = 0; + shp->shname = error_info.id = strdup(shp->st.dolv[0]); + sh_offstate(SH_FORKED); + shp->fn_depth = shp->dot_depth = 0; + sh_sigreset(0); + if(!(SHLVL->nvalue.ip)) + { + shlvl = 0; + SHLVL->nvalue.ip = &shlvl; + nv_onattr(SHLVL,NV_INTEGER|NV_EXPORT|NV_NOFREE); + } + *SHLVL->nvalue.ip +=1; + nv_offattr(SHLVL,NV_IMPORT); + shp->st.filename = strdup(shp->lastarg); + nv_delete((Namval_t*)0, (Dt_t*)0, 0); + job.exitval = 0; + shp->inpipe = shp->outpipe = 0; + job_clear(); + job.in_critical = 0; + return(1); +} + +/* + * set when creating a local variable of this name + */ +Namfun_t *nv_cover(register Namval_t *np) +{ + if(np==IFSNOD || np==PATHNOD || np==SHELLNOD || np==FPATHNOD || np==CDPNOD || np==SECONDS || np==ENVNOD || np==LINENO) + return(np->nvfun); +#ifdef _hdr_locale + if(np==LCALLNOD || np==LCTYPENOD || np==LCMSGNOD || np==LCCOLLNOD || np==LCNUMNOD || np==LANGNOD) + return(np->nvfun); +#endif + return(0); +} + +static const char *shdiscnames[] = { "tilde", 0}; + +#ifdef SHOPT_STATS +struct Stats +{ + Namfun_t hdr; + Shell_t *sh; + char *nodes; + int numnodes; + int current; +}; + +static Namval_t *next_stat(register Namval_t* np, Dt_t *root,Namfun_t *fp) +{ + struct Stats *sp = (struct Stats*)fp; + if(!root) + sp->current = 0; + else if(++sp->current>=sp->numnodes) + return(0); + return(nv_namptr(sp->nodes,sp->current)); +} + +static Namval_t *create_stat(Namval_t *np,const char *name,int flag,Namfun_t *fp) +{ + struct Stats *sp = (struct Stats*)fp; + register const char *cp=name; + register int i=0,n; + Namval_t *nq=0; + Shell_t *shp = sp->sh; + if(!name) + return(SH_STATS); + while((i=*cp++) && i != '=' && i != '+' && i!='['); + n = (cp-1) -name; + for(i=0; i < sp->numnodes; i++) + { + nq = nv_namptr(sp->nodes,i); + if((n==0||memcmp(name,nq->nvname,n)==0) && nq->nvname[n]==0) + goto found; + } + nq = 0; +found: + if(nq) + { + fp->last = (char*)&name[n]; + shp->last_table = SH_STATS; + } + else + errormsg(SH_DICT,ERROR_exit(1),e_notelem,n,name,nv_name(np)); + return(nq); +} + +static const Namdisc_t stat_disc = +{ + 0, 0, 0, 0, 0, + create_stat, + 0, 0, + next_stat +}; + +static char *name_stat(Namval_t *np, Namfun_t *fp) +{ + Shell_t *shp = sh_getinterp(); + sfprintf(shp->strbuf,".sh.stats.%s",np->nvname); + return(sfstruse(shp->strbuf)); +} + +static const Namdisc_t stat_child_disc = +{ + 0,0,0,0,0,0,0, + name_stat +}; + +static Namfun_t stat_child_fun = +{ + &stat_child_disc, 1, 0, sizeof(Namfun_t) +}; + +static void stat_init(Shell_t *shp) +{ + int i,nstat = STAT_SUBSHELL+1; + struct Stats *sp = newof(0,struct Stats,1,nstat*NV_MINSZ); + Namval_t *np; + sp->numnodes = nstat; + sp->nodes = (char*)(sp+1); + shgd->stats = (int*)calloc(sizeof(int),nstat); + sp->sh = shp; + for(i=0; i < nstat; i++) + { + np = nv_namptr(sp->nodes,i); + np->nvfun = &stat_child_fun; + np->nvname = (char*)shtab_stats[i].sh_name; + nv_onattr(np,NV_RDONLY|NV_MINIMAL|NV_NOFREE|NV_INTEGER); + nv_setsize(np,10); + np->nvalue.ip = &shgd->stats[i]; + } + sp->hdr.dsize = sizeof(struct Stats) + nstat*(sizeof(int)+NV_MINSZ); + sp->hdr.disc = &stat_disc; + nv_stack(SH_STATS,&sp->hdr); + sp->hdr.nofree = 1; + nv_setvtree(SH_STATS); +} +#else +# define stat_init(x) +#endif /* SHOPT_STATS */ + +/* + * Initialize the shell name and alias table + */ +static Init_t *nv_init(Shell_t *shp) +{ + double d=0; + ip = newof(0,Init_t,1,0); + if(!ip) + return(0); + shp->nvfun.last = (char*)shp; + shp->nvfun.nofree = 1; + ip->sh = shp; + shp->var_base = shp->var_tree = inittree(shp,shtab_variables); + SHLVL->nvalue.ip = &shlvl; + ip->IFS_init.hdr.disc = &IFS_disc; + ip->PATH_init.disc = &RESTRICTED_disc; + ip->PATH_init.nofree = 1; + ip->FPATH_init.disc = &RESTRICTED_disc; + ip->FPATH_init.nofree = 1; + ip->CDPATH_init.disc = &CDPATH_disc; + ip->CDPATH_init.nofree = 1; + ip->SHELL_init.disc = &RESTRICTED_disc; + ip->SHELL_init.nofree = 1; + ip->ENV_init.disc = &RESTRICTED_disc; + ip->ENV_init.nofree = 1; + ip->VISUAL_init.disc = &EDITOR_disc; + ip->VISUAL_init.nofree = 1; + ip->EDITOR_init.disc = &EDITOR_disc; + ip->EDITOR_init.nofree = 1; + ip->HISTFILE_init.disc = &HISTFILE_disc; + ip->HISTFILE_init.nofree = 1; + ip->HISTSIZE_init.disc = &HISTFILE_disc; + ip->HISTSIZE_init.nofree = 1; + ip->OPTINDEX_init.disc = &OPTINDEX_disc; + ip->OPTINDEX_init.nofree = 1; + ip->SECONDS_init.hdr.disc = &SECONDS_disc; + ip->SECONDS_init.hdr.nofree = 1; + ip->RAND_init.hdr.disc = &RAND_disc; + ip->RAND_init.hdr.nofree = 1; + ip->RAND_init.sh = shp; + ip->SH_MATCH_init.hdr.disc = &SH_MATCH_disc; + ip->SH_MATCH_init.hdr.nofree = 1; + ip->SH_MATH_init.disc = &SH_MATH_disc; + ip->SH_MATH_init.nofree = 1; + ip->SH_VERSION_init.disc = &SH_VERSION_disc; + ip->SH_VERSION_init.nofree = 1; + ip->LINENO_init.disc = &LINENO_disc; + ip->LINENO_init.nofree = 1; + ip->L_ARG_init.disc = &L_ARG_disc; + ip->L_ARG_init.nofree = 1; +#ifdef _hdr_locale + ip->LC_TYPE_init.disc = &LC_disc; + ip->LC_TYPE_init.nofree = 1; + ip->LC_NUM_init.disc = &LC_disc; + ip->LC_NUM_init.nofree = 1; + ip->LC_COLL_init.disc = &LC_disc; + ip->LC_COLL_init.nofree = 1; + ip->LC_MSG_init.disc = &LC_disc; + ip->LC_MSG_init.nofree = 1; + ip->LC_ALL_init.disc = &LC_disc; + ip->LC_ALL_init.nofree = 1; + ip->LANG_init.disc = &LC_disc; + ip->LANG_init.nofree = 1; +#endif /* _hdr_locale */ + nv_stack(IFSNOD, &ip->IFS_init.hdr); + ip->IFS_init.hdr.nofree = 1; + nv_stack(PATHNOD, &ip->PATH_init); + nv_stack(FPATHNOD, &ip->FPATH_init); + nv_stack(CDPNOD, &ip->CDPATH_init); + nv_stack(SHELLNOD, &ip->SHELL_init); + nv_stack(ENVNOD, &ip->ENV_init); + nv_stack(VISINOD, &ip->VISUAL_init); + nv_stack(EDITNOD, &ip->EDITOR_init); + nv_stack(HISTFILE, &ip->HISTFILE_init); + nv_stack(HISTSIZE, &ip->HISTSIZE_init); + nv_stack(OPTINDNOD, &ip->OPTINDEX_init); + nv_stack(SECONDS, &ip->SECONDS_init.hdr); + nv_stack(L_ARGNOD, &ip->L_ARG_init); + nv_putval(SECONDS, (char*)&d, NV_DOUBLE); + nv_stack(RANDNOD, &ip->RAND_init.hdr); + d = (shp->gd->pid&RANDMASK); + nv_putval(RANDNOD, (char*)&d, NV_DOUBLE); + nv_stack(LINENO, &ip->LINENO_init); + SH_MATCHNOD->nvfun = &ip->SH_MATCH_init.hdr; + nv_putsub(SH_MATCHNOD,(char*)0,10); + nv_stack(SH_MATHNOD, &ip->SH_MATH_init); + nv_stack(SH_VERSIONNOD, &ip->SH_VERSION_init); +#ifdef _hdr_locale + nv_stack(LCTYPENOD, &ip->LC_TYPE_init); + nv_stack(LCALLNOD, &ip->LC_ALL_init); + nv_stack(LCMSGNOD, &ip->LC_MSG_init); + nv_stack(LCCOLLNOD, &ip->LC_COLL_init); + nv_stack(LCNUMNOD, &ip->LC_NUM_init); + nv_stack(LANGNOD, &ip->LANG_init); +#endif /* _hdr_locale */ + (PPIDNOD)->nvalue.lp = (&shp->gd->ppid); + (SH_PIDNOD)->nvalue.lp = (&shp->gd->current_pid); + (TMOUTNOD)->nvalue.lp = (&shp->st.tmout); + (MCHKNOD)->nvalue.lp = (&sh_mailchk); + (OPTINDNOD)->nvalue.lp = (&shp->st.optindex); + /* set up the seconds clock */ + shp->alias_tree = dtopen(&_Nvdisc,Dtoset); + shp->track_tree = dtopen(&_Nvdisc,Dtset); + shp->bltin_tree = inittree(shp,(const struct shtable2*)shtab_builtins); + shp->fun_tree = dtopen(&_Nvdisc,Dtoset); + dtview(shp->fun_tree,shp->bltin_tree); + nv_mount(DOTSHNOD, "type", shp->typedict=dtopen(&_Nvdisc,Dtoset)); + nv_adddisc(DOTSHNOD, shdiscnames, (Namval_t**)0); + DOTSHNOD->nvalue.cp = Empty; + nv_onattr(DOTSHNOD,NV_RDONLY); + SH_LINENO->nvalue.ip = &shp->st.lineno; + VERSIONNOD->nvalue.nrp = newof(0,struct Namref,1,0); + VERSIONNOD->nvalue.nrp->np = SH_VERSIONNOD; + VERSIONNOD->nvalue.nrp->root = nv_dict(DOTSHNOD); + VERSIONNOD->nvalue.nrp->table = DOTSHNOD; + nv_onattr(VERSIONNOD,NV_REF); + math_init(shp); + if(!shgd->stats) + stat_init(shp); + return(ip); +} + +/* + * initialize name-value pairs + */ + +static Dt_t *inittree(Shell_t *shp,const struct shtable2 *name_vals) +{ + register Namval_t *np; + register const struct shtable2 *tp; + register unsigned n = 0; + register Dt_t *treep; + Dt_t *base_treep, *dict; + for(tp=name_vals;*tp->sh_name;tp++) + n++; + np = (Namval_t*)calloc(n,sizeof(Namval_t)); + if(!shgd->bltin_nodes) + { + shgd->bltin_nodes = np; + shgd->bltin_nnodes = n; + } + else if(name_vals==(const struct shtable2*)shtab_builtins) + { + shgd->bltin_cmds = np; + nbltins = n; + } + base_treep = treep = dtopen(&_Nvdisc,Dtoset); + treep->user = (void*)shp; + for(tp=name_vals;*tp->sh_name;tp++,np++) + { + if((np->nvname = strrchr(tp->sh_name,'.')) && np->nvname!=((char*)tp->sh_name)) + np->nvname++; + else + { + np->nvname = (char*)tp->sh_name; + treep = base_treep; + } + np->nvenv = 0; + if(name_vals==(const struct shtable2*)shtab_builtins) + np->nvalue.bfp = (Nambfp_f)((struct shtable3*)tp)->sh_value; + else + { + if(name_vals == shtab_variables) + np->nvfun = &shp->nvfun; + np->nvalue.cp = (char*)tp->sh_value; + } + nv_setattr(np,tp->sh_number); + if(nv_isattr(np,NV_TABLE)) + nv_mount(np,(const char*)0,dict=dtopen(&_Nvdisc,Dtoset)); + if(nv_isattr(np,NV_INTEGER)) + nv_setsize(np,10); + else + nv_setsize(np,0); + dtinsert(treep,np); + if(nv_istable(np)) + treep = dict; + } + return(treep); +} + +/* + * read in the process environment and set up name-value pairs + * skip over items that are not name-value pairs + */ + +static void env_init(Shell_t *shp) +{ + register char *cp; + register Namval_t *np,*mp; + register char **ep=environ; + char *dp,*next=0; + int nenv=0,k=0,size=0; + Namval_t *np0; +#ifdef _ENV_H + shp->env = env_open(environ,3); + env_delete(shp->env,"_"); +#endif + if(!ep) + goto skip; + while(*ep++) + nenv++; + np = newof(0,Namval_t,nenv,0); + for(np0=np,ep=environ;cp= *ep; ep++) + { + dp = strchr(cp,'='); + if(!dp) + continue; + *dp++ = 0; + if(mp = dtmatch(shp->var_base,cp)) + { + mp->nvenv = (char*)cp; + dp[-1] = '='; + } + else if(*cp=='A' && cp[1]=='_' && cp[2]=='_' && cp[3]=='z' && cp[4]==0) + { + dp[-1] = '='; + next = cp+4; + continue; + } + else + { + k++; + mp = np++; + mp->nvname = cp; + size += strlen(cp); + } + nv_onattr(mp,NV_IMPORT); + if(mp->nvfun || nv_isattr(mp,NV_INTEGER)) + nv_putval(mp,dp,0); + else + { + mp->nvalue.cp = dp; + nv_onattr(mp,NV_NOFREE); + } + nv_onattr(mp,NV_EXPORT|NV_IMPORT); + } + np = (Namval_t*)realloc((void*)np0,k*sizeof(Namval_t)); + dp = (char*)malloc(size+k); + while(k-->0) + { + size = strlen(np->nvname); + memcpy(dp,np->nvname,size+1); + np->nvname[size] = '='; + np->nvenv = np->nvname; + np->nvname = dp; + dp += size+1; + dtinsert(shp->var_base,np++); + } + while(cp=next) + { + if(next = strchr(++cp,'=')) + *next = 0; + np = nv_search(cp+2,shp->var_tree,NV_ADD); + if(np!=SHLVL && nv_isattr(np,NV_IMPORT|NV_EXPORT)) + { + int flag = *(unsigned char*)cp-' '; + int size = *(unsigned char*)(cp+1)-' '; + if((flag&NV_INTEGER) && size==0) + { + /* check for floating*/ + char *val = nv_getval(np); + strtol(val,&dp,10); + if(*dp=='.' || *dp=='e' || *dp=='E') + { + char *lp; + flag |= NV_DOUBLE; + if(*dp=='.') + { + strtol(dp+1,&lp,10); + if(*lp) + dp = lp; + } + if(*dp && *dp!='.') + { + flag |= NV_EXPNOTE; + size = dp-val; + } + else + size = strlen(dp); + size--; + } + } + nv_newattr(np,flag|NV_IMPORT|NV_EXPORT,size); + if((flag&(NV_INTEGER|NV_UTOL|NV_LTOU))==(NV_UTOL|NV_LTOU)) + nv_mapchar(np,(flag&NV_UTOL)?e_tolower:e_toupper); + } + else + cp += 2; + } +skip: +#ifdef _ENV_H + env_delete(shp->env,e_envmarker); +#endif + if(nv_isnull(PWDNOD) || nv_isattr(PWDNOD,NV_TAGGED)) + { + nv_offattr(PWDNOD,NV_TAGGED); + path_pwd(shp,0); + } + if((cp = nv_getval(SHELLNOD)) && (sh_type(cp)&SH_TYPE_RESTRICTED)) + sh_onoption(SH_RESTRICTED); /* restricted shell */ + return; +} + +/* + * terminate shell and free up the space + */ +int sh_term(void) +{ + sfdisc(sfstdin,SF_POPDISC); + free((char*)sh.outbuff); + stakset(NIL(char*),0); + return(0); +} + +/* function versions of these */ + +#define DISABLE /* proto workaround */ + +unsigned long sh_isoption DISABLE (int opt) +{ + return(sh_isoption(opt)); +} + +unsigned long sh_onoption DISABLE (int opt) +{ + return(sh_onoption(opt)); +} + +unsigned long sh_offoption DISABLE (int opt) +{ + return(sh_offoption(opt)); +} + +void sh_sigcheck DISABLE (Shell_t *shp) +{ + if(!shp) + shp = sh_getinterp(); + sh_sigcheck(shp); +} + +Dt_t* sh_bltin_tree DISABLE (void) +{ + return(sh.bltin_tree); +} + +/* + * This code is for character mapped variables with wctrans() + */ +struct Mapchar +{ + Namfun_t hdr; + const char *name; + wctrans_t trans; + int lctype; +}; + +static void put_trans(register Namval_t* np,const char *val,int flags,Namfun_t *fp) +{ + struct Mapchar *mp = (struct Mapchar*)fp; + int c,offset = staktell(),off=offset; + if(val) + { + if(mp->lctype!=lctype) + { + mp->lctype = lctype; + mp->trans = wctrans(mp->name); + } + if(!mp->trans || (flags&NV_INTEGER)) + goto skip; + while(c = mbchar(val)) + { + c = towctrans(c,mp->trans); + stakseek(off+c); + stakseek(off); + c = mbconv(stakptr(off),c); + off += c; + stakseek(off); + } + stakputc(0); + val = stakptr(offset); + } + else + { + nv_putv(np,val,flags,fp); + nv_disc(np,fp,NV_POP); + if(!(fp->nofree&1)) + free((void*)fp); + stakseek(offset); + return; + } +skip: + nv_putv(np,val,flags,fp); + stakseek(offset); +} + +static const Namdisc_t TRANS_disc = { sizeof(struct Mapchar), put_trans }; + +Namfun_t *nv_mapchar(Namval_t *np,const char *name) +{ + wctrans_t trans = name?wctrans(name):0; + struct Mapchar *mp=0; + int n=0,low; + if(np) + mp = (struct Mapchar*)nv_hasdisc(np,&TRANS_disc); + if(!name) + return(mp?(Namfun_t*)mp->name:0); + if(!trans) + return(0); + if(!np) + return(((Namfun_t*)0)+1); + if((low=strcmp(name,e_tolower)) && strcmp(name,e_toupper)) + n += strlen(name)+1; + if(mp) + { + if(strcmp(name,mp->name)==0) + return(&mp->hdr); + nv_disc(np,&mp->hdr,NV_POP); + if(!(mp->hdr.nofree&1)) + free((void*)mp); + } + mp = newof(0,struct Mapchar,1,n); + mp->trans = trans; + mp->lctype = lctype; + if(low==0) + mp->name = e_tolower; + else if(n==0) + mp->name = e_toupper; + else + { + mp->name = (char*)(mp+1); + strcpy((char*)mp->name,name); + } + mp->hdr.disc = &TRANS_disc; + return(&mp->hdr); +} diff --git a/cde/programs/dtksh/ksh93 b/cde/programs/dtksh/ksh93 index f207cd578..9ba2c2e0d 160000 --- a/cde/programs/dtksh/ksh93 +++ b/cde/programs/dtksh/ksh93 @@ -1 +1 @@ -Subproject commit f207cd57879ea248f33d84ad9018577b53de3a5a +Subproject commit 9ba2c2e0dfadd78b1688161e4c4feb072a6d3447 diff --git a/cde/programs/dtksh/msgs.c b/cde/programs/dtksh/msgs.c index 2dca5551d..7e4a400dd 100644 --- a/cde/programs/dtksh/msgs.c +++ b/cde/programs/dtksh/msgs.c @@ -150,7 +150,7 @@ GetSharedMsg( msg = GETMESSAGE(11,28, "Usage: %s widget"); break; - case DT_ERROR: + case DTKSH_ERROR: msg = GETMESSAGE(11,29, "dtksh error"); break; diff --git a/cde/programs/dtksh/msgs.h b/cde/programs/dtksh/msgs.h index 62f1d14cc..7171e341b 100644 --- a/cde/programs/dtksh/msgs.h +++ b/cde/programs/dtksh/msgs.h @@ -104,7 +104,7 @@ extern char *_DtGetMessage(char *filename, int set, int n, char *s ); #define DT_USAGE_WIDGET_POS 25 #define DT_USAGE_WIDGET_TIME 27 #define DT_USAGE_WIDGET 28 -#define DT_ERROR 29 +#define DTKSH_ERROR 29 /* ksh93 retroactively claimed DT_ERROR */ #define DT_WARNING 30 #define DT_XK_FREE_NO_MEMBER 31 #define DT_XK_PARSE_ERROR 32 diff --git a/cde/programs/dtksh/userinit.c b/cde/programs/dtksh/userinit.c deleted file mode 100644 index de269e462..000000000 --- a/cde/programs/dtksh/userinit.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * CDE - Common Desktop Environment - * - * Copyright (c) 1993-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these libraries and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - */ -/* $TOG: userinit.c /main/6 1998/04/20 12:55:18 mgreess $ */ -#include "defs.h" -#include "name.h" -#include "variables.h" -#include
-#include
-#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "hash.h" -#include "stdio.h" -#define NO_AST -#include "dtksh.h" -#undef NO_AST -#include "xmksh.h" -#include "dtkcmds.h" -#include "xmcvt.h" -#include "widget.h" -#include "extra.h" -#include "xmwidgets.h" -#include "msgs.h" -#include - - -/* - * LocaleChanged is defined in ksh93/src/cmd/ksh93/sh/init.c - */ - -extern void LocaleChanged ( - Namval_t * np, - const char * val, - int flags, - Namfun_t * fp ); - - -static Namdisc_t localeDisc = { 0, LocaleChanged, NULL, NULL, NULL, NULL, NULL, NULL }; -static Namfun_t localeFun = {NULL, NULL }; - -extern char *savedNlsPath; /* in ./ksh93/src/cmd/ksh93/sh/init.c */ - - -void -SyncEnv( - char *name) -{ - char *value, *buf; - - value = getenv(name); - if(value != (char *)NULL) - { - buf = malloc(strlen(name) + strlen(value) + 2); - strcpy(buf, name); - strcat(buf, "="); - strcat(buf, value); - ksh_putenv(buf); - free(buf); /* I hope it's legal to free this! */ - } -} - -/* - * This is a hook for an additional initialization routine - * A function of this name is called in main after sh_init(). - */ - -void -sh_userinit( void ) - -{ - int * lockedFds; - - lockedFds = LockKshFileDescriptors(); - (void) XtSetLanguageProc((XtAppContext)NULL, (XtLanguageProc)NULL, - (XtPointer)NULL); - setlocale(LC_ALL, ""); - DtNlInitialize(); - _DtEnvControl(DT_ENV_SET); - localeFun.disc = &localeDisc; - nv_stack(LANGNOD, &localeFun); - UnlockKshFileDescriptors(lockedFds); - - /* - * Save the current setting of NLSPATH. The user/script may want to - * set its own NLSPATH to access its message catalog, so we need to - * remember where to find our own catalog(s). This saved path is used - * in ksh93/src/cmd/ksh93/sh/init.c: _DtGetMessage(). We don't mess - * with the user/script's setting of LANG as we want to track changes - * in LANG. - */ - savedNlsPath = strdup(getenv("NLSPATH")); - - /* - * Sync the libc environment (set up by DtEnvControl) with our internal - * hash table environment. - */ - SyncEnv("NLSPATH"); - SyncEnv("LANG"); -} - -/* - * The following routines are used to query a CDE database to determine - * if the current character encoding requires special care in the ksh - * parser. They are used in updateShSpecialParse(). These are copied - * from the DtHelp code. - */ -#include -#include - -static const char *DfltStdCharset = "ISO-8859-1"; -static const char *DfltStdLang = "C"; - -static char MyPlatform[_DtPLATFORM_MAX_LEN+1]; -static int CompVer; - -/****************************************************************************** - * Function: static _DtXlateDb OpenLcxDb () - * - * Parameters: none - * - * Return Value: NULL: error, else a _DtXlateDb - * - * errno Values: - * - * Purpose: Opens the Ce-private Lcx database - * - *****************************************************************************/ -static _DtXlateDb -OpenLcxDb (void) -{ - static _DtXlateDb MyDb; - static Boolean MyFirst = True; - static Boolean MyProcess = False; - static int ExecVer; - time_t time1 = 0; - time_t time2 = 0; - - /* - * wait up to 30 sec. until another thread or enter is done - * modifying the table. - */ - while (MyProcess == True) - { - /* if time out, return */ - if (time(&time2) == (time_t)-1) - return (_DtXlateDb)NULL; - - if (time1 == 0) - time1 = time2; - else if (time2 - time1 >= (time_t)30) - return (_DtXlateDb)NULL; - } - - if (MyFirst == True) - { - MyProcess = True; - if (_DtLcxOpenAllDbs(&MyDb) == 0 && - _DtXlateGetXlateEnv(MyDb,MyPlatform,&ExecVer,&CompVer) != 0) - { - _DtLcxCloseDb(&MyDb); - MyDb = NULL; - } - MyFirst = False; - MyProcess = False; - } - - return MyDb; -} - -/****************************************************************************** - * Function: static void XlateOpToStdLocale(char *operation, char *opLocale, - * char **ret_stdLocale, - * char **ret_stdLang, - * char **ret_stdSet) - * - * Parameters: - * operation Operation associated with the locale value - * opLocale An operation-specific locale string - * ret_locale Returns the std locale - * Caller must free this string. - * ret_stdLang Returns the std language & territory string. - * Caller must free this string. - * ret_stdSet Returns the std code set string. - * Caller must free this string. - * - * Return Value: - * - * Purpose: Gets the standard locale given an operation and its locale - * - *****************************************************************************/ -static void -XlateOpToStdLocale ( - char *operation, - char *opLocale, - char **ret_stdLocale, - char **ret_stdLang, - char **ret_stdSet) -{ - _DtXlateDb MyDb; - - MyDb = OpenLcxDb(); - - if (MyDb != NULL) - { - (void) _DtLcxXlateOpToStd(MyDb, MyPlatform, CompVer, - operation,opLocale, - ret_stdLocale, ret_stdLang, ret_stdSet, NULL); - } - - /* if failed, give default values */ - if (ret_stdLocale != NULL && *ret_stdLocale == NULL) - { - *ret_stdLocale = malloc(strlen(DfltStdLang)+strlen(DfltStdCharset)+3); - sprintf(*ret_stdLocale,"%s.%s",DfltStdLang,DfltStdCharset); - } - if (ret_stdLang != NULL && *ret_stdLang == NULL) - *ret_stdLang = strdup(DfltStdLang); - if (ret_stdSet != NULL && *ret_stdSet == NULL) - *ret_stdSet = strdup(DfltStdCharset); -} - - -/****************************************************************************** - * Function: static void XlateStdToOpLocale(char *operation, - * char *stdLocale, char *dflt_opLocale, - * char **ret_opLocale) - * - * Parameters: - * operation operation whose locale value will be retrieved - * stdLocale standard locale value - * dflt_opLocale operation-specific locale-value - * This is the default value used in error case - * ret_opLocale operation-specific locale-value placed here - * Caller must free this string. - * - * Return Value: - * - * Purpose: Gets an operation-specific locale string given the standard string - * - *****************************************************************************/ -static void -XlateStdToOpLocale ( - char *operation, - char *stdLocale, - char *dflt_opLocale, - char **ret_opLocale) -{ - _DtXlateDb MyDb; - - MyDb = OpenLcxDb(); - - if (MyDb != NULL) - (void) _DtLcxXlateStdToOp(MyDb, MyPlatform, CompVer, - operation, stdLocale, NULL, NULL, NULL, ret_opLocale); -} - -extern int shSpecialParse; /* in ksh93/src/cmd/ksh93/sh/lex.c */ - -/* - * updateShellSpecialParse uses the libXvh database to determine if the - * current character encoding requires special care in the ksh parser. - * It sets or clears a global flag (shSpecialParse) based on the value - * from the database. This flag is declared and inspected in sh_lex() in - * ksh93/src/cmd/ksh93/sh/lex.c. This routine is stubbed in the - * file .../sh/userinit.c to allow ksh93 to compile & run, albeit - * without any knowledge of when to do special parsing. - */ - -void -updateShSpecialParse( void ) -{ - char *locale = (char *)NULL, *parseVal = (char *)NULL; - int * lockedFds; - - lockedFds = LockKshFileDescriptors(); - - XlateOpToStdLocale(DtLCX_OPER_SETLOCALE, setlocale(LC_CTYPE,NULL), - &locale, NULL, NULL); - XlateStdToOpLocale("dtkshSpecialParse", locale, NULL, &parseVal); - XtFree(locale); - - UnlockKshFileDescriptors(lockedFds); - - if(parseVal != (char *)NULL) - { - shSpecialParse = 1; - XtFree(parseVal); - } - else - shSpecialParse = 0; -} diff --git a/cde/programs/dtksh/widget.c b/cde/programs/dtksh/widget.c index 8ef221e86..11f49502c 100644 --- a/cde/programs/dtksh/widget.c +++ b/cde/programs/dtksh/widget.c @@ -30,8 +30,8 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#include "name.h" -#include "shell.h" +#include "name.h" +#include "shell.h" #include #include #include @@ -129,7 +129,7 @@ init_widgets( void ) for (i = 0; C[i].cname != NULL; i++) { if ((nam = hashput(Wclasses, C[i].cname, (char *)(&C[i]))) == NULL) { - errhdr = strdup(GetSharedMsg(DT_ERROR)); + errhdr = strdup(GetSharedMsg(DTKSH_ERROR)); errmsg = strdup(GETMESSAGE(14,1, "Internal hash table failure during widget class initialization; exiting")); printerr(errhdr, errmsg, NULL); @@ -213,7 +213,7 @@ str_to_class( if ((nam = (char *)hashput((Hash_table_t*)ret->res, resources[i].resource_name, (char *)&resources[i])) == NULL) { - errhdr = strdup(GetSharedMsg(DT_ERROR)); + errhdr = strdup(GetSharedMsg(DTKSH_ERROR)); errmsg=strdup(GetSharedMsg( DT_HASHING_FAILURE)); printerrf(errhdr, errmsg, resources[i].resource_name, ret->cname, NULL, NULL, NULL, NULL, NULL, NULL); @@ -251,7 +251,7 @@ str_to_class( blockArray[i]->resources[j].resource_name, (char *)&(blockArray[i]->resources[j]))) == NULL) { - errhdr = strdup(GetSharedMsg(DT_ERROR)); + errhdr = strdup(GetSharedMsg(DTKSH_ERROR)); errmsg=strdup(GetSharedMsg( DT_HASHING_FAILURE)); printerrf(errhdr, errmsg, blockArray[i]->resources[j].resource_name, @@ -286,7 +286,7 @@ str_to_class( if ((nam = (char *)hashput((Hash_table_t*)ret->con, resources[i].resource_name, &resources[i])) == NULL) { - errhdr =strdup(GetSharedMsg(DT_ERROR)); + errhdr =strdup(GetSharedMsg(DTKSH_ERROR)); errmsg=strdup(GetSharedMsg(DT_HASHING_FAILURE)); printerrf(errhdr, errmsg, resources[i].resource_name, ret->cname, NULL, NULL, NULL, NULL, NULL, NULL); @@ -617,7 +617,7 @@ do_DtLoadWidget( classtab->class = ((WidgetClass *)address)[0]; if ((nam = hashput(Wclasses, classtab->cname, (char *)classtab)) == NULL) { - errhdr = strdup(GetSharedMsg(DT_ERROR)); + errhdr = strdup(GetSharedMsg(DTKSH_ERROR)); errmsg= strdup(GETMESSAGE(14,7, "Internal hash table failure during initialization of widget class '%s'")); printerrf(errhdr, errmsg, classtab->cname, diff --git a/cde/programs/dtksh/xmcmds.c b/cde/programs/dtksh/xmcmds.c index ff6b6e81e..58f020960 100644 --- a/cde/programs/dtksh/xmcmds.c +++ b/cde/programs/dtksh/xmcmds.c @@ -29,7 +29,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#include "shell.h" +#include "shell.h" #include #include #include diff --git a/cde/programs/dtksh/xmcvt.c b/cde/programs/dtksh/xmcvt.c index 61299e79b..8c381397f 100644 --- a/cde/programs/dtksh/xmcvt.c +++ b/cde/programs/dtksh/xmcvt.c @@ -31,7 +31,7 @@ /* actual or intended publication of such source code. */ -#include "shell.h" +#include "shell.h" #include #include #include diff --git a/cde/programs/dtksh/xmdtksym.c b/cde/programs/dtksh/xmdtksym.c index 2e45b21e2..dbd1c799e 100644 --- a/cde/programs/dtksh/xmdtksym.c +++ b/cde/programs/dtksh/xmdtksym.c @@ -22,7 +22,7 @@ */ /* $TOG: xmdtksym.c /main/6 1998/04/20 12:55:58 mgreess $ */ -#include "shell.h" +#include "shell.h" #include #include #include @@ -69,7 +69,9 @@ extern unsigned long ed_setup (); extern unsigned long ed_ungetchar (); extern unsigned long ed_virt_to_phys (); extern unsigned long ed_window (); +#ifndef KSHELL extern unsigned long editb; +#endif extern unsigned long env_init (); extern unsigned long hist_cancel (); extern unsigned long hist_close (); @@ -106,7 +108,9 @@ extern unsigned long path_search (); extern unsigned long st; extern unsigned long test_binop (); extern unsigned long test_inode (); +#ifndef SHOPT_RAWONLY extern unsigned long tty_alt (); +#endif extern unsigned long tty_check (); extern unsigned long tty_cooked (); extern unsigned long tty_get (); @@ -417,7 +421,9 @@ struct symarray Symarray[] = { { "ed_ungetchar", (unsigned long) &ed_ungetchar }, { "ed_virt_to_phys", (unsigned long) &ed_virt_to_phys }, { "ed_window", (unsigned long) &ed_window }, +#ifndef KSHELL { "editb", (unsigned long) &editb }, +#endif { "env_blank", (unsigned long) &env_blank }, { "env_get", (unsigned long) &env_get }, { "env_set", (unsigned long) &env_set }, @@ -432,7 +438,6 @@ struct symarray Symarray[] = { { "path_exec", (unsigned long) &path_exec }, { "path_expand", (unsigned long) &path_expand }, { "path_get", (unsigned long) &path_get }, - { "path_join", (unsigned long) &path_join }, { "path_open", (unsigned long) &path_open }, { "path_pwd", (unsigned long) &path_pwd }, { "path_relative", (unsigned long) &path_relative }, @@ -446,7 +451,9 @@ struct symarray Symarray[] = { { "strperm", (unsigned long) &strperm }, { "test_binop", (unsigned long) &test_binop }, { "test_inode", (unsigned long) &test_inode }, +#ifndef SHOPT_RAWONLY { "tty_alt", (unsigned long) &tty_alt }, +#endif { "tty_check", (unsigned long) &tty_check }, { "tty_cooked", (unsigned long) &tty_cooked }, { "tty_get", (unsigned long) &tty_get }, diff --git a/cde/programs/dtksh/xmextra.h b/cde/programs/dtksh/xmextra.h index e86b8a815..da2b00a97 100644 --- a/cde/programs/dtksh/xmextra.h +++ b/cde/programs/dtksh/xmextra.h @@ -45,205 +45,205 @@ */ #if defined(bltin) && ( defined(__STDC__) || defined(__STDPP__) ) -#define lcl_cast(x) ((int (*)__PROTO__((int, char*[], __V_*)))x) +#define lcl_cast(x) ((int (*)__PROTO__((int, char*[], Shbltin_t*)))x) #else #define lcl_cast(x) x #endif #define DTK_TK_EXTRA_TABLE \ - { "XmCreateArrowButton", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateArrowButton) }, \ - { "XmCreateArrowButtonGadget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateArrowButtonGadget) }, \ - { "XmCreateBulletinBoard", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateBulletinBoard) }, \ - { "XmCreateBulletinBoardDialog", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateBulletinBoardDialog) }, \ - { "XmCreateCascadeButton", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateCascadeButton) }, \ - { "XmCreateCascadeButtonGadget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateCascadeButtonGadget) }, \ - { "XmCreateComboBox", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateComboBox) }, \ - { "XmCreateCommand", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateCommand) }, \ - { "XmCreateDialogShell", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateDialogShell) }, \ - { "XmCreateDrawingArea", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateDrawingArea) }, \ - { "XmCreateDrawnButton", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateDrawnButton) }, \ - { "XmCreateErrorDialog", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateErrorDialog) }, \ - { "XmCreateFileSelectionBox", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateFileSelectionBox) }, \ - { "XmCreateFileSelectionDialog", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateFileSelectionDialog) }, \ - { "XmCreateForm", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateForm) }, \ - { "XmCreateFormDialog", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateFormDialog) }, \ - { "XmCreateFrame", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateFrame) }, \ - { "XmCreateInformationDialog", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateInformationDialog) }, \ - { "XmCreateLabel", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateLabel) }, \ - { "XmCreateLabelGadget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateLabelGadget) }, \ - { "XmCreateList", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateList) }, \ - { "XmCreateMainWindow", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateMainWindow) }, \ - { "XmCreateMenuBar", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateMenuBar) }, \ - { "XmCreateMenuShell", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateMenuShell) }, \ - { "XmCreateMessageBox", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateMessageBox) }, \ - { "XmCreateMessageDialog", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateMessageDialog) }, \ - { "XmCreateOptionMenu", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateOptionMenu) }, \ - { "XmCreatePanedWindow", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreatePanedWindow) }, \ - { "XmCreatePopupMenu", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreatePopupMenu) }, \ - { "XmCreatePromptDialog", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreatePromptDialog) },\ - { "XmCreatePulldownMenu", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreatePulldownMenu) },\ - { "XmCreatePushButton", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreatePushButton) }, \ - { "XmCreatePushButtonGadget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreatePushButtonGadget) }, \ - { "XmCreateQuestionDialog", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateQuestionDialog) }, \ - { "XmCreateRadioBox", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateRadioBox) }, \ - { "XmCreateRowColumn", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateRowColumn) }, \ - { "XmCreateScale", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateScale) }, \ - { "XmCreateScrollBar", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateScrollBar) }, \ - { "XmCreateScrolledList", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateScrolledList) },\ - { "XmCreateScrolledText", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateScrolledText) },\ - { "XmCreateScrolledWindow", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateScrolledWindow) }, \ - { "XmCreateSelectionBox", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateSelectionBox) },\ - { "XmCreateSelectionDialog", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateSelectionDialog) }, \ - { "XmCreateSeparator", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateSeparator) }, \ - { "XmCreateSeparatorGadget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateSeparatorGadget) }, \ - { "XmCreateText", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateText) }, \ - { "XmCreateTextField", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateTextField) },\ - { "XmCreateToggleButton", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateToggleButton) },\ - { "XmCreateToggleButtonGadget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateToggleButtonGadget) }, \ - { "XmCreateWarningDialog", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateWarningDialog) }, \ - { "XmCreateWorkArea", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateWorkArea) }, \ - { "XmCreateWorkingDialog", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCreateWorkingDialog) }, \ - { "DtCreateHelpDialog", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtCreateHelpDialog) }, \ - { "DtCreateHelpQuickDialog", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtCreateHelpQuickDialog) }, \ - { "DtCreatePrintSetupBox", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtCreatePrintSetupBox)}, \ - { "DtCreatePrintSetupDialog", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtCreatePrintSetupDialog)}, \ - { "DtCreatePDMJobSetup", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtCreatePDMJobSetup)}, \ - { "DtHelpReturnSelectedWidgetId", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtHelpReturnSelectedWidgetId) }, \ - { "DtHelpSetCatalogName", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtHelpSetCatalogName) }, \ - { "DtHelpQuickDialogGetChild", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtHelpQuickDialogGetChild) }, \ - { "XmCommandAppendValue", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCommandAppendValue) },\ - { "XmCommandError", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCommandError) },\ - { "XmCommandSetValue", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCommandSetValue) },\ - { "XmCommandGetChild", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmCommandGetChild) },\ - { "XmMessageBoxGetChild", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmMessageBoxGetChild) },\ - { "XmFileSelectionBoxGetChild", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmFileSelectionBoxGetChild) },\ - { "XmSelectionBoxGetChild", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmSelectionBoxGetChild) },\ - { "XmMainWindowSetAreas", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmMainWindowSetAreas) },\ - { "XmMainWindowSep1", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmMainWindowSep1) },\ - { "XmMainWindowSep2", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmMainWindowSep2) },\ - { "XmMainWindowSep3", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmMainWindowSep3) },\ - { "XmProcessTraversal", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmProcessTraversal) }, \ - { "XmInternAtom", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmInternAtom) }, \ - { "XmGetAtomName", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmGetAtomName) }, \ - { "XmGetColors", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmGetColors) }, \ - { "XmUpdateDisplay", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmUpdateDisplay) }, \ - { "XmAddWMProtocols", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmAddWMProtocols) }, \ - { "XmRemoveWMProtocols", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmRemoveWMProtocols) }, \ - { "XmAddWMProtocolCallback", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmAddWMProtocolCallback) }, \ - { "XmRemoveWMProtocolCallback", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmRemoveWMProtocolCallback) }, \ - { "XmMenuPosition", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmMenuPosition) }, \ - { "XmScaleGetValue", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmScaleGetValue) }, \ - { "XmScaleSetValue", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmScaleSetValue) }, \ - { "XmScrollBarGetValues", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmScrollBarGetValues) },\ - { "XmScrollBarSetValues", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmScrollBarSetValues) },\ - { "XmScrollVisible", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmScrollVisible) },\ - { "XmToggleButtonGetState", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmToggleButtonGetState) },\ - { "XmToggleButtonGadgetGetState", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmToggleButtonGadgetGetState) },\ - { "XmToggleButtonSetState", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmToggleButtonSetState) },\ - { "XmToggleButtonGadgetSetState", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmToggleButtonGadgetSetState) },\ - { "XmIsTraversable", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmIsTraversable) }, \ - { "XmOptionButtonGadget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmOptionButtonGadget) }, \ - { "XmOptionLabelGadget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmOptionLabelGadget) }, \ - { "XmGetVisibility", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmGetVisibility) }, \ - { "XmGetTearOffControl", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmGetTearOffControl) }, \ - { "XmGetTabGroup", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmGetTabGroup) }, \ - { "XmGetPostedFromWidget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmGetPostedFromWidget) }, \ - { "XmGetFocusWidget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmGetFocusWidget) }, \ - { "XmFileSelectionDoSearch", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmFileSelectionDoSearch) }, \ + { "XmCreateArrowButton", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateArrowButton) }, \ + { "XmCreateArrowButtonGadget", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateArrowButtonGadget) }, \ + { "XmCreateBulletinBoard", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateBulletinBoard) }, \ + { "XmCreateBulletinBoardDialog", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateBulletinBoardDialog) }, \ + { "XmCreateCascadeButton", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateCascadeButton) }, \ + { "XmCreateCascadeButtonGadget", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateCascadeButtonGadget) }, \ + { "XmCreateComboBox", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateComboBox) }, \ + { "XmCreateCommand", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateCommand) }, \ + { "XmCreateDialogShell", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateDialogShell) }, \ + { "XmCreateDrawingArea", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateDrawingArea) }, \ + { "XmCreateDrawnButton", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateDrawnButton) }, \ + { "XmCreateErrorDialog", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateErrorDialog) }, \ + { "XmCreateFileSelectionBox", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateFileSelectionBox) }, \ + { "XmCreateFileSelectionDialog", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateFileSelectionDialog) }, \ + { "XmCreateForm", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateForm) }, \ + { "XmCreateFormDialog", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateFormDialog) }, \ + { "XmCreateFrame", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateFrame) }, \ + { "XmCreateInformationDialog", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateInformationDialog) }, \ + { "XmCreateLabel", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateLabel) }, \ + { "XmCreateLabelGadget", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateLabelGadget) }, \ + { "XmCreateList", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateList) }, \ + { "XmCreateMainWindow", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateMainWindow) }, \ + { "XmCreateMenuBar", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateMenuBar) }, \ + { "XmCreateMenuShell", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateMenuShell) }, \ + { "XmCreateMessageBox", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateMessageBox) }, \ + { "XmCreateMessageDialog", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateMessageDialog) }, \ + { "XmCreateOptionMenu", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateOptionMenu) }, \ + { "XmCreatePanedWindow", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreatePanedWindow) }, \ + { "XmCreatePopupMenu", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreatePopupMenu) }, \ + { "XmCreatePromptDialog", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreatePromptDialog) },\ + { "XmCreatePulldownMenu", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreatePulldownMenu) },\ + { "XmCreatePushButton", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreatePushButton) }, \ + { "XmCreatePushButtonGadget", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreatePushButtonGadget) }, \ + { "XmCreateQuestionDialog", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateQuestionDialog) }, \ + { "XmCreateRadioBox", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateRadioBox) }, \ + { "XmCreateRowColumn", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateRowColumn) }, \ + { "XmCreateScale", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateScale) }, \ + { "XmCreateScrollBar", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateScrollBar) }, \ + { "XmCreateScrolledList", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateScrolledList) },\ + { "XmCreateScrolledText", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateScrolledText) },\ + { "XmCreateScrolledWindow", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateScrolledWindow) }, \ + { "XmCreateSelectionBox", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateSelectionBox) },\ + { "XmCreateSelectionDialog", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateSelectionDialog) }, \ + { "XmCreateSeparator", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateSeparator) }, \ + { "XmCreateSeparatorGadget", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateSeparatorGadget) }, \ + { "XmCreateText", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateText) }, \ + { "XmCreateTextField", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateTextField) },\ + { "XmCreateToggleButton", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateToggleButton) },\ + { "XmCreateToggleButtonGadget", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateToggleButtonGadget) }, \ + { "XmCreateWarningDialog", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateWarningDialog) }, \ + { "XmCreateWorkArea", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateWorkArea) }, \ + { "XmCreateWorkingDialog", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCreateWorkingDialog) }, \ + { "DtCreateHelpDialog", NV_BLTIN|BLT_ENV, lcl_cast(do_DtCreateHelpDialog) }, \ + { "DtCreateHelpQuickDialog", NV_BLTIN|BLT_ENV, lcl_cast(do_DtCreateHelpQuickDialog) }, \ + { "DtCreatePrintSetupBox", NV_BLTIN|BLT_ENV, lcl_cast(do_DtCreatePrintSetupBox)}, \ + { "DtCreatePrintSetupDialog", NV_BLTIN|BLT_ENV, lcl_cast(do_DtCreatePrintSetupDialog)}, \ + { "DtCreatePDMJobSetup", NV_BLTIN|BLT_ENV, lcl_cast(do_DtCreatePDMJobSetup)}, \ + { "DtHelpReturnSelectedWidgetId", NV_BLTIN|BLT_ENV, lcl_cast(do_DtHelpReturnSelectedWidgetId) }, \ + { "DtHelpSetCatalogName", NV_BLTIN|BLT_ENV, lcl_cast(do_DtHelpSetCatalogName) }, \ + { "DtHelpQuickDialogGetChild", NV_BLTIN|BLT_ENV, lcl_cast(do_DtHelpQuickDialogGetChild) }, \ + { "XmCommandAppendValue", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCommandAppendValue) },\ + { "XmCommandError", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCommandError) },\ + { "XmCommandSetValue", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCommandSetValue) },\ + { "XmCommandGetChild", NV_BLTIN|BLT_ENV, lcl_cast(do_XmCommandGetChild) },\ + { "XmMessageBoxGetChild", NV_BLTIN|BLT_ENV, lcl_cast(do_XmMessageBoxGetChild) },\ + { "XmFileSelectionBoxGetChild", NV_BLTIN|BLT_ENV, lcl_cast(do_XmFileSelectionBoxGetChild) },\ + { "XmSelectionBoxGetChild", NV_BLTIN|BLT_ENV, lcl_cast(do_XmSelectionBoxGetChild) },\ + { "XmMainWindowSetAreas", NV_BLTIN|BLT_ENV, lcl_cast(do_XmMainWindowSetAreas) },\ + { "XmMainWindowSep1", NV_BLTIN|BLT_ENV, lcl_cast(do_XmMainWindowSep1) },\ + { "XmMainWindowSep2", NV_BLTIN|BLT_ENV, lcl_cast(do_XmMainWindowSep2) },\ + { "XmMainWindowSep3", NV_BLTIN|BLT_ENV, lcl_cast(do_XmMainWindowSep3) },\ + { "XmProcessTraversal", NV_BLTIN|BLT_ENV, lcl_cast(do_XmProcessTraversal) }, \ + { "XmInternAtom", NV_BLTIN|BLT_ENV, lcl_cast(do_XmInternAtom) }, \ + { "XmGetAtomName", NV_BLTIN|BLT_ENV, lcl_cast(do_XmGetAtomName) }, \ + { "XmGetColors", NV_BLTIN|BLT_ENV, lcl_cast(do_XmGetColors) }, \ + { "XmUpdateDisplay", NV_BLTIN|BLT_ENV, lcl_cast(do_XmUpdateDisplay) }, \ + { "XmAddWMProtocols", NV_BLTIN|BLT_ENV, lcl_cast(do_XmAddWMProtocols) }, \ + { "XmRemoveWMProtocols", NV_BLTIN|BLT_ENV, lcl_cast(do_XmRemoveWMProtocols) }, \ + { "XmAddWMProtocolCallback", NV_BLTIN|BLT_ENV, lcl_cast(do_XmAddWMProtocolCallback) }, \ + { "XmRemoveWMProtocolCallback", NV_BLTIN|BLT_ENV, lcl_cast(do_XmRemoveWMProtocolCallback) }, \ + { "XmMenuPosition", NV_BLTIN|BLT_ENV, lcl_cast(do_XmMenuPosition) }, \ + { "XmScaleGetValue", NV_BLTIN|BLT_ENV, lcl_cast(do_XmScaleGetValue) }, \ + { "XmScaleSetValue", NV_BLTIN|BLT_ENV, lcl_cast(do_XmScaleSetValue) }, \ + { "XmScrollBarGetValues", NV_BLTIN|BLT_ENV, lcl_cast(do_XmScrollBarGetValues) },\ + { "XmScrollBarSetValues", NV_BLTIN|BLT_ENV, lcl_cast(do_XmScrollBarSetValues) },\ + { "XmScrollVisible", NV_BLTIN|BLT_ENV, lcl_cast(do_XmScrollVisible) },\ + { "XmToggleButtonGetState", NV_BLTIN|BLT_ENV, lcl_cast(do_XmToggleButtonGetState) },\ + { "XmToggleButtonGadgetGetState", NV_BLTIN|BLT_ENV, lcl_cast(do_XmToggleButtonGadgetGetState) },\ + { "XmToggleButtonSetState", NV_BLTIN|BLT_ENV, lcl_cast(do_XmToggleButtonSetState) },\ + { "XmToggleButtonGadgetSetState", NV_BLTIN|BLT_ENV, lcl_cast(do_XmToggleButtonGadgetSetState) },\ + { "XmIsTraversable", NV_BLTIN|BLT_ENV, lcl_cast(do_XmIsTraversable) }, \ + { "XmOptionButtonGadget", NV_BLTIN|BLT_ENV, lcl_cast(do_XmOptionButtonGadget) }, \ + { "XmOptionLabelGadget", NV_BLTIN|BLT_ENV, lcl_cast(do_XmOptionLabelGadget) }, \ + { "XmGetVisibility", NV_BLTIN|BLT_ENV, lcl_cast(do_XmGetVisibility) }, \ + { "XmGetTearOffControl", NV_BLTIN|BLT_ENV, lcl_cast(do_XmGetTearOffControl) }, \ + { "XmGetTabGroup", NV_BLTIN|BLT_ENV, lcl_cast(do_XmGetTabGroup) }, \ + { "XmGetPostedFromWidget", NV_BLTIN|BLT_ENV, lcl_cast(do_XmGetPostedFromWidget) }, \ + { "XmGetFocusWidget", NV_BLTIN|BLT_ENV, lcl_cast(do_XmGetFocusWidget) }, \ + { "XmFileSelectionDoSearch", NV_BLTIN|BLT_ENV, lcl_cast(do_XmFileSelectionDoSearch) }, \ #define DTK_TK_LIST_TABLE \ - { "XmListAddItem", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListAddItem) }, \ - { "XmListAddItemUnselected", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListAddItemUnselected) }, \ - { "XmListAddItems", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListAddItems) }, \ - { "XmListAddItemsUnselected", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListAddItemsUnselected) }, \ - { "XmListDeleteAllItems", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListDeleteAllItems) }, \ - { "XmListDeleteItem", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListDeleteItem) }, \ - { "XmListDeleteItems", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListDeleteItems) }, \ - { "XmListDeleteItemsPos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListDeleteItemsPos) }, \ - { "XmListDeletePos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListDeletePos) }, \ - { "XmListDeletePositions", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListDeletePositions) }, \ - { "XmListDeselectAllItems", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListDeselectAllItems) }, \ - { "XmListDeselectItem", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListDeselectItem) }, \ - { "XmListDeselectPos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListDeselectPos) }, \ - { "XmListGetKbdItemPos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListGetKbdItemPos) }, \ - { "XmListGetSelectedPos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListGetSelectedPos) }, \ - { "XmListGetMatchPos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListGetMatchPos) }, \ - { "XmListItemExists", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListItemExists) }, \ - { "XmListItemPos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListItemPos) }, \ - { "XmListPosSelected", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListPosSelected) }, \ - { "XmListPosToBounds", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListPosToBounds) }, \ - { "XmListReplaceItemsPos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListReplaceItemsPos) }, \ - { "XmListReplaceItemsPosUnselected", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListReplaceItemsPosUnselected) }, \ - { "XmListSelectItem", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListSelectItem) }, \ - { "XmListSelectPos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListSelectPos) }, \ - { "XmListSetAddMode", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListSetAddMode) }, \ - { "XmListSetBottomItem", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListSetBottomItem) }, \ - { "XmListSetBottomPos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListSetBottomPos) }, \ - { "XmListSetHorizPos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListSetHorizPos) }, \ - { "XmListSetItem", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListSetItem) }, \ - { "XmListSetKbdItemPos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListSetKbdItemPos) }, \ - { "XmListSetPos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListSetPos) }, \ - { "XmListUpdateSelectedList", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmListUpdateSelectedList) }, \ + { "XmListAddItem", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListAddItem) }, \ + { "XmListAddItemUnselected", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListAddItemUnselected) }, \ + { "XmListAddItems", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListAddItems) }, \ + { "XmListAddItemsUnselected", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListAddItemsUnselected) }, \ + { "XmListDeleteAllItems", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListDeleteAllItems) }, \ + { "XmListDeleteItem", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListDeleteItem) }, \ + { "XmListDeleteItems", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListDeleteItems) }, \ + { "XmListDeleteItemsPos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListDeleteItemsPos) }, \ + { "XmListDeletePos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListDeletePos) }, \ + { "XmListDeletePositions", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListDeletePositions) }, \ + { "XmListDeselectAllItems", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListDeselectAllItems) }, \ + { "XmListDeselectItem", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListDeselectItem) }, \ + { "XmListDeselectPos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListDeselectPos) }, \ + { "XmListGetKbdItemPos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListGetKbdItemPos) }, \ + { "XmListGetSelectedPos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListGetSelectedPos) }, \ + { "XmListGetMatchPos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListGetMatchPos) }, \ + { "XmListItemExists", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListItemExists) }, \ + { "XmListItemPos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListItemPos) }, \ + { "XmListPosSelected", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListPosSelected) }, \ + { "XmListPosToBounds", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListPosToBounds) }, \ + { "XmListReplaceItemsPos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListReplaceItemsPos) }, \ + { "XmListReplaceItemsPosUnselected", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListReplaceItemsPosUnselected) }, \ + { "XmListSelectItem", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListSelectItem) }, \ + { "XmListSelectPos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListSelectPos) }, \ + { "XmListSetAddMode", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListSetAddMode) }, \ + { "XmListSetBottomItem", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListSetBottomItem) }, \ + { "XmListSetBottomPos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListSetBottomPos) }, \ + { "XmListSetHorizPos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListSetHorizPos) }, \ + { "XmListSetItem", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListSetItem) }, \ + { "XmListSetKbdItemPos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListSetKbdItemPos) }, \ + { "XmListSetPos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListSetPos) }, \ + { "XmListUpdateSelectedList", NV_BLTIN|BLT_ENV, lcl_cast(do_XmListUpdateSelectedList) }, \ #define DTK_TK_TEXT_TABLE \ - { "XmTextDisableRedisplay", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextDisableRedisplay) }, \ - { "XmTextEnableRedisplay", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextEnableRedisplay) }, \ - { "XmTextGetTopCharacter", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetTopCharacter) }, \ - { "XmTextSetTopCharacter", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetTopCharacter) }, \ - { "XmTextScroll", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextScroll) }, \ - { "XmTextFindString", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextFindString) }, \ - { "XmTextGetBaseline", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetBaseline) }, \ - { "XmTextGetEditable", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetEditable) }, \ - { "XmTextGetInsertionPosition", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetInsertionPosition) }, \ - { "XmTextGetLastPosition", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetLastPosition) }, \ - { "XmTextGetMaxLength", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetMaxLength) }, \ - { "XmTextGetSelection", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetSelection) }, \ - { "XmTextGetSelectionPosition", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetSelectionPosition) }, \ - { "XmTextGetString", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetString) }, \ - { "XmTextInsert", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextInsert) }, \ - { "XmTextPosToXY", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextPosToXY) }, \ - { "XmTextRemove", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextRemove) }, \ - { "XmTextReplace", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextReplace) }, \ - { "XmTextSetEditable", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetEditable) }, \ - { "XmTextSetHighlight", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetHighlight) }, \ - { "XmTextSetInsertionPosition", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetInsertionPosition) }, \ - { "XmTextSetMaxLength", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetMaxLength) }, \ - { "XmTextSetSelection", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetSelection) }, \ - { "XmTextSetString", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetString) }, \ - { "XmTextShowPosition", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextShowPosition) }, \ - { "XmTextXYToPos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextXYToPos) }, \ - { "XmTextClearSelection", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextClearSelection) }, \ - { "XmTextCopy", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextCopy) }, \ - { "XmTextCut", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextCut) }, \ - { "XmTextPaste", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextPaste) }, \ - { "XmTextSetAddMode", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetAddMode) }, \ - { "XmTextFieldGetBaseline", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetBaseline) }, \ - { "XmTextFieldGetEditable", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetEditable) }, \ - { "XmTextFieldGetInsertionPosition", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetInsertionPosition) }, \ - { "XmTextFieldGetLastPosition", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetLastPosition) }, \ - { "XmTextFieldGetMaxLength", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetMaxLength) }, \ - { "XmTextFieldGetSelection", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetSelection) }, \ - { "XmTextFieldGetSelectionPosition", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetSelectionPosition) }, \ - { "XmTextFieldGetString", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextGetString) }, \ - { "XmTextFieldInsert", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextInsert) }, \ - { "XmTextFieldPosToXY", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextPosToXY) }, \ - { "XmTextFieldRemove", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextRemove) }, \ - { "XmTextFieldReplace", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextReplace) }, \ - { "XmTextFieldSetEditable", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetEditable) }, \ - { "XmTextFieldSetHighlight", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetHighlight) }, \ - { "XmTextFieldSetInsertionPosition", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetInsertionPosition) }, \ - { "XmTextFieldSetMaxLength", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetMaxLength) }, \ - { "XmTextFieldSetSelection", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetSelection) }, \ - { "XmTextFieldSetString", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetString) }, \ - { "XmTextFieldShowPosition", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextShowPosition) }, \ - { "XmTextFieldXYToPos", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextXYToPos) }, \ - { "XmTextFieldClearSelection", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextClearSelection) }, \ - { "XmTextFieldCopy", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextCopy) }, \ - { "XmTextFieldCut", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextCut) }, \ - { "XmTextFieldPaste", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextPaste) }, \ - { "XmTextFieldSetAddMode", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XmTextSetAddMode) }, \ + { "XmTextDisableRedisplay", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextDisableRedisplay) }, \ + { "XmTextEnableRedisplay", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextEnableRedisplay) }, \ + { "XmTextGetTopCharacter", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetTopCharacter) }, \ + { "XmTextSetTopCharacter", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetTopCharacter) }, \ + { "XmTextScroll", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextScroll) }, \ + { "XmTextFindString", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextFindString) }, \ + { "XmTextGetBaseline", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetBaseline) }, \ + { "XmTextGetEditable", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetEditable) }, \ + { "XmTextGetInsertionPosition", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetInsertionPosition) }, \ + { "XmTextGetLastPosition", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetLastPosition) }, \ + { "XmTextGetMaxLength", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetMaxLength) }, \ + { "XmTextGetSelection", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetSelection) }, \ + { "XmTextGetSelectionPosition", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetSelectionPosition) }, \ + { "XmTextGetString", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetString) }, \ + { "XmTextInsert", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextInsert) }, \ + { "XmTextPosToXY", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextPosToXY) }, \ + { "XmTextRemove", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextRemove) }, \ + { "XmTextReplace", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextReplace) }, \ + { "XmTextSetEditable", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetEditable) }, \ + { "XmTextSetHighlight", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetHighlight) }, \ + { "XmTextSetInsertionPosition", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetInsertionPosition) }, \ + { "XmTextSetMaxLength", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetMaxLength) }, \ + { "XmTextSetSelection", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetSelection) }, \ + { "XmTextSetString", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetString) }, \ + { "XmTextShowPosition", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextShowPosition) }, \ + { "XmTextXYToPos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextXYToPos) }, \ + { "XmTextClearSelection", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextClearSelection) }, \ + { "XmTextCopy", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextCopy) }, \ + { "XmTextCut", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextCut) }, \ + { "XmTextPaste", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextPaste) }, \ + { "XmTextSetAddMode", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetAddMode) }, \ + { "XmTextFieldGetBaseline", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetBaseline) }, \ + { "XmTextFieldGetEditable", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetEditable) }, \ + { "XmTextFieldGetInsertionPosition", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetInsertionPosition) }, \ + { "XmTextFieldGetLastPosition", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetLastPosition) }, \ + { "XmTextFieldGetMaxLength", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetMaxLength) }, \ + { "XmTextFieldGetSelection", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetSelection) }, \ + { "XmTextFieldGetSelectionPosition", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetSelectionPosition) }, \ + { "XmTextFieldGetString", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextGetString) }, \ + { "XmTextFieldInsert", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextInsert) }, \ + { "XmTextFieldPosToXY", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextPosToXY) }, \ + { "XmTextFieldRemove", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextRemove) }, \ + { "XmTextFieldReplace", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextReplace) }, \ + { "XmTextFieldSetEditable", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetEditable) }, \ + { "XmTextFieldSetHighlight", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetHighlight) }, \ + { "XmTextFieldSetInsertionPosition", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetInsertionPosition) }, \ + { "XmTextFieldSetMaxLength", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetMaxLength) }, \ + { "XmTextFieldSetSelection", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetSelection) }, \ + { "XmTextFieldSetString", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetString) }, \ + { "XmTextFieldShowPosition", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextShowPosition) }, \ + { "XmTextFieldXYToPos", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextXYToPos) }, \ + { "XmTextFieldClearSelection", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextClearSelection) }, \ + { "XmTextFieldCopy", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextCopy) }, \ + { "XmTextFieldCut", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextCut) }, \ + { "XmTextFieldPaste", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextPaste) }, \ + { "XmTextFieldSetAddMode", NV_BLTIN|BLT_ENV, lcl_cast(do_XmTextSetAddMode) }, \ #endif /* _Dtksh_xmextra_h */