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.
This commit is contained in:
Marcin Cieslak
2012-08-23 17:49:26 +02:00
committed by Jon Trulson
parent 98b17d3551
commit 17a33f0430
32 changed files with 63 additions and 40 deletions

View File

@@ -1,7 +1,8 @@
XCOMM $XConsortium: Imakefile /main/6 1996/04/21 19:52:31 drk $
CPP_DEFINES = -DCDE_INSTALLATION_TOP=$(CDE_INSTALLATION_TOP) \
-DCDE_CONFIGURATION_TOP=$(CDE_CONFIGURATION_TOP)
-DCDE_CONFIGURATION_TOP=$(CDE_CONFIGURATION_TOP) \
-DKORNSHELL=$(KORNSHELL)
#if defined (SunArchitecture)
LOCAL_CPP_DEFINES = $(CPP_DEFINES) -D__sun

View File

@@ -46,7 +46,7 @@ ACTION DtTypes
ARG_COUNT 0
TYPE COMMAND
WINDOW_TYPE NO_STDIO
EXEC_STRING CDE_INSTALLATION_TOP/bin/dtterm -e ksh -c '/usr/dt/bin/dttypes;'
EXEC_STRING CDE_INSTALLATION_TOP/bin/dtterm -e KORNSHELL -c '/usr/dt/bin/dttypes;'
DESCRIPTION %|nls-9002-#The#|
}
ACTION DtTypes

View File

@@ -278,6 +278,18 @@ DATA_CRITERIA KSHELL3
CONTENT 0 string #! /bin/ksh
MODE f&x
}
DATA_CRITERIA KSHELL4
{
DATA_ATTRIBUTES_NAME KSHELL
CONTENT 0 string #!KORNSHELL
MODE f&x
}
DATA_CRITERIA KSHELL5
{
DATA_ATTRIBUTES_NAME KSHELL
CONTENT 0 string #! KORNSHELL
MODE f&x
}
ACTION Run
{
LABEL %|nls-3-#Run#|

View File

@@ -173,8 +173,8 @@ ACTION DttermRlogin
ARG_COUNT 0
TYPE COMMAND
WINDOW_TYPE NO_STDIO
EXEC_STRING ksh -c 'export _title="%"%|nls-12017-#Hostname:#|"%"; \
/usr/dt/bin/dtterm -title "%|nls-12022-#\$_title#|" -e ksh -c \
EXEC_STRING KORNSHELL -c 'export _title="%"%|nls-12017-#Hostname:#|"%"; \
/usr/dt/bin/dtterm -title "%|nls-12022-#\$_title#|" -e KORNSHELL -c \
"echo %|nls-12023-#Trying to#|; \
rlogin \$_title; sleep 5;";'
DESCRIPTION %|nls-12024-#The#|
@@ -189,8 +189,8 @@ ACTION XtermRlogin
ARG_COUNT 0
TYPE COMMAND
WINDOW_TYPE NO_STDIO
EXEC_STRING ksh -c 'export _title="%"%|nls-12017-#Hostname:#|"%"; \
xterm -title "%|nls-12026-#\$_title#|" -e ksh -c \
EXEC_STRING KORNSHELL -c 'export _title="%"%|nls-12017-#Hostname:#|"%"; \
xterm -title "%|nls-12026-#\$_title#|" -e KORNSHELL -c \
"echo %|nls-12023-#Trying to#|; \
rlogin \$_title; sleep 5;";'
DESCRIPTION %|nls-12027-#The#|