Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

8
cde/util/Imakefile Normal file
View File

@@ -0,0 +1,8 @@
XCOMM $XConsortium: Imakefile /main/2 1996/04/21 19:12:47 drk $
#define IHaveSubdirs
#define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)"
SUBDIRS = scripts
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))

220
cde/util/progs/lndir.c Normal file
View File

@@ -0,0 +1,220 @@
/* $XConsortium: lndir.c /main/2 1996/11/01 10:11:58 drk $ */
/* Create shadow link tree (after X11R4 script of the same name)
Mark Reinhold (mbr@lcs.mit.edu)/3 January 1990 */
/* Copyright 1990, Massachusetts Institute of Technology
Permission to use, copy, modify, and distribute this program for any purpose
and without fee is hereby granted, provided that this copyright and
permission notice appear on all copies and supporting documentation, that
the name of MIT not be used in advertising or publicity pertaining to
distribution of this program without specific prior permission, and that
notice be given in supporting documentation that copying and distribution is
by permission of MIT. MIT makes no representations about the suitability of
this software for any purpose. It is provided "as is" without expressed or
implied warranty.
*/
/* From the original /bin/sh script:
Used to create a copy of the a directory tree that has links for all
non-directories (except those named RCS or SCCS). If you are
building the distribution on more than one machine, you should use
this script.
If your master sources are located in /usr/local/src/X and you would like
your link tree to be in /usr/local/src/new-X, do the following:
% mkdir /usr/local/src/new-X
% cd /usr/local/src/new-X
% lndir ../X
*/
#include <X11/Xos.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <errno.h>
#ifndef X_NOT_POSIX
#include <dirent.h>
#else
#ifdef SYSV
#include <dirent.h>
#else
#ifdef USG
#include <dirent.h>
#else
#include <sys/dir.h>
#ifndef dirent
#define dirent direct
#endif
#endif
#endif
#endif
#ifdef X_NOT_STDC_ENV
extern int errno;
#endif
int silent;
void
quit (code, fmt, a1, a2, a3)
char *fmt;
{
fprintf (stderr, fmt, a1, a2, a3);
putc ('\n', stderr);
exit (code);
}
void
quiterr (code, s)
char *s;
{
perror (s);
exit (code);
}
void
msg (fmt, a1, a2, a3)
char *fmt;
{
fprintf (stderr, fmt, a1, a2, a3);
putc ('\n', stderr);
}
/* Recursively create symbolic links from the current directory to the "from"
directory. Assumes that files described by fs and ts are directories. */
dodir (fn, fs, ts, rel)
char *fn; /* name of "from" directory, either absolute or
relative to cwd */
struct stat *fs, *ts; /* stats for the "from" directory and cwd */
int rel; /* if true, prepend "../" to fn before using */
{
DIR *df;
struct dirent *dp;
char buf[MAXPATHLEN + 1], *p;
char symbuf[MAXPATHLEN + 1];
struct stat sb, sc;
int n_dirs;
if ((fs->st_dev == ts->st_dev) && (fs->st_ino == ts->st_ino)) {
msg ("%s: From and to directories are identical!", fn);
return 1;
}
if (rel)
strcpy (buf, "../");
else
buf[0] = '\0';
strcat (buf, fn);
if (!(df = opendir (buf))) {
msg ("%s: Cannot opendir", buf);
return 1;
}
p = buf + strlen (buf);
*p++ = '/';
n_dirs = fs->st_nlink;
while (dp = readdir (df)) {
strcpy (p, dp->d_name);
if (n_dirs > 0) {
if (stat (buf, &sb) < 0) {
perror (buf);
continue;
}
if (sb.st_mode & S_IFDIR) {
/* directory */
n_dirs--;
if (dp->d_name[0] == '.' &&
(dp->d_name[1] == '\0' || (dp->d_name[1] == '.' &&
dp->d_name[2] == '\0')))
continue;
if (!strcmp (dp->d_name, "RCS"))
continue;
if (!strcmp (dp->d_name, "SCCS"))
continue;
if (!silent)
printf ("%s:\n", buf);
if ((stat (dp->d_name, &sc) < 0) && (errno == ENOENT)) {
if (mkdir (dp->d_name, 0777) < 0 ||
stat (dp->d_name, &sc) < 0) {
perror (dp->d_name);
continue;
}
}
if (readlink (dp->d_name, symbuf, sizeof(symbuf) - 1) >= 0) {
msg ("%s: is a link instead of a directory\n", dp->d_name);
continue;
}
if (chdir (dp->d_name) < 0) {
perror (dp->d_name);
continue;
}
dodir (buf, &sb, &sc, (buf[0] != '/'));
if (chdir ("..") < 0)
quiterr (1, "..");
continue;
}
}
/* non-directory */
if (symlink (buf, dp->d_name) < 0) {
int saverrno = errno;
int symlen;
symlen = readlink(dp->d_name, symbuf, sizeof(symbuf) - 1);
errno = saverrno;
if (symlen > 0)
symbuf[symlen] = '\0';
if (symlen < 0 || strcmp(symbuf, buf))
perror (dp->d_name);
}
}
closedir (df);
return 0;
}
main (ac, av)
int ac;
char **av;
{
char *fn, *tn;
struct stat fs, ts;
silent = 0;
if (ac > 1 && !strcmp(av[1], "-silent")) {
silent = 1;
}
if (ac < silent + 2 || ac > silent + 3)
quit (1, "usage: %s [-silent] fromdir [todir]", av[0]);
fn = av[silent + 1];
if (ac == silent + 3)
tn = av[silent + 2];
else
tn = ".";
/* to directory */
if (stat (tn, &ts) < 0)
quiterr (1, tn);
if (!(ts.st_mode & S_IFDIR))
quit (2, "%s: Not a directory", tn);
if (chdir (tn) < 0)
quiterr (1, tn);
/* from directory */
if (stat (fn, &fs) < 0)
quiterr (1, fn);
if (!(fs.st_mode & S_IFDIR))
quit (2, "%s: Not a directory", fn);
exit (dodir (fn, &fs, &ts, 0));
}

View File

@@ -0,0 +1,36 @@
XCOMM $XConsortium: Imakefile,v 1.21 91/07/29 19:59:55 gildea Exp $
#if UseCCMakeDepend
MDEP_DIR = makedepend
#endif
PROGRAMS = xmkmf $(MDEP_DIR) mergelib
all:: $(PROGRAMS)
CppScriptTarget(xmkmf,xmkmf.cpp,-DCONFIGDIRSPEC=-I$(CONFIGDIR),$(ICONFIGFILES))
#if UseCCMakeDepend
CppScriptTarget(makedepend,mdepend.cpp,-DPREPROC='"'"$(PREPROCESSCMD)"'"',$(ICONFIGFILES))
#endif
CppScriptTarget(mergelib,mergelib.cpp,"-DARCMD=$(AR)" "-DRANLIB=$(RANLIB)",$(ICONFIGFILES))
InstallNamedProg(xmkmf,xmkmf,$(BINDIR))
InstallManPage(xmkmf,$(MANDIR))
InstallNamedProg(mkdirhier.sh,mkdirhier,$(BINDIR))
InstallManPage(mkdirhier,$(MANDIR))
#if UseCCMakeDepend
InstallNamedProg(makedepend,makedepend,$(BINDIR))
#endif
InstallNamedProg(lndir.sh,lndir,$(BINDIR))
InstallManPage(lndir,$(MANDIR))
InstallNamedProg(xon.sh,xon,$(BINDIR))
InstallManPage(xon,$(MANDIR))
#if SystemV || SystemV4
InstallNamedProg(bsdinst.sh,bsdinst,$(BINDIR))
#endif
clean::
$(RM) $(PROGRAMS)
depend::
install.man::

137
cde/util/scripts/bsdinst.sh Executable file
View File

@@ -0,0 +1,137 @@
#!/bin/sh
# $XConsortium: bsdinst.sh /main/2 1995/07/19 18:05:14 drk $
#
# This accepts bsd-style install arguments and makes the appropriate calls
# to the System V install.
#
flags=""
dst=""
src=""
dostrip=""
owner=""
mode=""
while [ x$1 != x ]; do
case $1 in
-c) shift
continue;;
-m) flags="$flags $1 $2 "
mode="$2"
shift
shift
continue;;
-o) flags="$flags -u $2 "
owner="$2"
shift
shift
continue;;
-g) flags="$flags $1 $2 "
shift
shift
continue;;
-s) dostrip="strip"
shift
continue;;
*) if [ x$src = x ]
then
src=$1
else
dst=$1
fi
shift
continue;;
esac
done
case "$mode" in
"")
;;
*)
case "$owner" in
"")
flags="$flags -u root"
;;
esac
;;
esac
if [ x$src = x ]
then
echo "bsdinst: no input file specified"
exit 1
fi
if [ x$dst = x ]
then
echo "bsdinst: no destination specified"
exit 1
fi
# set up some variable to be used later
rmcmd=""
srcdir="."
# if the destination isn't a directory we'll need to copy it first
if [ ! -d $dst ]
then
dstbase=`basename $dst`
cp $src /tmp/$dstbase
rmcmd="rm -f /tmp/$dstbase"
src=$dstbase
srcdir=/tmp
dst="`echo $dst | sed 's,^\(.*\)/.*$,\1,'`"
if [ x$dst = x ]
then
dst="."
fi
fi
# If the src file has a directory, copy it to /tmp to make install happy
srcbase=`basename $src`
if [ "$src" != "$srcbase" -a "$src" != "./$srcbase" ]
then
cp $src /tmp/$srcbase
src=$srcbase
srcdir=/tmp
rmcmd="rm -f /tmp/$srcbase"
fi
# do the actual install
if [ -f /usr/sbin/install ]
then
installcmd=/usr/sbin/install
elif [ -f /etc/install ]
then
installcmd=/etc/install
else
installcmd=install
fi
# This rm is commented out because some people want to be able to
# install through symbolic links. Uncomment it if it offends you.
# rm -f $dst/$srcbase
(cd $srcdir ; $installcmd -f $dst $flags $src)
if [ x$dostrip = xstrip ]
then
strip $dst/$srcbase
fi
# and clean up
$rmcmd

31
cde/util/scripts/checkSysV.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/sh
# $XConsortium: checkSysV.sh /main/2 1995/07/19 18:05:22 drk $
case "$1" in
"") echo "Usage: $0 directory"; exit 1;;
esac
echo "Analyzing $1 for Incompatabilities with System V"
echo 'File names longer than 12 characters (excluding the doc directory):'
cd $1
dirlist=
for dir in `echo *`
do
case "$dir" in
doc) ;;
*) dirlist="$dirlist $dir";;
esac
done
(
find doc -name '???????????????*' -print
find $dirlist -name '?????????????*' -print
) | sort \
| sed -e '/,v/d' \
-e 's/^/ /'
echo 'Symbolic links:'
find . -type l -print | sed -e 's/^/ /'

10
cde/util/scripts/crayar.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
# $XConsortium: crayar.sh /main/2 1995/07/19 18:05:29 drk $
lib=$1
shift
if cray2; then
bld cr $lib `lorder $* | tsort`
else
ar clq $lib $*
fi

50
cde/util/scripts/fontname.sh Executable file
View File

@@ -0,0 +1,50 @@
#!/bin/sh
# $XConsortium: fontname.sh /main/2 1995/07/19 18:05:36 drk $
#
# This script is used to generate the FONT property given correct information
# in the various other fields.
#
awk 'BEGIN {
fontname_registry = "";
foundry = "";
family_name = "";
weight_name = "";
slant = "";
setwidth_name = "";
add_style_name = "";
pixel_size = "";
point_size = "";
resolution_x = "";
resolution_y = "";
spacing = "";
average_width = "";
charset_registry = "";
charset_encoding = "";
}
/^FONTNAME_REGISTRY/ { fontname_registry = $2; }
/^FOUNDRY/ { foundry = $2; }
/^FAMILY_NAME/ { family_name = $2; }
/^WEIGHT_NAME/ { weight_name = $2; }
/^SLANT/ { slant = $2; }
/^SETWIDTH_NAME/ { setwidth_name = $2; }
/^ADD_STYLE_NAME/ { add_style_name = $2; }
/^PIXEL_SIZE/ { pixel_size = $2; }
/^POINT_SIZE/ { point_size = $2; }
/^RESOLUTION_X/ { resolution_x = $2; }
/^RESOLUTION_Y/ { resolution_y = $2; }
/^SPACING/ { spacing = $2; }
/^AVERAGE_WIDTH/ { average_width = $2; }
/^CHARSET_REGISTRY/ { charset_registry = $2; }
/^CHARSET_ENCODING/ { charset_encoding = $2; }
/^ENDPROPERTIES/ { exit; }
END {
printf "%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s\n", \
fontname_registry, foundry, family_name, weight_name, \
slant, setwidth_name, add_style_name, \
pixel_size, point_size, resolution_x, resolution_y, \
spacing, average_width, charset_registry, charset_encoding;
}' $* | sed 's/"//g'

30
cde/util/scripts/fontprop.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/sh
# $XConsortium: fontprop.sh /main/2 1995/07/19 18:05:43 drk $
#
# This script is used to generate the various XLFD font properties given an
# XLFD-style font name:
#
# -FOUNDRY-FAMILY_NAME-WEIGHT_NAME-SLANT-SETWIDTH_NAME-ADD_STYLE_NAME- ...
# ... PIXEL_SIZE-POINT_SIZE-RESOLUTION_X-RESOLUTION_Y-SPACING- ...
# ... AVERAGE_WIDTH-CHARSET_REGISTRY-CHARSET_ENCODING
#
awk -F- '
{
printf "FONTNAME_REGISTRY \"%s\"\n", $1;
printf "FOUNDRY \"%s\"\n", $2;
printf "FAMILY_NAME \"%s\"\n", $3;
printf "WEIGHT_NAME \"%s\"\n", $4;
printf "SLANT \"%s\"\n", $5;
printf "SETWIDTH_NAME \"%s\"\n", $6;
printf "ADD_STYLE_NAME \"%s\"\n", $7;
printf "PIXEL_SIZE %d\n", $8;
printf "POINT_SIZE %d\n", $9;
printf "RESOLUTION_X %d\n", $10;
printf "RESOLUTION_Y %d\n", $11;
printf "SPACING \"%s\"\n", $12;
printf "AVERAGE_WIDTH %d\n", $13;
printf "CHARSET_REGISTRY \"%s\"\n", $14;
printf "CHARSET_ENCODING \"%s\"\n", $15;
}' $*

108
cde/util/scripts/install.sh Executable file
View File

@@ -0,0 +1,108 @@
#!/bin/sh
#
# install - install a program, script, or datafile
#
# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# set DOITPROG to echo to test this script
doit="${DOITPROG:-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG:-mv}"
cpprog="${CPPROG:-cp}"
chmodprog="${CHMODPROG:-chmod}"
chownprog="${CHOWNPROG:-chown}"
chgrpprog="${CHGRPPROG:-chgrp}"
stripprog="${STRIPPROG:-strip}"
rmprog="${RMPROG:-rm}"
instcmd="$mvprog"
chmodcmd=""
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
src=""
dst=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
fi
# if destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
fi
# get rid of the old one and mode the new one in
$doit $rmcmd $dst
$doit $instcmd $src $dst
# and set any options; do chmod last to preserve setuid bits
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; fi
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; fi
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; fi
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; fi
exit 0

View File

@@ -0,0 +1,62 @@
.\" $XConsortium: lndir.man /main/2 1995/07/17 10:49:35 drk $
.TH LNDIR 1 "Release 5" "X Version 11"
.SH NAME
lndir \- create a shadow directory of symbolic links to another directory tree
.SH SYNOPSIS
.B lndir
fromdir [todir]
.SH DESCRIPTION
.I Lndir
makes a shadow copy
.I todir
of a directory tree
.I fromdir,
except that the shadow is not
populated with real files but instead with symbolic links pointing at
the real files in the
.I fromdir
directory tree. This is usually useful for maintaining source code for
different machine architectures. You create a shadow directory
containing links to the real source which you will have usually NFS
mounted from a machine of a different architecture, and then recompile
it. The object files will be in the shadow directory, while the
source files in the shadow directory are just symlinks to the real
files.
.PP
This has the advantage that if you update the source, you need not
propagate the change to the other architectures by hand, since all
source in shadow directories are symlinks to the real thing: just cd
to the shadow directory and recompile away.
.PP
The
.I todir
argument is optional and defaults to the current directory. The
.I fromdir
argument may be relative (e.g., ../src) and is relative to
.I todir
(not the current directory).
.PP
.ft B
Note that RCS and SCCS directories are not shadowed.
.ft
.PP
Note that if you add files, you must run
.I lndir
again. Deleting files is a more painful problem; the symlinks will
just point into never never land.
.SH BUGS
.I Patch
gets upset if it cannot change the files. You should never run
.I patch
from a shadow directory anyway.
.PP
You need to use something like
.nf
find todir -type l -print | xargs rm
.fi
to clear out all files before you can relink (if fromdir moved, for instance).
Something like
.nf
find . \\! -type d -print
.fi
will find all files that are not directories.

85
cde/util/scripts/lndir.sh Executable file
View File

@@ -0,0 +1,85 @@
#! /bin/sh
# lndir - create shadow link tree
#
# $XConsortium: lndir.sh,v 1.8 91/04/15 17:55:03 rws Exp $
#
# Used to create a copy of the a directory tree that has links for all
# non- directories (except those named RCS or SCCS). If you are
# building the distribution on more than one machine, you should use
# this script.
#
# If your master sources are located in /usr/local/src/X and you would like
# your link tree to be in /usr/local/src/new-X, do the following:
#
# % mkdir /usr/local/src/new-X
# % cd /usr/local/src/new-X
# % lndir ../X
USAGE="Usage: $0 fromdir [todir]"
if [ $# -lt 1 -o $# -gt 2 ]
then
echo "$USAGE"
exit 1
fi
DIRFROM=$1
if [ $# -eq 2 ];
then
DIRTO=$2
else
DIRTO=.
fi
if [ ! -d $DIRTO ]
then
echo "$0: $DIRTO is not a directory"
echo "$USAGE"
exit 2
fi
cd $DIRTO
if [ ! -d $DIRFROM ]
then
echo "$0: $DIRFROM is not a directory"
echo "$USAGE"
exit 2
fi
pwd=`pwd`
if [ `(cd $DIRFROM; pwd)` = $pwd ]
then
echo "$pwd: FROM and TO are identical!"
exit 1
fi
for file in `ls -af $DIRFROM`
do
if [ ! -d $DIRFROM/$file ]
then
ln -s $DIRFROM/$file .
else
if [ $file != RCS -a $file != SCCS -a $file != . -a $file != .. ]
then
echo $file:
mkdir $file
(cd $file
pwd=`pwd`
case "$DIRFROM" in
/*) ;;
*) DIRFROM=../$DIRFROM ;;
esac
if [ `(cd $DIRFROM/$file; pwd)` = $pwd ]
then
echo "$pwd: FROM and TO are identical!"
exit 1
fi
$0 $DIRFROM/$file
)
fi
fi
done

56
cde/util/scripts/lninst.sh Executable file
View File

@@ -0,0 +1,56 @@
#!/bin/sh
# $XConsortium: lninst.sh /main/2 1995/07/19 18:05:50 drk $
#
# This accepts bsd-style install arguments and simply makes symbolic links.
#
flags=""
dst=""
src=""
dostrip=""
while [ x$1 != x ]; do
case $1 in
-c) shift
continue;;
-[mog]) flags="$flags $1 $2 "
shift
shift
continue;;
-s) dostrip="strip"
shift
continue;;
*) if [ x$src = x ]
then
src=$1
else
dst=$1
fi
shift
continue;;
esac
done
if [ x$src = x ]
then
echo "syminst: no input file specified"
exit 1
fi
if [ x$dst = x ]
then
echo "syminst: no destination specified"
exit 1
fi
if [ -d $dst ]; then
rm -f $dst/`basename $src`
else
rm -f $dst
fi
ln -s `pwd`/$src $dst

View File

@@ -0,0 +1,228 @@
XCOMM!/bin/sh
XCOMM
XCOMM $XConsortium: mdepend.cpp,v 1.7 91/08/22 11:42:53 rws Exp $
XCOMM
XCOMM Do the equivalent of the 'makedepend' program, but do it right.
XCOMM
XCOMM Usage:
XCOMM
XCOMM makedepend [cpp-flags] [-w width] [-s magic-string] [-f makefile]
XCOMM [-o object-suffix]
XCOMM
XCOMM Notes:
XCOMM
XCOMM The C compiler used can be overridden with the environment
XCOMM variable "CC".
XCOMM
XCOMM The "-v" switch of the "makedepend" program is not supported.
XCOMM
XCOMM
XCOMM This script should
XCOMM work on both USG and BSD systems. However, when System V.4 comes out,
XCOMM USG users will probably have to change "silent" to "-s" instead of
XCOMM "-" (at least, that is what the documentation implies).
XCOMM
CC=PREPROC
silent='-'
TMP=/tmp/mdep$$
CPPCMD=${TMP}a
DEPENDLINES=${TMP}b
TMPMAKEFILE=${TMP}c
MAGICLINE=${TMP}d
ARGS=${TMP}e
trap "rm -f ${TMP}*; exit 1" 1 2 15
trap "rm -f ${TMP}*; exit 0" 1 2 13
echo " \c" > $CPPCMD
if [ `wc -c < $CPPCMD` -eq 1 ]
then
c="\c"
n=
else
c=
n="-n"
fi
echo $n "$c" >$ARGS
files=
makefile=
magic_string='# DO NOT DELETE'
objsuffix='.o'
width=78
endmarker=""
verbose=n
while [ $# != 0 ]
do
if [ "$endmarker"x != x -a "$endmarker" = "$1" ]; then
endmarker=""
else
case "$1" in
-D*|-I*)
echo $n " '$1'$c" >> $ARGS
;;
-g|-o)
;;
*)
if [ "$endmarker"x = x ]; then
case "$1" in
-w)
width="$2"
shift
;;
-s)
magic_string="$2"
shift
;;
-f)
makefile="$2"
shift
;;
-o)
objsuffix="$2"
shift
;;
--*)
echo "$1" | sed 's/^\-\-//' >${TMP}end
endmarker="`cat ${TMP}end`"
rm -f ${TMP}end
if [ "$endmarker"x = x ]; then
endmarker="--"
fi
;;
-v)
verbose="y"
;;
-cc)
CC="$2"
shift
;;
-*)
echo "Unknown option '$1' ignored" 1>&2
;;
*)
files="$files $1"
;;
esac
fi
;;
esac
fi
shift
done
echo ' $*' >> $ARGS
echo "exec $CC `cat $ARGS`" > $CPPCMD
chmod +x $CPPCMD
rm $ARGS
case "$makefile" in
'')
if [ -r makefile ]
then
makefile=makefile
elif [ -r Makefile ]
then
makefile=Makefile
else
echo 'no makefile or Makefile found' 1>&2
exit 1
fi
;;
-)
makefile=$TMPMAKEFILE
;;
esac
if [ "$verbose"x = "y"x ]; then
cat $CPPCMD
fi
echo '' > $DEPENDLINES
for i in $files
do
$CPPCMD $i \
| sed -n "/^#/s;^;$i ;p"
done \
| sed -e 's|/[^/.][^/]*/\.\.||g' -e 's|/\.[^.][^/]*/\.\.||g' \
-e 's|"||g' -e 's| \./| |' \
| awk '{
if ($1 != $4 && $2 != "#ident")
{
ofile = substr ($1, 1, length ($1) - 2) "'"$objsuffix"'"
print ofile, $4
}
}' \
| sort -u \
| awk '
{
newrec = rec " " $2
if ($1 != old1)
{
old1 = $1
if (rec != "")
print rec
rec = $1 ": " $2
}
else if (length (newrec) > '"$width"')
{
print rec
rec = $1 ": " $2
}
else
rec = newrec
}
END \
{
if (rec != "")
print rec
}' \
| egrep -v '^[^:]*:[ ]*$' >> $DEPENDLINES
trap "" 1 2 13 15 # Now we are committed
case "$makefile" in
$TMPMAKEFILE)
;;
*)
rm -f $makefile.bak
cp $makefile $makefile.bak
echo "Appending dependencies to $makefile"
;;
esac
XCOMM
XCOMM Append the magic string and a blank line so that /^$magic_string/+1,\$d
XCOMM can be used to delete everything from after the magic string to the end
XCOMM of the file. Then, append a blank line again and then the dependencies.
XCOMM
cat >> $makefile << END_OF_APPEND
$magic_string
END_OF_APPEND
ed $silent $makefile << END_OF_ED_SCRIPT
/^$magic_string/+1,\$d
w
q
END_OF_ED_SCRIPT
echo '' >>$makefile
cat $DEPENDLINES >>$makefile
case "$makefile" in
$TMPMAKEFILE)
cat $TMPMAKEFILE
;;
esac
rm -f ${TMP}*
exit 0

View File

@@ -0,0 +1,99 @@
XCOMM!/bin/sh
XCOMM
XCOMM $XConsortium: mergelib.cpp,v 1.3 91/08/22 11:08:08 rws Exp $
XCOMM
XCOMM Copyright 1989 Massachusetts Institute of Technology
XCOMM
XCOMM Permission to use, copy, modify, distribute, and sell this software and its
XCOMM documentation for any purpose is hereby granted without fee, provided that
XCOMM the above copyright notice appear in all copies and that both that
XCOMM copyright notice and this permission notice appear in supporting
XCOMM documentation, and that the name of M.I.T. not be used in advertising or
XCOMM publicity pertaining to distribution of the software without specific,
XCOMM written prior permission. M.I.T. makes no representations about the
XCOMM suitability of this software for any purpose. It is provided "as is"
XCOMM without express or implied warranty.
XCOMM
XCOMM M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
XCOMM IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
XCOMM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
XCOMM WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
XCOMM OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
XCOMM CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
XCOMM
XCOMM Author: Jim Fulton, MIT X Consortium
XCOMM
XCOMM mergelib - merge one library into another; this is commonly used by X
XCOMM to add the extension library into the base Xlib.
XCOMM
usage="usage: $0 to-library from-library [object-filename-prefix]"
objprefix=_
case $# in
2) ;;
3) objprefix=$3 ;;
*) echo "$usage" 1>&2; exit 1 ;;
esac
tolib=$1
fromlib=$2
if [ ! -f $fromlib ]; then
echo "$0: no such from-library $fromlib" 1>&2
exit 1
fi
if [ ! -f $tolib ]; then
echo "$0: no such to-library $tolib" 1>&2
exit 1
fi
XCOMM
XCOMM Create a temp directory, and figure out how to reference the
XCOMM object files from it (i.e. relative vs. absolute path names).
XCOMM
tmpdir=tmp.$$
origdir=..
mkdir $tmpdir
if [ ! -d $tmpdir ]; then
echo "$0: unable to create temporary directory $tmpdir" 1>&2
exit 1
fi
case "$fromlib" in
/?*) upfrom= ;;
*) upfrom=../ ;;
esac
case "$tolib" in
/?*) upto= ;;
*) upto=../ ;;
esac
XCOMM
XCOMM In the temp directory, extract all of the object files and prefix
XCOMM them with some symbol to avoid name clashes with the base library.
XCOMM
cd $tmpdir
ar x ${upfrom}$fromlib
for i in *.o; do
mv $i ${objprefix}$i
done
XCOMM
XCOMM Merge in the object modules, ranlib (if appropriate) and cleanup
XCOMM
ARCMD ${upto}$tolib *.o
RANLIB ${upto}$tolib
cd $origdir
rm -rf $tmpdir

View File

@@ -0,0 +1,16 @@
.\" $XConsortium: mkdirhier.man /main/2 1995/07/17 10:49:43 drk $
.TH MKDIRHIER 1 "Release 5" "X Version 11"
.SH NAME
mkdirhier \- makes a directory hierarchy
.SH SYNOPSIS
.B mkdirhier
directory ...
.SH DESCRIPTION
The
.I mkdirhier
command creates the specified directories. Unlike
.I mkdir
if any of the parent directories of the specified directory
do not exist, it creates them as well.
.SH "SEE ALSO"
mkdir(1)

View File

@@ -0,0 +1,61 @@
#!/bin/sh
# $XConsortium: mkdirhier.sh,v 1.6 91/08/13 18:13:04 rws Exp $
# Courtesy of Paul Eggert
newline='
'
IFS=$newline
case ${1--} in
-*) echo >&2 "mkdirhier: usage: mkdirhier directory ..."; exit 1
esac
status=
for directory
do
case $directory in
'')
echo >&2 "mkdirhier: empty directory name"
status=1
continue;;
*"$newline"*)
echo >&2 "mkdirhier: directory name contains a newline: \`\`$directory''"
status=1
continue;;
///*) prefix=/;; # See Posix 2.3 "path".
//*) prefix=//;;
/*) prefix=/;;
-*) prefix=./;;
*) prefix=
esac
IFS=/
set x $directory
IFS=$newline
shift
for filename
do
path=$prefix$filename
prefix=$path/
shift
test -d "$path" || {
paths=$path
for filename
do
if [ "$filename" != "." ]; then
path=$path/$filename
paths=$paths$newline$path
fi
done
mkdir $paths || status=$?
break
}
done
done
exit $status

91
cde/util/scripts/syminst.sh Executable file
View File

@@ -0,0 +1,91 @@
#!/bin/sh
# $XConsortium: syminst.sh /main/2 1995/07/19 18:05:57 drk $
#
# syminst - install with a symbolic link back to the build tree
#
# set DOITPROG to echo to test this script
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
lnprog="${LNPROG-ln -s}"
rmprog="${RMPROG-rm}"
instcmd="$lnprog"
rmcmd="$rmprog -f"
srcdir=`pwd`/
src=""
dst=""
while [ x"$1" != x ]; do
case $1 in
-c) shift
continue;;
-m) shift
shift
continue;;
-o) shift
shift
continue;;
-g) shift
shift
continue;;
-s) shift
continue;;
-DIR) srcdir=`echo $2 | sed 's;/\./;/;g'`/
shift
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "syminst: no input file specified"
exit 1
fi
if [ x"$dst" = x ]
then
echo "syminst: no destination specified"
exit 1
fi
# if destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
fi
case $src in
/*) srcdir=""
instcmd=cp;;
esac
# get rid of the old one and mode the new one in
$doit $rmcmd $dst
$doit $instcmd $srcdir$src $dst
exit 0

29
cde/util/scripts/x11mf.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
# $XConsortium: x11mf.sh /main/2 1995/07/19 18:06:05 drk $
#
# generate a Makefile within the build tree
#
# usage: x11mf [treedir]
#
if [ x$1 != x ]; then
tree=$1
else
tree=/x11
fi
dir=`pwd`
top=`(cd $tree; /bin/pwd)`
intree=no
case $dir in
$top*) intree=yes;;
esac
if [ $intree != yes ]; then
echo "$0: Must be underneath $tree"
exit 1
fi
(cd ..; make SUBDIRS=`basename $dir` Makefiles)

View File

@@ -0,0 +1,57 @@
XCOMM!/bin/sh
XCOMM
XCOMM generate a Makefile from an Imakefile from inside or outside the sources
XCOMM
XCOMM $XConsortium: xmkmf.cpp,v 1.18 91/08/22 11:08:01 rws Exp $
usage="usage: $0 [-a] [top_of_sources_pathname [current_directory]]"
topdir=
curdir=.
do_all=
case "$1" in
-a)
do_all="yes"
shift
;;
esac
case $# in
0) ;;
1) topdir=$1 ;;
2) topdir=$1 curdir=$2 ;;
*) echo "$usage" 1>&2; exit 1 ;;
esac
case "$topdir" in
-*) echo "$usage" 1>&2; exit 1 ;;
esac
if [ -f Makefile ]; then
echo mv Makefile Makefile.bak
mv Makefile Makefile.bak
fi
if [ "$topdir" = "" ]; then
args="-DUseInstalled "CONFIGDIRSPEC
else
args="-I$topdir/config -DTOPDIR=$topdir -DCURDIR=$curdir"
fi
echo imake $args
case "$do_all" in
yes)
imake $args &&
echo "make Makefiles" &&
make Makefiles &&
echo "make includes" &&
make includes &&
echo "make depend" &&
make depend
;;
*)
imake $args
;;
esac

View File

@@ -0,0 +1,63 @@
.\" $XConsortium: xmkmf.man,v 1.3 91/08/17 13:06:59 rws Exp $
.TH XMKMF 1 "Release 5" "X Version 11"
.SH NAME
xmkmf \- create a Makefile from an Imakefile
.SH SYNOPSIS
.B xmkmf
[ -a ] [
.I topdir
[
.I curdir
] ]
.SH DESCRIPTION
The
.I xmkmf
command is the normal way to create a
.I Makefile
from an
.I Imakefile
shipped with third-party software.
.PP
When invoked with no arguments in a directory containing an
.I Imakefile,
the
.I imake
program is run with arguments appropriate for your system
(configured into
.I xmkmf
when X was built) and generates a
.I Makefile.
.PP
When invoked with the
.I \-a
option,
.I xmkmf
builds the
.I Makefile
in the current directory, and then automatically executes
``make Makefiles'' (in case there are subdirectories),
``make includes'',
and ``make depend'' for you.
This is the normal way to configure software that is outside
the MIT X build tree.
.PP
If working inside the MIT X build tree (unlikely unless you are an X
developer, and even then this option is never really used), the
.I topdir
argument should be specified as the relative pathname from the
current directory to the top of the build tree. Optionally,
.I curdir
may be specified as a relative pathname from the top of the build
tree to the current directory. It is necessary to supply
.I curdir
if the current directory has subdirectories, or the
.I Makefile
will not be able to build the subdirectories.
If a
.I topdir
is given,
.I xmkmf
assumes nothing is installed on your system and looks for files in
the build tree instead of using the installed versions.
.SH "SEE ALSO"
imake(1)

55
cde/util/scripts/xon.man Normal file
View File

@@ -0,0 +1,55 @@
.\" $XConsortium: xon.man /main/2 1995/07/17 10:49:49 drk $
.TH XON 1 "Release 5" "X Version 11"
.SH NAME
xon \- start an X program on a remote machine
.SH SYNOPSIS
.B xon
remote-host [-access] [-debug] [-name window-name] [-nols] [-screen screen-no]
[-user user-name] [command ...]
.SH DESCRIPTION
.I Xon
runs the specified command (default xterm -ls) on the remote machine using
rsh. Xon passes the DISPLAY, XAUTHORITY and XUSERFILESEARCHPATH environment
variables to the remote command.
.PP
When no command is specified, xon runs 'xterm -ls'. It additionally
specifies the application name to be 'xterm-\fIremote-host\fP' and the
window title to be '-fIremote-host\fP'.
.PP
Xon can only work when the remote host will allow you to use rsh, by having
an entry in the .rhosts file permitting access.
.SH OPTIONS
.PP
Note that the options follow the remote host name (as they do with rlogin).
.sp
.IP "\fB-access\fP"
Runs xhost locally to add the remote host to the host access list in the X
server. This won't work unless xhost is given permission to modify the
access list.
.IP "\fB-debug\fP"
Normally, xon disconnects the remote process from stdin, stdout and stderr
to eliminate the daemon processes which usually connect them across the
network. Specifying the \fB-debug\fP option leaves them connected so that
error messages from the remote execution are sent back to the originating
host.
.IP "\fB-name window-name\fP"
This specifies a different application name and window title for the default
command (xterm).
.IP "\fB-nols\fP"
Normally xon passes the -ls option to the remote xterm; this option
suspends that behaviour.
.IP "\fB-screen screen-no\fP"
This changes the screen number of the DISPLAY variable passed to the remote
command.
.IP "\fB-user user-name\fP"
By default, xon simply uses rsh to connect to the remote machine using the
same user name as on the local machine. This option cause xon to specify an
alternative user name. This will not work unless you have authorization to
access the remote account via rsh by placing an appropriate entry in the
remote users .rhosts file.
.SH BUGS
Xon can get easily confused when the remote-host, user-name or various
environment variable values contain white space.
.PP
Xon has no way to send the appropriate X authorization information to the
remote host.

112
cde/util/scripts/xon.sh Executable file
View File

@@ -0,0 +1,112 @@
#!/bin/sh
# $XConsortium: xon.sh /main/2 1995/07/19 18:06:13 drk $
# start up xterm (or any other X command) on the specified host
# Usage: xon host [arguments] [command]
case $# in
0)
echo "Usage: $0 <hostname> [-user user] [-name window-name] [-debug]"
echo "[-screen screen-number] [command ...]"
exit 1
;;
esac
target=$1
shift
label=$target
resource=xterm-$label
rcmd="rsh $target"
case $DISPLAY in
unix:*)
DISPLAY=`echo $DISPLAY | sed 's/unix//'`
;;
esac
case $DISPLAY in
:*)
fullname=`hostname`
hostname=`echo $fullname | sed 's/\..*$//'`
if [ $hostname = $target -o $fullname = $target ]; then
DISPLAY=$DISPLAY
rcmd="sh -c"
else
DISPLAY=$fullname$DISPLAY
fi
;;
esac
username=
xauth=
case x$XUSERFILESEARCHPATH in
x)
xpath='HOME=${HOME-`pwd`} '
;;
*)
xpath='HOME=${HOME-`pwd`} XUSERFILESEARCHPATH=${XUSERFILESEARCHPATH-"'"$XUSERFILESEARCHPATH"'"} '
;;
esac
redirect=" < /dev/null > /dev/null 2>&1 &"
command=
ls=-ls
continue=:
while $continue; do
case $1 in
-user)
shift
username="-l $1"
label="$target $1"
rcmd="rsh $target $username"
shift
case x$XAUTHORITY in
x)
XAUTHORITY="$HOME/.Xauthority"
;;
esac
case x$XUSERFILESEARCHPATH in
x)
;;
*)
xpath="XUSERFILESEARCHPATH=$XUSERFILESEARCHPATH "
;;
esac
;;
-access)
shift
xhost +$target
;;
-name)
shift
label="$1"
resource="$1"
shift
;;
-nols)
shift
ls=
;;
-debug)
shift
redirect=
;;
-screen)
shift
DISPLAY=`echo $DISPLAY | sed 's/:\\([0-9][0-9]*\\)\\.[0-9]/:\1/'`.$1
shift
;;
*)
continue=false
;;
esac
done
case x$XAUTHORITY in
x)
;;
x*)
xauth="XAUTHORITY=$XAUTHORITY "
;;
esac
vars="$xpath$xauth"DISPLAY="$DISPLAY"
case $# in
0)
$rcmd 'sh -c '"'$vars"' xterm '$ls' -name "'"$resource"'" -T "'"$label"'" -n "'"$label"'" '"$redirect'"
;;
*)
$rcmd 'sh -c '"'$vars"' '"$*$redirect'"
;;
esac