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.
Fix warnings related to secruity concerns on varargs functions. By specifying
"%s" on single string calls to sprintf() (and related) it's not possible to
have a % in the input string causing random data to be read off the stack.
tmpnam() usage replaced with mkstemp(). Find a suitable tmp directory
checking the TMPDIR environment variable first, then the P_tmpdir
macro and finally /tmp directly.
On 64-bit Linux platforms, check to see if libc.so exists in /usr/lib64.
If found, use it over /usr/lib/libc.so.
The libc.so file is not always in /usr/lib. On multilib systems, the
file we care about could be in /usr/lib64. Likewise, common Linux
conventions call for 64-bit libraries to go in lib64 directories, so
check there first when on a Linux 64-bit system.
Use the same set of langs as on Linux and FreeBSD (no Japanese), don't
redefine a needed macro as no-op, and unset LC_CTYPE in the environment
when building cat files.
We need to use mkcatdefs to build those.
mkcatdefs needs to be built from the open motif
source tree (localized/util/mkcatdefs.c)
and installed as:
cde/imports/motif/localized/util/mkcatdefs
GetBaseName causes segfaults, because when the pathname
ends in a "/" it returns NULL. This happens when trying
to give a valid filename to dtcreate for an icon.
ProcessExecString thought it was returning an array of size 3; however
in C arrays are second-class and there is no direct way to return an
array like this; GCC warning triggered because it was actually
just returning a pointer to local storage. Fixed using malloc.
Also fix some obviously wrong usages of sizeof, although they were
relatively harmless. A little other warning quieting using 0 instead of
NULL.
This code always buffer overflowed, because exactly 2 bytes
less than were used were allocated. This led to dtcreate
crashing when hitting "Find Set..."
The following font families
(or their aliases) will be used:
-adobe-courier-bold-o-normal--*-
-adobe-courier-bold-r-normal--*-
-adobe-courier-medium-o-normal--*-
-adobe-courier-medium-r-normal--*-
-adobe-helvetica-bold-o-normal--*-
-adobe-helvetica-bold-r-normal--*-
-adobe-helvetica-medium-o-normal--*-
-adobe-helvetica-medium-r-normal--*-
-adobe-symbol-medium-r-normal--*-
-adobe-times-bold-i-normal--*-
-adobe-times-bold-r-normal--*-
-adobe-times-medium-i-normal--*-
-adobe-times-medium-r-normal--*-
-b&h-lucidasans-medium-r-normal-sans-*-
-b&h-lucidatypewriter-bold-r-normal-sans-*-
-b&h-lucidatypewriter-medium-r-normal-sans-*-
The files will be installed in
/usr/dt/config/xfonts/C
This directory should be added to the
X server font path:
xset fp+ /usr/dt/config/xfonts/C
and/or via
FontPath "/usr/dt/config/xfonts/C"
in the "Files" section of the xorg.conf file.
We have
pid_t
wait3(int *status, int options, struct rusage *rusage);
on FreeBSD and we don't need (union wait) handling.
Another good candidate for one #ifdef from imake templates.
We have already OPT_BSD_WAIT in ToolTalk's tt_options.h
Add preprocessor directives not to try
to redefine sys_errlist[] or sys_nerr
There are already definitions:
extern __const char *__const sys_errlist[];
extern __const int sys_nerr;
in <stdio.h>
Actually we should have something like
NeedSysErrlist in imake definitions
to get rid of those #ifdefs.
This code tried to automatically generate the X DISPLAY
from the combination of the hostname and display number;
however 127.0.0.1:0 is normally rejected by X11, so this
technique is no good. Fixes dticon hang on startup, caused by
XOpenDisplay failure leading to this message from tttrace:
tt_default_session_set(0x0x875190=="X 127.0.0.1 0") = 1032 (TT_ERR_ACCESS)
BSD make interrupts shell pipeline after
if it cannot run the command:
rm -f Mrm.msg
ln -s ../../../../imports/motif/localized/de_DE.ISO8859-1/msg/Mrm.msg Mrm.msg
Running mkcatdefs for Mrm.cat with LANG set to de_DE.ISO8859-1
( rm -f Mrm.cat Mrm.tmp.msg; LANG=de_DE.ISO8859-1; export LANG; ../../../../imports/motif/localized/util/mkcatdefs Mrm Mrm.msg -h > Mrm.tmp.msg; gencat Mrm.cat Mrm.tmp.msg; rm -f Mrm.tmp.msg )
../../../../imports/motif/localized/util/mkcatdefs: not found
*** Error code 127
After this, an empty Mrm.tmp.msg is left.
- Const strings referenced by non-const variables.
- Incorrect format specifers for printing addresses
- Unused variables
- Signed comparison to unsigned
Also fix an incorrect enumeration value in a switch statement.
Introduce KORNSHELL make variable to point
to the implementation of the Korn Shell.
Use $(SHELL) or $(KORNSHELL) explicitly for
make programs that do not automatically call
shell scripts from the current directory.
dtksh can be now compiled on FreeBSD. Work in progress.
Needs a real Korn shell to bootstrap as $(KSHELL).
KSHELL is set by default to /usr/local/bin/ksh93
(generic POSIX shell may not work)
Tested on:
FreeBSD 9.0-BETA1 #0 r224912M amd64
Known issues:
xvmstat:
* sleep does not work well (SIGSTOP is delivered)
xpong:
* xpong: line 220: ball1x = max_x * 2.2 / 3 : arithmetic syntax error
* dtksh is rebuilt uncondtionally every time make is invoked