Use KORNSHELL variable instead of /bin/ksh
authorMarcin Cieslak <saper@saper.info>
Thu, 23 Aug 2012 15:49:26 +0000 (17:49 +0200)
committerJon Trulson <jon@radscan.com>
Fri, 24 Aug 2012 02:00:43 +0000 (20:00 -0600)
commit17a33f0430f01d4a824fc92e077df17f4775e220
tree9e8ce1b614fb74f6bb63b1993d7f85c3e6fa8b16
parent98b17d35517648112c1db57a94b9540d34663352
Use KORNSHELL variable instead of /bin/ksh

This patch removes instances of hardcoded
invocation of /bin/ksh and allows to
replace it with, for, example,
/usr/local/bin/ksh93

Also "ksh93" is accepted whenever "ksh" is.

Tested using the following /bin/ksh:

----8<----
WHAT=`ps -o command= -p $PPID`
msg="Something tried to call /bin/ksh: $PPID: $WHAT"
print -u2 "$msg"
logger user.warn "$msg"
exit 99
----8<----
(Warning: first two lines are FreeBSD specific)

Scripts from Makefiles should now be executed either
with

$(KORNSHELL) korn-shell-script

or

$(SHELL) bourne-shell-script

therefore #!/bin/ksh has not been changed everywhere.

/usr/dt/bin/ scripts have been converted (e.g. Xsession)

Whenever possible Imake and CPP facilities have been used.

For C and C++ programs KORNSHELL needs to be defined to
"/path/to/your/ksh" (with quotes) so that it can make
a valid C constant.

Therefore, when adding KORNSHELL to Imakefile for C files,
you have to add

CXXEXTRA_DEFINES = -DKORNSHELL=\"$(KORNSHELL)\"

or similar (for example, see programs/dtprintinfo)

But for simple shell script substitution we usually change

 LOCAL_CPP_DEFINES = -DCDE_CONFIGURATION_TOP=$(CDE_CONFIGURATION_TOP) \
                     -DCDE_INSTALLATION_TOP=$(CDE_INSTALLATION_TOP) \
                     -DCDE_LOGFILES_TOP=$(CDE_LOGFILES_TOP)

to:

 LOCAL_CPP_DEFINES = -DCDE_CONFIGURATION_TOP=$(CDE_CONFIGURATION_TOP) \
                     -DCDE_INSTALLATION_TOP=$(CDE_INSTALLATION_TOP) \
                     -DCDE_LOGFILES_TOP=$(CDE_LOGFILES_TOP) \
                     -DKORNSHELL=$(KORNSHELL) \
                     -DXPROJECTROOT=X11ProjectRoot

since we don't want quotes for shell scripts.
32 files changed:
cde/admin/IntegTools/dbTools/Imakefile
cde/admin/IntegTools/dbTools/dinstallCDE.src
cde/admin/IntegTools/dbTools/installCDE.src
cde/admin/IntegTools/dbTools/linksLast
cde/admin/IntegTools/dbTools/uncomment
cde/programs/dtappintegrate/Imakefile
cde/programs/dtappintegrate/dtappintegrate.src
cde/programs/dtfile/Find.c
cde/programs/dtfile/Imakefile
cde/programs/dtlogin/config/0015.sun.env.src
cde/programs/dtlogin/config/0050.dtxmodmap.src
cde/programs/dtlogin/config/0060.dtsysenv.src
cde/programs/dtlogin/config/Imakefile
cde/programs/dtlogin/config/Xreset.src
cde/programs/dtlogin/config/Xsession.ow.src
cde/programs/dtlogin/config/Xsession.ow2.src
cde/programs/dtlogin/config/Xsession.src
cde/programs/dtlogin/config/Xsetup.src
cde/programs/dtlogin/config/Xstartup.src
cde/programs/dtlogin/config/dtlslocale.src
cde/programs/dtprintegrate/Imakefile
cde/programs/dtprintegrate/dtprintegrate.src
cde/programs/dtprintinfo/libUI/MotifUI/Imakefile
cde/programs/dtprintinfo/libUI/MotifUI/MotifThread.C
cde/programs/dtprintinfo/util/Imakefile
cde/programs/dtprintinfo/util/Invoke.C
cde/programs/dtsession/Imakefile
cde/programs/dtsession/dtloadresources.src
cde/programs/types/Imakefile
cde/programs/types/unsupported.dt.src
cde/programs/types/uxstd.dt.src
cde/programs/types/xclients.dt.src