Commit 097562b8 authored by Mike Gabriel's avatar Mike Gabriel

drop: nx-X11/config/util/ (not needed at build time).

parent a8dad09a
......@@ -7,7 +7,7 @@ XCOMM $XFree86: xc/config/Imakefile,v 1.3 2001/01/17 16:22:29 dawes Exp $
#define BootstrapCleanSubdirs BOOTSTRAPSUBDIRS="$(BOOTSTRAPSUBDIRS)"
BOOTSTRAPSUBDIRS = imake makedepend
SUBDIRS = cf $(BOOTSTRAPSUBDIRS) util
SUBDIRS = cf $(BOOTSTRAPSUBDIRS)
#if (defined(XFree86VersionString) || defined(XorgVersionString)) \
&& defined(ProjectRoot) && \
......
XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:41:52 cpqbld Exp $
XCOMM $XFree86: xc/config/util/Imakefile,v 3.49 2003/10/21 17:41:45 tsi Exp $
CCMDEP_PROG = ccmakedep
#ifdef ExportListGenSource
EXPORTLISTGEN = exportlistgen
#endif
#if defined(Win32Architecture) && !defined(CrossCompiling)
CMKDIRHIER = mkdirhier.exe
#endif
GCCMDEP_PROG = gccmakedep
#if HasSymLinks
#if CrossCompiling
LNDIR_PROG = HostProgramTargetName(lndir)
#else
LNDIR_PROG = ProgramTargetName(lndir)
#endif
#endif
#if CrossCompiling
MAKESTRS_PROG = HostProgramTargetName(makestrs)
REVPATH_PROG = HostProgramTargetName(revpath)
#else
MAKESTRS_PROG = ProgramTargetName(makestrs)
REVPATH_PROG = ProgramTargetName(revpath)
#endif
#if BuildRman
RMAN_PROG = HostProgramTargetName(rman)
#endif
PROGRAMS = $(RMAN_PROG) $(LNDIR_PROG) $(MAKESTRS_PROG) \
$(REVPATH_PROG) $(EXPORTLISTGEN) $(CMKDIRHIER)
DEPLIBS =
#ifndef Win32Architecture
EXTRA_LIBRARIES =
#endif
#ifdef LinuxArchitecture
PREPROCESSCMD_MKDEPEND = PreProcessCmd StandardCppDefines $(PROJECT_DEFINES)
#else
PREPROCESSCMD_MKDEPEND = $(PREPROCESSCMD)
#endif
XCOMM Some compilers generate fatal errors if an -L directory does
XCOMM not exist. Since BUILDLIBDIR may not exist yet suppress its use.
LDPRELIB =
LDPRELIBS =
#if CrossCompiling
LDPOSTLIBS =
LDPOSTLIB =
#endif
all:: xmkmf mergelib $(CCMDEP_PROG) $(GCCMDEP_PROG) $(PROGRAMS)
makedependonly:: $(CCMDEP_PROG) $(GCCMDEP_PROG)
#if HasGcc
GCCCMD = $(CC)
#else
GCCCMD = gcc
#endif
#if CrossCompiling
includes:: HostProgramTargetName(makestrs)
#else
includes:: ProgramTargetName(makestrs)
#endif
#ifdef ExportListGenSource
CppScriptTarget(exportlistgen,ExportListGenSource,-DCXXFILT=$(CXXFILT),)
InstallNamedProg(exportlistgen,exportlistgen,$(BINDIR))
#endif
CppScriptTarget(xmkmf,xmkmf.cpp,-DCONFIGDIRSPEC='"'"-I$(CONFIGDIR)"'"',$(ICONFIGFILES))
CppScriptTarget(ccmakedep,mdepend.cpp,-DPREPROC='"'"$(PREPROCESSCMD_MKDEPEND)"'"',$(ICONFIGFILES))
CppScriptTarget(mergelib,mergelib.cpp,"-DARCMD=$(AR)" "-DRANLIB=$(RANLIB)",$(ICONFIGFILES))
CppScriptTarget(gccmakedep,gccmdep.cpp,-DCCCMD='"'"$(GCCCMD)"'"' -DRMCMD='"'"$(RM)"'"' -DLNCMD='"'"$(LN)"'"' -DMVCMD='"'"$(MV)"'"',$(ICONFIGFILES))
#ifndef OpenBSDArchitecture
#if HasSymLinks
#if CrossCompiling
SimpleHostProgramTarget_2(lndir)
#else
AllTarget(lndir)
SimpleProgramTarget_2(lndir)
#endif
#endif
#endif
#if defined(Win32Architecture) && !defined(CrossCompiling)
AllTarget(ProgramTargetName(mkdirhier))
SimpleProgramTarget_3(mkdirhier)
#endif
#if CrossCompiling
AllTarget(HostProgramTargetName(makestrs))
SimpleHostProgramTarget_1(makestrs)
AllTarget(HostProgramTargetName(revpath))
SimpleHostProgramTarget_4(revpath)
#else
AllTarget(ProgramTargetName(makestrs))
SimpleProgramTarget_1(makestrs)
AllTarget(ProgramTargetName(revpath))
SimpleProgramTarget_4(revpath)
#endif
#if BuildRman
rmanonly:: $(RMAN_PROG)
VOLLIST="1:2:3:4:5:6:7:8:9:o:l:n:p"
MANTITLEPRINTF="%s(%s) manual page"
MANREFPRINTF="%s.%s.html"
RMANVERSION="3.0.8+X.Org"
#if CrossCompiling
AllTarget(HostProgramTargetName(rman))
SimpleHostProgramTarget_3(rman)
#else
AllTarget(ProgramTargetName(rman))
SimpleProgramTarget_5(rman)
#endif
SpecialCObjectRule(rman,NullParameter,-DVOLLIST='$(VOLLIST)' -DMANTITLEPRINTF='$(MANTITLEPRINTF)' -DMANREFPRINTF='$(MANREFPRINTF)' -DPOLYGLOTMANVERSION='$(RMANVERSION)' -DXOrg)
LinkSourceFile(rman.c,$(TOP)/extras/rman)
LinkFile(rman.man,$(TOP)/extras/rman/rman.1)
#endif
InstallManPage(xmkmf,$(MANDIR))
InstallNamedProg(xmkmf,xmkmf,$(BINDIR))
InstallNamedProg(mkdirhier.sh,mkdirhier,$(BINDIR))
InstallManPage(mkdirhier,$(MANDIR))
InstallNamedProg(gccmakedep,gccmakedep,$(BINDIR))
InstallManPage(gccmakedep,$(MANDIR))
#if defined(QNX4Architecture) || defined(NTOArchitecture)
InstallNamedProg(install.sh,install,$(BINDIR))
#endif
InstallDriverSDKNamedProg(mkdirhier.sh,mkdirhier.sh,$(DRIVERSDKDIR)/config/util)
InstallDriverSDKNamedProg(gccmakedep,gccmakedep,$(DRIVERSDKDIR)/config/util)
InstallNamedProg(mergelib,mergelib,$(BINDIR))
InstallManPage(mergelib,$(MANDIR))
InstallNamedProg(makeg.sh,makeg,$(BINDIR))
InstallManPage(makeg,$(MANDIR))
InstallNamedProg(cleanlinks.sh,cleanlinks,$(BINDIR))
InstallManPage(cleanlinks,$(MANDIR))
#if HasPerl
InstallNamedProg(mkhtmlindex.pl,mkhtmlindex,$(BINDIR))
#else
InstallNamedProg(mkhtmlindex.sh,mkhtmlindex,$(BINDIR))
#endif
InstallManPage(mkhtmlindex,$(MANDIR))
InstallNamedProg(ccmakedep,ccmakedep,$(BINDIR))
InstallManPage(ccmakedep,$(MANDIR))
InstallDriverSDKNamedProg(ccmakedep,ccmakedep,$(DRIVERSDKDIR)/config/util)
#if SystemV || SystemV4
InstallNamedProg(bsdinst.sh,bsdinst,$(BINDIR))
InstallDriverSDKNamedProg(bsdinst.sh,bsdinst.sh,$(DRIVERSDKDIR)/config/util)
#endif
InstallDriverSDKNamedProg(revpath,revpath,$(DRIVERSDKDIR)/config/util)
#ifdef OS2Architecture
InstallNamedProg(makedef.cmd,makedef.cmd,$(BINDIR))
#endif
#!/bin/sh
# $Xorg: aminstall.sh,v 1.3 2000/08/17 19:41:52 cpqbld Exp $
# aminstall - transfer cross-compiled files to system running Amoeba.
# Usage: aminstall binary-directory [-s stksz] unix-source amoeba-dest
#
# Default soap mask for files
#
SPMASK=0xFF:2:2
export SPMASK
PROG=$0
USAGE="Usage: $PROG binary-directory unix-source amoeba-dest"
#
# Argument check
#
case $# in
3|5) ;;
*) echo $USAGE >&2
exit 1
;;
esac
bindir=$1
stksz=
case $2 in
-s) if [ $# -ne 5 ]
then
echo $USAGE >&2
exit 1
fi
stksz="-s $3"
shift
shift
;;
esac
unxfile=$2
dest=$3
#
# Change /public .... into /super (just for installation)
#
stripped=`echo $dest | sed 's:^/public::'`
if [ X$dest != X$stripped ]; then
dest=/super$stripped
fi
#
# If the file already exists, then delete it
#
INFO=`$bindir/std_info $dest 2>&1`
case $INFO in
*"not found"*) ;;
*failed*) ;;
*bytes*) $bindir/del -f $dest
;;
/??????) echo $PROG: cannot install over directory 1>&2
exit
;;
*) $bindir/del -d $dest
;;
esac
#
# Transfer the file to Amoeba
#
$bindir/../bin.scripts/ainstall $stksz $unxfile $dest > /dev/null 2>&1
if [ $? -ne 0 ]
then
echo "This is not binary - using tob"
$bindir/tob $unxfile $dest
fi
#!/bin/sh
# $XFree86: xc/config/util/bsdinst.sh,v 3.3 1996/12/23 05:56:13 dawes Exp $
#
# This accepts bsd-style install arguments and makes the appropriate calls
# to the System V install.
# $Xorg: bsdinst.sh,v 1.3 2000/08/17 19:41:52 cpqbld Exp $
flags=""
dst=""
src=""
dostrip=""
owner=""
group=""
mode=""
bargs=$*
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 "
group="$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 "$0: no input file specified"
exit 1
fi
if [ x$dst = x ]
then
echo "$0: no destination specified"
exit 1
fi
if [ -x /usr/ucb/install ]
then
if [ -d "$dst" ]
then
dst=$dst/`basename "$src"`
fi
case "$group" in
"")
bargs="-g other $bargs"
;;
esac
/usr/ucb/install $bargs
if [ x$dostrip = xstrip -a -x /usr/bin/mcs ]
then
/usr/bin/mcs -d $dst
fi
exit 0
fi
case "$mode" in
"")
;;
*)
case "$owner" in
"")
flags="$flags -u root"
;;
esac
;;
esac
# 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" ] && [ "$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
if [ -x /usr/bin/mcs ]
then
/usr/bin/mcs -d $dst/$srcbase
fi
fi
if [ x$mode != x ]
then
chmod $mode $dst/$srcbase
fi
# and clean up
$rmcmd
make CC="gcc -D__UNIXOS2__" BOOTSTRAPCFLAGS=-Zexe World 2>&1 | tee World.log
.TH ccmakedep 1 __xorgversion__
.SH NAME
ccmakedep \- create dependencies in makefiles using a C compiler
.SH SYNOPSIS
.B ccmakedep
[
.BI cpp-flags
] [
.BI \-w width
] [
.BI \-s magic-string
] [
.BI \-f makefile
] [
.BI \-o object-suffix
] [
.B \-v
] [
.B \-a
] [
.BI \-cc compiler
] [
\-\^\-
.I options
\-\^\-
]
.I sourcefile
\^.\|.\|.
.SH DESCRIPTION
The
.B ccmakedep
program calls a C compiler to preprocess each
.IR sourcefile ,
and uses the output to construct
.I makefile
rules describing their dependencies.
These rules instruct
.BR make (1)
on which object files must be recompiled when a dependency has changed.
.PP
By default,
.B ccmakedep
places its output in the file named
.I makefile
if it exists, otherwise
.I Makefile.
An alternate makefile may be specified with the
.B \-f
option.
It first searches the makefile for a line beginning with
.sp
\& # DO NOT DELETE
.sp
or one provided with the
.B \-s
option, as a delimiter for the dependency output.
If it finds it, it will delete everything following this up to the end of
the makefile and put the output after this line.
If it doesn't find it, the program will append the string to the makefile
and place the output after that.
.SH EXAMPLE
Normally,
.B ccmakedep
will be used in a makefile target so that typing 'make depend' will bring
the dependencies up to date for the makefile.
For example,
.nf
SRCS\0=\0file1.c\0file2.c\0.\|.\|.
CFLAGS\0=\0\-O\0\-DHACK\0\-I\^.\^.\^/foobar\0\-xyz
depend:
ccmakedep\0\-\^\-\0$(CFLAGS)\0\-\^\-\0$(SRCS)
.fi
.SH OPTIONS
The program will ignore any option that it does not understand, so you may
use the same arguments that you would for
.BR cc (1),
including
.B \-D
and
.B \-U
options to define and undefine symbols and
.B \-I
to set the include path.
.TP
.B \-a
Append the dependencies to the file instead of replacing existing
dependencies.
.TP
.BI \-cc compiler
Use this compiler to generate dependencies.
.TP
.BI \-f makefile
Filename.
This allows you to specify an alternate makefile in which
.B ccmakedep
can place its output.
Specifying \(lq\-\(rq as the file name (that is,
.BR \-f\- )
sends the output to standard output instead of modifying an existing file.
.TP
.BI \-s string
Starting string delimiter.
This option permits you to specify a different string for
.B ccmakedep
to look for in the makefile.
The default is \(lq# DO NOT DELETE\(rq.
.TP
.BI \-v
Be verbose: display the C compiler command before running it.
.TP
.BI \-\^\- " options " \-\^\-
If
.B ccmakedep
encounters a double hyphen (\-\^\-) in the argument list, then any
unrecognized arguments following it will be silently ignored.
A second double hyphen terminates this special treatment.
In this way,
.B ccmakedep
can be made to safely ignore esoteric compiler arguments that might
normally be found in a CFLAGS
.B make
macro (see the
.B EXAMPLE
section above).
.BR \-D ,
.BR \-I ,
and
.B \-U
options appearing between the pair of double hyphens are still processed
normally.
.SH "SEE ALSO"
.BR cc (1),
.BR make (1),
.BR makedepend (1),
.BR ccmakedep (1).
.SH AUTHOR
.B ccmakedep
was written by the X Consortium.
.PP
Colin Watson wrote this manual page, originally for the Debian Project,
based partly on the manual page for
.BR makedepend (1).
/* $Xorg: checktree.c,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */
/*
Copyright (c) 1993, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/config/util/checktree.c,v 1.3 2001/07/29 05:01:10 tsi Exp $ */
#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 S_IFLNK
#define Stat lstat
#else
#define Stat stat
#endif
#define CHARSALLOWED \
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_."
#define fmode_bits_minset 0444
#define fmode_bits_maxset 0777
#define fmode_bits_write 0222
#define dmode_bits_minset 0775
int dorcs = 1; /* check RCS file */
int do83 = 1; /* check for 8+3 clash */
int doro = 1; /* disallow writable (checked out) files */
int dodot = 1; /* disallow .files */
int dotwiddle = 1; /* disallow file~ */
int dontcare(fn)
char *fn;
{
char *cp;
if (fn[strlen(fn) - 1] == '~')
return 1;
cp = strrchr(fn, '.');
return cp && (!strcmp(cp + 1, "Z") || !strcmp(cp + 1, "PS"));
}
checkfile(fullname, fn, fs)
char *fullname, *fn;
struct stat *fs;
{
char *cp;
int maxlen = 12;
int len, mode;
if (dodot && fn[0] == '.') {
printf("dot file: %s\n", fullname);
return;
}
for (len = 0, cp = fn; *cp; len++, cp++) {
if (!strchr(CHARSALLOWED, *cp)) {
if (dotwiddle || *cp != '~' || cp[1])
printf ("bad character: %s\n", fullname);
break;
}
}
if (len > maxlen && !dontcare(fn))
printf("too long (%d): %s\n", len, fullname);
#ifdef S_IFLNK
if ((fs->st_mode & S_IFLNK) == S_IFLNK) {
printf("symbolic link: %s\n", fullname);
return;
}
#endif
mode = fs->st_mode & (~S_IFMT);
if ((fs->st_mode & S_IFDIR) == S_IFDIR) {
maxlen = 14;
if ((mode & dmode_bits_minset) != dmode_bits_minset)
printf("directory mode 0%o not minimum 0%o: %s\n",
mode, dmode_bits_minset, fullname);
} else if ((fs->st_mode & S_IFREG) != S_IFREG)
printf("not a regular file: %s\n", fullname);
else {
if ((mode & fmode_bits_minset) != fmode_bits_minset)
printf("file mode 0%o not minimum 0%o: %s\n",
fs->st_mode, fmode_bits_minset, fullname);
if (fs->st_nlink != 1)
printf("%d links instead of 1: %s\n", fs->st_nlink, fullname);
if (doro && (mode & fmode_bits_write) && !dontcare(fn))
printf("writable: %s\n", fullname);
}
if ((mode & ~fmode_bits_maxset) != 0)
printf("mode 0%o outside maximum set 0%o: %s\n",
mode, fmode_bits_maxset, fullname);
}
void
checkrcs(dir, p)
char *dir;
char *p;
{
DIR *df;
struct dirent *dp;
struct stat fs;
int i;
if (!(df = opendir(dir))) {
fprintf(stderr, "cannot open: %s\n", dir);
return;
}
while (dp = readdir(df)) {
i = strlen(dp->d_name);
if (dp->d_name[i - 1] == 'v' && dp->d_name[i - 2] == ',') {
strcpy(p, dp->d_name);
p[i - 2] = '\0';
if (Stat(dir, &fs) < 0) {
strcpy(p, "RCS/");
strcat(p, dp->d_name);
printf("not used: %s\n", dir);
}
}
}
closedir(df);
}
int
Strncmp(cp1, cp2, n)
char *cp1, *cp2;
int n;
{
char c1, c2;
for (; --n >= 0 && *cp1 && *cp2; cp1++, cp2++) {
if (*cp1 != *cp2) {
c1 = *cp1;
c2 = *cp2;
if (c1 >= 'A' && c1 <= 'Z')
c1 += 'a' - 'A';
else if (c1 == '-')
c1 = '_';
if (c2 >= 'A' && c2 <= 'Z')
c2 += 'a' - 'A';
else if (c2 == '-')
c2 = '_';
if (c1 != c2)
return (int)c1 - (int)c2;
}
}
if (n < 0)
return 0;
return (int)*cp1 - (int)*cp2;
}
int
fncomp(n1, n2)
char **n1, **n2;
{
int i, res;
char *cp1, *cp2;
char c1, c2;
i = Strncmp(*n1, *n2, 8);
if (!i) {
cp1 = strrchr(*n1, '.');
cp2 = strrchr(*n2, '.');
if (cp1 || cp2) {
if (!cp1)
return -1;
if (!cp2)
return 1;
i = Strncmp(cp1 + 1, cp2 + 1, 3);
}
}
return i;
}
void
checkdir(dir)
char *dir;
{
DIR *df;
struct dirent *dp;
char *p;
struct stat fs;
char *s, **names;
int i, max;
if (!(df = opendir(dir))) {
fprintf(stderr, "cannot open: %s\n", dir);
return;
}
p = dir + strlen(dir);
if (p[-1] != '/')
*p++ = '/';
i = 0;
max = 0;
names = NULL;
while (dp = readdir(df)) {
strcpy(p, dp->d_name);
if (Stat(dir, &fs) < 0) {
perror(dir);
continue;
}
if ((fs.st_mode & S_IFDIR) == S_IFDIR) {
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")) {
if (dorcs)
checkrcs(dir, p);
continue;
}
if (!strcmp (dp->d_name, "SCCS"))
continue;
if (!strcmp (dp->d_name, "CVS.adm"))
continue;
checkfile(dir, p, &fs);
checkdir(dir);
continue;
}
checkfile(dir, p, &fs);
if (dorcs && !dontcare(dp->d_name)) {
strcpy(p, "RCS/");
strcat(p, dp->d_name);
strcat(p, ",v");
if (Stat(dir, &fs) < 0) {
strcpy(p, dp->d_name);
printf("no RCS: %s\n", dir);
}
}
if (do83) {
s = (char *)malloc(strlen(dp->d_name) + 1);
strcpy(s, dp->d_name);
if (i >= max) {
max += 25;
if (names)
names = (char **)realloc((char *)names,
(max + 1) * sizeof(char *));
else
names = (char **)malloc((max + 1) * sizeof(char *));
}
names[i++] = s;
}
}
closedir(df);
if (do83) {
qsort((char *)names, i, sizeof(char *), fncomp);
max = i - 1;
*p = '\0';
for (i = 0; i < max; i++) {
if (!fncomp(&names[i], &names[i + 1]))
printf("8+3 clash: %s%s and %s\n",
dir, names[i], names[i + 1]);
free(names[i]);
}
if (names) {
free(names[i]);
free((char *)names);
}
}
}
main(argc, argv)
int argc;
char **argv;
{
char buf[2048];
argc--;
argv++;
while (argc > 0) {
if (!strcmp(*argv, "-rcs")) {
dorcs = 0;
argc--;
argv++;
} else if (!strcmp(*argv, "-83")) {
do83 = 0;
argc--;
argv++;
} else if (!strcmp(*argv, "-ro")) {
doro = 0;
argc--;
argv++;
} else if (!strcmp(*argv, "-dot")) {
dodot = 0;
argc--;
argv++;
} else if (!strcmp(*argv, "-twiddle")) {
dotwiddle = 0;
argc--;
argv++;
} else
break;
}
if (!argc) {
strcpy(buf, ".");
checkdir(buf);
} else
while (--argc >= 0) {
strcpy(buf, *argv++);
checkdir(buf);
}
}
/* $Xorg: chownxterm.c,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */
/*
Copyright (c) 1993, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/*
* chownxterm --- make xterm suid root
*
* By Stephen Gildea, December 1993
*/
#define XTERM_PATH "/x11/programs/xterm/xterm"
#include <stdio.h>
#include <errno.h>
char *prog_name;
void help()
{
if (setgid(getgid()) == -1)
exit(1);
if (setuid(getuid()) == -1)
exit(1);
printf("chown-xterm makes %s suid root\n", XTERM_PATH);
printf("This is necessary on Ultrix for /dev/tty operation.\n");
exit(0);
}
void print_error(err_string)
char *err_string;
{
if (setgid(getgid()) == -1)
exit(1);
if (setuid(getuid()) == -1)
exit(1);
fprintf(stderr, "%s: \"%s\"", prog_name, err_string);
perror(" failed");
exit(1);
}
main(argc, argv)
int argc;
char **argv;
{
prog_name = argv[0];
if (argc >= 2 && strcmp(argv[1], "-help") == 0) {
help();
} else {
if (chown(XTERM_PATH, 0, -1) != 0)
print_error("chown root " XTERM_PATH);
if (chmod(XTERM_PATH, 04555) != 0)
print_error("chmod 4555 " XTERM_PATH);
}
exit(0);
}
.TH cleanlinks 1 __vendorversion__
.SH NAME
cleanlinks \- remove dangling symbolic links and empty directories
.SH SYNOPSIS
.B cleanlinks
.SH DESCRIPTION
The
.I cleanlinks
program searches the directory tree descended from the current directory for
symbolic links whose targets do not exist, and removes them.
It then removes all empty directories in that directory tree.
.PP
.I cleanlinks
is useful for cleaning up a shadow link tree created with
.BR lndir (1)
after files have been removed from the real directory.
.SH DIAGNOSTICS
A message will be printed upon encountering each dangling symlink and empty
directory.
.SH SEE ALSO
.BR lndir (1).
.SH AUTHOR
.PP
The version of the
.I cleanlinks
included in this X.Org Foundation release was originally written
by David Dawes wrote as a part of XFree86.
.PP
Colin Watson wrote this manual page, originally for the Debian Project.
#!/bin/sh
#
# Copyright © 2000, 2003 by The XFree86 Project, Inc
#
# Remove dangling symlinks and empty directories from a shadow link tree
# (created with lndir).
#
# Author: David Dawes <dawes@xfree86.org>
#
# $XFree86: xc/config/util/cleanlinks.sh,v 1.2 2003/04/15 03:05:16 dawes Exp $
find . -type l -print |
(
read i
while [ X"$i" != X ]; do
if [ ! -f "$i" ]; then
echo $i is a dangling symlink, removing
rm -f "$i"
fi
read i
done
)
echo Removing empty directories ...
#find . -type d -depth -print | xargs rmdir > /dev/null 2>&1
find . -type d -depth -empty -print -exec rmdir {} \;
exit 0
#!/bin/sh
lib=$1
shift
if cray2; then
bld cr $lib `lorder $* | tsort`
else
ar clq $lib $*
fi
XCOMM!/bin/sh
XCOMM $Xorg: elistgen.hp,v 1.3 2000/08/17 19:41:52 cpqbld Exp $
XCOMM
XCOMM #########################################################################
XCOMM Construct shared-library export lists for HP-UX based on standardized
XCOMM export list description file
XCOMM
XCOMM Usage: exportlistgen libfoo.sl libfoo.elist > libfoo.lopt
XCOMM
XCOMM libfoo.sl => shared library of interest
XCOMM libfoo.elist => Meta description of necessary export list.
XCOMM
XCOMM The output may then be passed to the linker to reconstruct the
XCOMM shared library. For unknown reasons naming only exported symbols
XCOMM with "+e" does not work for debuggable C++ code, even though "nm"
XCOMM reports no difference between the resulting libraries. The linker
XCOMM complains that "first non-inline virtual function" is not defined for
XCOMM vtables. We instead hide internal symbols with "-h" as a work-around.
XCOMM
XCOMM Author: Aloke Gupta 5/25/94.
XCOMM (c) Copyright 1996 Digital Equipment Corporation.
XCOMM (c) Copyright 1994,1996 Hewlett-Packard Company.
XCOMM (c) Copyright 1996 International Business Machines Corp.
XCOMM (c) Copyright 1996 Sun Microsystems, Inc.
XCOMM (c) Copyright 1996 Novell, Inc.
XCOMM (c) Copyright 1996 FUJITSU LIMITED.
XCOMM (c) Copyright 1996 Hitachi.
XCOMM
XCOMM #########################################################################
XCOMM Utility programs
FILTER=CXXFILT # C++ symbol demangler
AWK=awk # awk
PATH=/usr/bin:/bin:/usr/ucb # For nm, cat, pr, expand, awk, c++filt
XCOMM Temporary files
EXPORTLIST=/tmp/elistgen1.$$ # list of export symbols from "libfoo.elist"
NMLIST=/tmp/elistgen2.$$ # name list from libfoo.sl
FILTLIST=/tmp/elistgen3.$$ # demangled (C++) version of NMLIST
XCOMM Print useful information at the top of the output
echo "#" `date`
echo "# This linker options list was produced by" $0
echo "# Input export list description taken from:" $2
echo "# Target library:" $1
echo "# Target Operating System:" `uname -msrv`
echo "# "
XCOMM Extract the globally visible symbols from target library
XCOMM The NMLIST generated here is later used to cross-check the symbols in the
XCOMM supplied export-list.
XCOMM
nm -p $1 | $AWK '
/ [cCTDB][S ] [^\$]/{print $3} # Text, Data, BSS, or Secondary symbols
' > $NMLIST
XCOMM Demangle the global library symbols. This operation is necessary to
XCOMM convert mangled C++ symbols into their C++ notation.
${FILTER:-cat} $NMLIST > $FILTLIST
XCOMM
XCOMM Cleanup the export-list description file.
XCOMM Note that C++ symbols may have embedded spaces in them.
XCOMM
cat $2 | $AWK '
BEGIN {
csyms = 0; # C language symbols in libfoo.list
cplusplus = 0; # C++ language symbols in libfoo.list
isyms = 0; # C internal symbols in libfoo.elist
icplusplus = 0; # C++ internal symbols in libfoo.elist
implicit = ""; # Handling of implicit symbols.
}
$1 == "default" {
# A default clause suppresses warnings about implicit symbols.
if ($2 != "" && $2 != "force" && $2 != "public" &&
$2 != "private" && $2 != "internal") {
print "# Warning: illegal default clause:", $2 | "cat 1>&2";
next;
}
if (implicit != "")
print "# Warning: multiple default clauses." | "cat 1>&2";
implicit = $2;
next;
}
$1 == "force" || $1 == "public" || $1 == "private" {
csyms ++;
print $1 ";;" $2;
next;
}
$1 == "publicC++" || $1 == "privateC++" {
cplusplus ++;
string = $2;
for (n = 3; n <= NF; n++)
string = string " " $n;
print $1 ";;" string;
next;
}
$1 == "internal" {
isyms ++;
print $1 ";;" $2;
next;
}
$1 == "internalC++" {
icplusplus ++;
string = $2;
for (n = 3; n <= NF; n++)
string = string " " $n;
print $1 ";;" string;
next;
}
END {
printf("# Exporting %d C and %d C++ symbols, hiding %d and %d.\n",
csyms, cplusplus, isyms, icplusplus) | "cat 1>&2";
if (implicit != "") {
print "# Unspecified symbols are " implicit "." | "cat 1>&2";
print "default;;" implicit;
}
}
' > $EXPORTLIST
XCOMM Read in the above files and write result to stdout. The contents
XCOMM of NMLIST and FILTLIST are used to construct a symbol lookup table.
XCOMM The contents of EXPORTLIST are converted with the help of this table.
XCOMM Use ";" as a delimiter in the symbol lookup table.
XCOMM
(pr -m -s";" -t -w1024 $NMLIST $FILTLIST| expand -t 1;cat $EXPORTLIST ) | $AWK '
BEGIN {
FS = ";";
implicit = 0;
}
NF == 2 {
# This is "pr" output, i.e., symbol translation table.
syms[$2] = $1;
next;
}
NF == 3 && $1 == "default" {
# Treatment of unspecified symbols.
if ($3 == "internal" || $3 == "internalC++")
implicit = 1;
else if ($3 == "private" || $3 == "privateC++")
implicit = 2;
else if ($3 == "public" || $3 == "publicC++")
implicit = 3;
else # $3 == "force"
implicit = 4;
next;
}
NF == 3 {
# Parse our instructions for this symbol.
if ($1 == "internal" || $1 == "internalC++")
export = 1;
else if ($1 == "private" || $1 == "privateC++")
export = 2;
else if ($1 == "public" || $1 == "publicC++")
export = 3;
else # $1 == "force"
export = 4;
# Process it.
if (length(syms[$3]) > 0) {
if (donelist[$3])
print "# Warning: Duplicate entry for", $3,
"in export list" | "cat 1>&2";
if (donelist[$3] < export)
donelist[$3] = export;
} else {
if (export == 4)
donelist[$3] = export;
else
print "# Warning:", $3,
"was not in the nm list for this library" | "cat 1>&2";
}
next;
}
END {
# Force implicit exporting of errno.
if (! donelist["errno"])
donelist["errno"] = 4;
# Complain about some implicit symbols.
for (i in syms) {
if (!donelist[i] && (length(syms[i]) > 0)) {
# Ignore automatic symbols generated by the C++ compiler.
if (implicit == 0 &&
(syms[i] !~ /^__noperfopt__/) &&
(syms[i] !~ /^__ptbl_vec__/) &&
(syms[i] !~ /^__vtbl__[0-9]*_/) &&
(syms[i] !~ /^__cfront_version_[0-9]*_xxxxxxxx$/))
print "# Warning:", syms[i],
"was not in the export list" | "cat 1>&2";
donelist[i] = implicit;
}
if ((donelist[i] > 1) && (length(syms[i]) > 0))
print "-e", syms[i];
}
}
'
XCOMM Clean up temporary files
rm $EXPORTLIST
rm $NMLIST
rm $FILTLIST
XCOMM!/bin/sh
XCOMM $Xorg: elistgen.ibm,v 1.3 2000/08/17 19:41:52 cpqbld Exp $
XCOMM
XCOMM #########################################################################
XCOMM Construct shared-library export lists for IBM-AIX based on standardized
XCOMM export list description file
XCOMM
XCOMM Usage: elistgen libfoo.sl libfoo.elist > libfoo.lopt
XCOMM
XCOMM libfoo.a => shared library of interest
XCOMM libfoo.elist => Meta description of necessary export list.
XCOMM
XCOMM The output file, "libfoo.lopt" may then be passed to the IBM linker to
XCOMM reconstruct the shared library, libfoo.sl.
XCOMM
XCOMM Author: Yanling Qi 10/03/94, Last updated 10/03/94
XCOMM (c) Copyright 1996 Digital Equipment Corporation.
XCOMM (c) Copyright 1996 Hewlett-Packard Company.
XCOMM (c) Copyright 1994,1996 International Business Machines Corp.
XCOMM (c) Copyright 1996 Sun Microsystems, Inc.
XCOMM (c) Copyright 1996 Novell, Inc.
XCOMM (c) Copyright 1996 FUJITSU LIMITED.
XCOMM (c) Copyright 1996 Hitachi.
XCOMM
XCOMM #########################################################################
#define HASH #
XCOMM Utility programs
FILTER=CXXFILT # C++ symbol demangler
AWK=awk # awk
XCOMM For dump, cat, pr, expand, awk, c++filt
PATH=/usr/bin:/bin:/usr/ucb:/usr/lpp/xlC/bin
XCOMM Temporary files
EXPORTLIST=/tmp/elistgen1.$$ # export directives from "libfoo.list"
NMLIST=/tmp/elistgen2.$$ # name list from libfoo.sl
FILTLIST=/tmp/elistgen3.$$ # demangled (C++) version of above
XCOMM Print useful information
echo "*" `date`
echo "* This linker options list was produced by" $0
echo "* Input export list description taken from:" $2
echo "* Target library:" $1
echo "* Target Operating System:" `uname`
echo "*"
XCOMM Extract the globally visible symbols from target library
dump -g $1 | $AWK '$1 ~ /[0-9][0-9]/ && $2 !~ /^[\.]/ {print $2}' > $NMLIST
XCOMM Demangle the global library symbols
${FILTER:-cat} $NMLIST > $FILTLIST
XCOMM
XCOMM Clean up the export-list description file.
XCOMM Note that C++ symbols may have embedded spaces in them.
XCOMM
$AWK '
BEGIN {
csyms = 0; # C language symbols in libfoo.list
cplusplus = 0; # C++ language symbols in libfoo.list
isyms = 0; # C internal symbols in libfoo.list
iplusplus = 0; # C++ internal symbols in libfoo.list
count = 0; # Running count of symbols
implicit = ""; # Handling of implicit symbols.
}
$1 == "default" {
HASH A default clause suppresses warnings about implicit symbols.
if ($2 != "" && $2 != "force" && $2 != "public" &&
$2 != "private" && $2 != "internal") {
print "# Warning: illegal default clause:", $2 | "cat 1>&2";
next;
}
if (implicit != "")
print "# Warning: multiple default clauses." | "cat 1>&2";
implicit = $2;
next;
}
$1 == "force" || $1 == "public" || $1 == "private" {
csyms ++;
symbol[count++] = $1 ";;" $2;
next;
}
$1 == "publicC++" || $1 == "privateC++" {
HASH forceC++ is unsupported because we only know how to demangle,
HASH not how to mangle symbols, and the final ld input file must
HASH be mangled.
cplusplus ++;
string = $2;
for (n = 3; n <= NF; n++)
string = string " " $n;
symbol[count++] = $1 ";;" string;
next;
}
$1 == "internal" {
isyms ++;
symbol[count++] = $1 ";;" $2;
next;
}
$1 == "internalC++" {
iplusplus ++;
string = ";;" $2;
for (n = 3; n <= NF; n++)
string = string " " $n;
symbol[count++] = $1 ";;" string;
next;
}
$1 == "#line" || $1 == "#" {
HASH cpp will have removed comments, but may have added other stuff.
next;
}
NF > 0 {
print "# Warning: unrecognized directive:", $0 | "cat 1>&2";
next;
}
END {
printf("# Exporting %d C and %d C++ symbols, hiding %d and %d.\n",
csyms, cplusplus, isyms, iplusplus) | "cat 1>&2";
if (implicit != "") {
print "# Unspecified symbols are " implicit "." | "cat 1>&2";
print "default;;" implicit;
}
for (i in symbol)
print symbol[i];
}
' $2 > $EXPORTLIST
XCOMM
XCOMM Read in the above files and write result to stdout. Use the
XCOMM delimiter ";" to identify the entries in the symbol lookup table.
XCOMM
(pr -m -s";" -t -w1024 $NMLIST $FILTLIST | expand -t 1; cat $EXPORTLIST) | $AWK '
BEGIN {
FS = ";";
implicit = 0;
}
NF == 2 {
HASH This is "pr" output, i.e., symbol translation table
r2=$2
gsub(/ /,"",r2); # Remove spaces because c++filt is unpredictable
syms[r2] = $1;
r1=$1;
gsub(/ /,"",r1);
mangled[r1] = 1; # Save the mangling because the export lists
HASH sometimes use it instead of a prototype.
next;
}
NF == 3 && $1 == "default" {
HASH Treatment of unspecified symbols.
if ($3 == "internal")
implicit = 1;
else if ($3 == "private" || $3 == "privateC++")
implicit = 2;
else if ($3 == "public" || $3 == "publicC++")
implicit = 3;
else # $3 == "force"
implicit = 4;
next;
}
NF == 3 {
HASH Generate canonical demangled form as an alternate symbol.
alt=$3;
gsub(/ \.\.\./,",...",alt); # change " ..." to ",..." to match c++filt
gsub(/ /,"",alt); # remove all spaces
gsub(/\(void\)/,"()",alt); # change "(void)" to "()" to match c++filt
HASH Parse our instructions for this symbol.
if ($1 == "internal" || $1 == "internalC++")
export = 1;
else if ($1 == "private" || $1 == "privateC++")
export = 2;
else if ($1 == "public" || $1 == "publicC++")
export = 3;
else # $1 == "force"
export = 4;
HASH Process it.
if ((length(syms[alt]) > 0) || mangled[alt]) {
HASH This symbol is present in the library.
if (donelist[alt])
print "# Warning: Duplicate entry for", $3,
"in export list" | "cat 1>&2";
if (donelist[alt] < export) {
if (export > 1)
print syms[alt];
donelist[alt] = export;
}
} else {
HASH Print forced-export symbols without complaining.
if (export == 4) {
print alt;
donelist[alt] = export;
} else {
print "# Warning:", $3,
"was not in the nm list for this library" | "cat 1>&2";
}
}
next;
}
END {
HASH Process implicit symbols.
for (i in syms) {
if ((! donelist[i]) && (length(syms[i]) > 0)) {
HASH Do not complain about C++ virtual function tables.
if (implicit == 0 && syms[i] !~ /^__vft[0-9]*_/)
print "# Warning:", syms[i],
"was not in the export list" | "cat 1>&2";
if (implicit > 1)
print syms[i];
}
}
}
'
XCOMM Clean up temporary files
rm $EXPORTLIST
rm $NMLIST
rm $FILTLIST
XCOMM!/bin/sh -f
XCOMM $Xorg: elistgen.sun,v 1.3 2000/08/17 19:41:52 cpqbld Exp $
XCOMM
XCOMM ########################################################################
XCOMM Construct shared-library scoping mapfile for Solaris based on standardized
XCOMM export list description file
XCOMM
XCOMM Usage: exportlistgen libfoo.so libfoo.elist > mapfile.scope
XCOMM
XCOMM libfoo.so => shared library of interest
XCOMM libfoo.elist => Meta description of necessary export list.
XCOMM
XCOMM The output file, "mapfile.scope" may then be passed to the Solaris
XCOMM linker to reconstruct the shared library, libfoo.so.
XCOMM
XCOMM ########################################################################
XCOMM
XCOMM $XFree86: xc/config/util/elistgen.sun,v 1.7 2001/01/17 16:39:01 dawes Exp $
XCOMM Utility programs
FILTER=CXXFILT # C++ symbol demangler
AWK=nawk # Awk
XCOMM For nm, cat, pr, sed, awk, c++filt
PATH=/usr/bin:/bin:/usr/ccs/bin:/usr/ucb:$PATH
XCOMM Try to detect broken versions of c++filt.
if [ `echo _okay | ${FILTER:-cat}` != "_okay" ]; then
if [ -x /opt/SUNWspro/bin/c++filt ]; then
echo "# Your $FILTER is broken -- using /opt/SUNWspro/bin/c++filt."
FILTER=/opt/SUNWspro/bin/c++filt
else
echo "# ERROR: no working $FILTER available."
exit 1
fi;
fi;
XCOMM Temporary files
EXPORTLIST=/tmp/elistgen1.$$ # export directives from "libfoo.list"
NMLIST=/tmp/elistgen2.$$ # name list from libfoo.sl
FILTLIST=/tmp/elistgen3.$$ # demangled (C++) version of above
XCOMM Print useful information at the top of the output
echo "#" `date`
echo "# This scoping mapfile was produced by" $0
echo "# Export list description taken from:" $2
echo "# Target library:" $1
echo "# Target Operating System:" `uname -msrv`
echo "# "
XCOMM Extract the globally visible symbols from target library
XCOMM The NMLIST generated here is later used to cross-check the symbols in the
XCOMM nm stopped working on Solaris 2.5, use dump instead.
nm -p $1 | $AWK '/ [ TDBS] /{print $3}' > $NMLIST
XCOMM /usr/ccs/bin/dump -t -v $1 | $AWK '/(FUNC|OBJT).(GLOB|WEAK)/{print $8}' > $NMLIST
XCOMM Extract the globally visible symbols from target library
XCOMM The NMLIST generated here is later used to cross-check the symbols in the
${FILTER:-cat} < $NMLIST > $FILTLIST
XCOMM Clean up the export-list description file. Sort the directives.
$AWK '
BEGIN {
csyms = 0; # C public symbols in libfoo.list
cplusplus = 0; # C++ public symbols in libfoo.list
isyms = 0; # C internal symbols in libfoo.list
iplusplus = 0; # C++ internal symbols in libfoo.list
implicit = ""; # Handling of implicit symbols
}
$1 == "default" {
# A default clause suppresses warnings about implicit symbols.
if ($2 != "" && $2 != "force" && $2 != "public" && $2 != "private" && $2 != "internal") {
print "# Warning: illegal default clause:", $2 | "cat 1>&2";
next;
}
if (implicit != "")
print "# Warning: multiple default clauses." | "cat 1>&2";
implicit = $2;
next;
}
$1 == "force" {
csyms ++;
print $1 ";;" $2;
next;
}
$1 == "public" {
csyms ++;
print $1 ";;" $2;
next;
}
$1 == "publicC++" {
cplusplus ++;
string = $2;
for (n = 3; n <= NF; n++)
string = string " " $n;
print $1 ";;" string;
next;
}
$1 == "private" {
csyms ++;
print $1 ";;" $2;
next;
}
$1 == "privateC++" {
cplusplus ++;
string = $2;
for (n = 3; n <= NF; n++)
string = string " " $n;
print $1 ";;" string;
next;
}
$1 == "internal" {
isyms ++;
print $1 ";;" $2;
next;
}
$1 == "internalC++" {
iplusplus ++;
string = $2;
for (n = 3; n <= NF; n++)
string = string " " $n;
print $1 ";;" string;
next;
}
$1 == "#line" || $1 == "#" {
# cpp will have removed comments, but may have added other stuff.
next;
}
NF > 0 {
print "# Warning: unrecognized directive:", $0 | "cat 1>&2";
next;
}
END {
printf("# Exporting %d C and %d C++ symbols, hiding %d and %d.\n", csyms, cplusplus, isyms, iplusplus) | "cat 1>&2";
if (implicit != "") {
print "# Unspecified symbols are " implicit "." | "cat 1>&2";
print "default;;" implicit;
}
}
' $2 1>$EXPORTLIST
XCOMM Read in the above files and write result to stdout. The contents
XCOMM of NMLIST and FILTLIST are used to construct a symbol lookup table.
XCOMM The contents of EXPORTLIST are converted with the help of this table.
XCOMM Use ";" as a delimiter in the symbol lookup table.
(pr -m -s";" -t -w1024 $NMLIST $FILTLIST | sed 's/ / /g'; cat $EXPORTLIST) | $AWK '
BEGIN {
FS = ";";
implicit = 0;
}
NF == 2 {
# This is "pr" output, i.e., symbol translation table
r2=$2;
gsub(/static /,"",r2); # remove keyword "static" as above
gsub(/ /,"",r2); # Remove spaces because c++filt is unpredictable
syms[r2] = $1;
r1=$1;
gsub(/ /,"",r1);
mangled[r1] = 1; # Save the mangling because the export lists
# sometimes use it instead of a prototype.
next;
}
NF == 3 && $1 == "default" {
# Treatment of unspecified symbols.
if ($3 == "internal" || $3 == "internalC++")
implicit = 1;
else if ($3 == "private" || $3 == "privateC++")
implicit = 2;
else if ($3 == "public" || $3 == "publicC++")
implicit = 3;
else # $3 == "force"
implicit = 4;
next;
}
NF == 3 {
# Generate canonical demangled form as an alternate symbol.
alt=$3;
gsub(/ \.\.\./,",...",alt); # change " ..." to ",..." to match c++filt
gsub(/ /,"",alt); # remove all spaces
# An export directive. Parse our instructions for this symbol.
if ($1 == "internal" || $1 == "internalC++")
export = 1;
else if ($3 == "private" || $3 == "privateC++")
export = 2;
else if ($3 == "public" || $3 == "publicC++")
export = 3;
else # $3 == "force"
export = 4;
# Process it.
if ((length(syms[alt]) > 0) || mangled[alt]) {
# This symbol is present in the library.
if (donelist[alt])
print "# Warning: Duplicate entry for", $3,
"in export list" | "cat 1>&2";
if (donelist[alt] < export) {
donelist[alt] = export;
}
} else {
# Print forced-export symbols without complaining.
if (export == 4) {
donelist[alt] = export;
} else {
print "# Warning:", $3,
"was not in the nm list for this library" | "cat 1>&2";
}
}
next;
}
END {
# Ignore magic linker symbols.
if (implicit == 0) {
if (!donelist["_DYNAMIC"])
donelist["_DYNAMIC"] = 1;
if (!donelist["_GLOBAL_OFFSET_TABLE_"])
donelist["_GLOBAL_OFFSET_TABLE_"] = 1;
if (!donelist["_PROCEDURE_LINKAGE_TABLE_"])
donelist["_PROCEDURE_LINKAGE_TABLE_"] = 1;
if (!donelist["_edata"])
donelist["_edata"] = 1;
if (!donelist["_end"])
donelist["_end"] = 1;
if (!donelist["_etext"])
donelist["_etext"] = 1;
}
# Process implicit symbols.
for (i in syms) {
if (donelist[i] == 0 && length(syms[i]) > 0) {
if (implicit == 0) {
# Ignore magic symbols introduced by the C++ compiler.
if ((syms[i] !~ /^__vtbl__[0-9]*_/) && (syms[i] !~ /^__ptbl_vec__/))
print "# Warning:", syms[i], "was not in the export list" | "cat 1>&2";
} else {
donelist[i] = implicit;
}
}
}
# Generate the linker file.
print "";
print "SUNW.1.1 {";
print " global:";
for (i in syms)
if (donelist[i] >= 2 && length(syms[i]) > 0)
print " " syms[i] ";";
print " local:";
print " *;";
print "};";
print "";
print "SUNW_private.1.1 {";
print " global:";
for (i in syms)
if (donelist[i] == 1 && length(syms[i]) > 0)
print " " syms[i] ";";
print "} SUNW.1.1;"
}
'
XCOMM Clean up temporary files
rm $EXPORTLIST
rm $NMLIST
rm $FILTLIST
XCOMM!/bin/sh
XCOMM $Xorg: elistgen.usl,v 1.3 2000/08/17 19:41:52 cpqbld Exp $
XCOMM
XCOMM #########################################################################
XCOMM Construct shared-library export lists for Novell based on standardized
XCOMM export list description file
XCOMM
XCOMM Usage: exportlistgen libFoo.so libFoo.elist > libFoo.lopt
XCOMM
XCOMM libFoo.so => shared library of interest
XCOMM libFoo.elist => Meta description of necessary export list.
XCOMM
XCOMM The output file, "libFoo.lopt" may then be passed to the linker to
XCOMM reconstruct the shared library.
XCOMM
XCOMM (c) Copyright 1996 Digital Equipment Corporation.
XCOMM (c) Copyright 1996 Hewlett-Packard Company.
XCOMM (c) Copyright 1996 International Business Machines Corp.
XCOMM (c) Copyright 1996 Sun Microsystems, Inc.
XCOMM (c) Copyright 1996 Novell, Inc.
XCOMM (c) Copyright 1996 FUJITSU LIMITED.
XCOMM (c) Copyright 1996 Hitachi.
XCOMM
XCOMM #########################################################################
XCOMM
XCOMM $XFree86$
XCOMM Utility programs
FILTER=CXXFILT # C++ symbol demangler
AWK=awk # awk
XCOMM For nm, cat, pr, sed, awk, c++filt
PATH=/usr/bin:/bin:/usr/ucb:/usr/ccs/bin
XCOMM Temporary files
EXPORTLIST=/tmp/elistgen1.$$ # list of export symbols from "libfoo.elist"
NMLIST=/tmp/elistgen2.$$ # name list from libfoo.sl
FILTLIST=/tmp/elistgen3.$$ # demangled (C++) version of NMLIST
XCOMM Print useful information at the top of the output
echo "#" `date`
echo "# This linker options list was produced by" $0
echo "# Input export list description taken from:" $2
echo "# Target library:" $1
echo "# Target Operating System:" `uname -msrv`
echo "# "
XCOMM Extract the globally visible symbols from target library.
XCOMM The NMLIST generated here is later used to cross-check the symbols in the
XCOMM supplied export-list.
nm -p $1 | $AWK '
/ [TD] [^\$]/{print $3} # Text, Data, BSS, or Secondary symbols
' > $NMLIST
XCOMM Demangle the global library symbols. This operation is necessary to convert
XCOMM mangled C++ symbols into their C++ notation.
${FILTER:-cat} $NMLIST > $FILTLIST
XCOMM Clean up the export-list description file.
XCOMM Note that C++ symbols may have embedded spaces in them.
cat $2 | $AWK '
BEGIN {
csyms = 0; # C language symbols in libfoo.list
cplusplus = 0; # C++ language symbols in libfoo.list
isyms = 0; # C internal symbols in libfoo.elist
iplusplus = 0; # C++ internal symbols in libfoo.elist
implicit = ""; # Handling of implicit symbols
}
$1 == "default" {
# A default clause suppresses warnings about implicit symbols.
if ($2 != "" && $2 != "force" && $2 != "public" &&
$2 != "private" && $2 != "internal") {
print "# Warning: illegal default clause:", $2 | "cat 1>&2";
next;
}
if (implicit != "")
print "# Warning: multiple default clauses." | "cat 1>&2";
implicit = $2;
next;
}
$1 == "force" || $1 == "public" || $1 == "private" {
csyms ++;
print $1 ";;" $2;
next;
}
$1 == "publicC++" || $1 == "privateC++" {
cplusplus ++;
string = $2;
for (n = 3; n <= NF; n++) {
string = string " " $n;
}
print $1 ";;" string;
next;
}
$1 == "internal" {
isyms ++;
print $1 ";;" $2;
next;
}
$1 == "internalC++" {
iplusplus ++;
string = $2;
for (n = 3; n <= NF; n++) {
string = string " " $n;
}
print $1 ";;" string;
next;
}
$1 == "#line" || $1 == "#" {
# cpp will have removed comments, but may have added other stuff.
next;
}
NF > 0 {
print "# Warning: unrecognized directive:", $0 | "cat 1>&2";
next;
}
END {
printf("# Exporting %d C and %d C++ symbols, hiding %d and %d.\n",
csyms, cplusplus, isyms, iplusplus) | "cat 1>&2";
if (implicit != "") {
print "# Unspecified symbols are " implicit "." | "cat 1>&2";
print "default;;" implicit;
}
}
' > $EXPORTLIST
XCOMM Read in the above files and write result to stdout. The contents
XCOMM of NMLIST and FILTLIST are used to construct a symbol lookup table.
XCOMM The contents of EXPORTLIST are converted with the help of this table.
XCOMM Use ";" as a delimiter in the symbol lookup table.
(pr -m -s";" -t -w1024 $NMLIST $FILTLIST | sed 's/ / /g'; cat $EXPORTLIST) | $AWK '
BEGIN {
FS = ";";
implicit = 0;
}
NF == 2 {
# This is "pr" output, i.e., symbol translation table
syms[$2] = $1;
next;
}
NF == 3 && $1 == "default" {
# Treatment of unspecified symbols.
if ($3 == "internal")
implicit = 1;
else if ($3 == "private" || $3 == "privateC++")
implicit = 2;
else if ($3 == "public" || $3 == "publicC++")
implicit = 3;
else # $3 == "force"
implicit = 4;
next;
}
NF == 3 {
# Parse our instructions for this symbol.
if ($1 == "internal" || $1 == "internalC++")
export = 1;
else if ($1 == "private" || $1 == "privateC++")
export = 2;
else if ($1 == "public" || $1 == "publicC++")
export = 3;
else # $1 == "force"
export = 4;
# Process it.
if (length(syms[$3]) > 0) {
# This symbol is present in the library.
if (donelist[$3])
print "# Warning: Duplicate entry for", $3,
"in export list" | "cat 1>&2";
if (donelist[$3] < export) {
if (export > 1)
print syms[$3];
donelist[$3] = export;
}
} else {
# Do not complain about unknown forced-export symbols.
if (export == 4) {
print $3;
donelist[$3] = export;
} else
print "# Warning:", $3,
"was not in the nm list for this library" | "cat 1>&2";
}
next;
}
END {
# Ignore built-in linker symbols.
if (implicit == 0) {
if (!donelist["_DYNAMIC"])
donelist["_DYNAMIC"] = 1;
if (!donelist["_GLOBAL_OFFSET_TABLE_"])
donelist["_GLOBAL_OFFSET_TABLE_"] = 1;
if (!donelist["_edata"])
donelist["_edata"] = 1;
if (!donelist["_end"])
donelist["_end"] = 1;
if (!donelist["_etext"])
donelist["_etext"] = 1;
}
# Process implicit symbols.
for (i in syms) {
if (!donelist[i] && (length(syms[i]) > 0)) {
# Ignore C++ compiler symbols
if (implicit == 0 &&
(syms[i] !~ /^__vtbl__[0-9]*_/) &&
(syms[i] !~ /^__cpp_unixware_[0-9]*$/))
print "# Warning:", syms[i],
"was not in the export list" | "cat 1>&2";
if (implicit > 1)
print syms[i];
}
}
}
'
XCOMM Clean up temporary files
rm $EXPORTLIST
rm $NMLIST
rm $FILTLIST
.TH gccmakedep 1 __vendorversion__
.SH NAME
gccmakedep \- create dependencies in makefiles using 'gcc -M'
.SH SYNOPSIS
.B gccmakedep
[
.BI \-s separator
] [
.BI \-f makefile
] [
.BI \-a
] [
\-\^\-
.I options
\-\^\-
]
.I sourcefile
\&.\|.\|.
.SH DESCRIPTION
The
.B gccmakedep
program calls 'gcc -M' to output
.I makefile
rules describing the dependencies of each
.IR sourcefile ,
so that
.BR make (1)
knows which object files must be recompiled when a dependency has changed.
.PP
By default,
.B gccmakedep
places its output in the file named
.I makefile
if it exists, otherwise
.I Makefile.
An alternate makefile may be specified with the
.B \-f
option.
It first searches the makefile for a line beginning with
.sp
\& # DO NOT DELETE
.sp
or one provided with the
.B \-s
option, as a delimiter for the dependency output.
If it finds it, it will delete everything following this up to the end of
the makefile and put the output after this line.
If it doesn't find it, the program will append the string to the makefile
and place the output after that.
.SH EXAMPLE
Normally,
.B gccmakedep
will be used in a makefile target so that typing 'make depend' will bring
the dependencies up to date for the makefile.
For example,
.nf
SRCS\0=\0file1.c\0file2.c\0.\|.\|.
CFLAGS\0=\0\-O\0\-DHACK\0\-I\^.\^.\^/foobar\0\-xyz
depend:
gccmakedep\0\-\^\-\0$(CFLAGS)\0\-\^\-\0$(SRCS)
.fi
.SH OPTIONS
The program will ignore any option that it does not understand, so you may
use the same arguments that you would for
.BR gcc (1),
including
.B \-D
and
.B \-U
options to define and undefine symbols and
.B \-I
to set the include path.
.TP
.B \-a
Append the dependencies to the file instead of replacing existing
dependencies.
.TP
.BI \-f makefile
Filename.
This allows you to specify an alternate makefile in which
.B gccmakedep
can place its output.
Specifying \(lq\-\(rq as the file name (that is,
.BR \-f\- )
sends the output to standard output instead of modifying an existing file.
.TP
.BI \-s string
Starting string delimiter.
This option permits you to specify a different string for
.B gccmakedep
to look for in the makefile.
The default is \(lq# DO NOT DELETE\(rq.
.TP
.BI \-\^\- " options " \-\^\-
If
.B gccmakedep
encounters a double hyphen (\-\^\-) in the argument list, then any
unrecognized arguments following it will be silently ignored.
A second double hyphen terminates this special treatment.
In this way,
.B gccmakedep
can be made to safely ignore esoteric compiler arguments that might
normally be found in a CFLAGS
.B make
macro (see the
.B EXAMPLE
section above).
.BR \-D ,
.BR \-I ,
and
.B \-U
options appearing between the pair of double hyphens are still processed
normally.
.SH "SEE ALSO"
.BR gcc (1),
.BR make (1),
.BR makedepend (1).
.SH AUTHOR
The version of the
.B gccmakedep
included in this X.Org Foundation release was originally
written by the XFree86 Project based on code supplied by Hongjiu Lu.
.PP
Colin Watson wrote this manual page, originally for the Debian Project,
based partly on the manual page for
.BR makedepend (1).
XCOMM!/bin/sh
XCOMM
XCOMM makedepend which uses 'gcc -M'
XCOMM
XCOMM $XFree86: xc/config/util/gccmdep.cpp,v 3.10tsi Exp $
XCOMM
XCOMM Based on mdepend.cpp and code supplied by Hongjiu Lu <hjl@nynexst.com>
XCOMM
TMP=mdep$$.tmp
CC=CCCMD
RM=RMCMD
LN=LNCMD
MV=MVCMD
${RM} ${TMP}
trap "${RM} ${TMP}*; exit 1" 1 2 15
trap "${RM} ${TMP}*; exit 0" 1 2 13
files=
makefile=
endmarker=
magic_string='# DO NOT DELETE'
append=n
args=
while [ $# != 0 ]; do
if [ "$endmarker"x != x -a "$endmarker" = "$1" ]; then
endmarker=
else
case "$1" in
-D*|-I*|-U*)
args="$args '$1'"
;;
-g*|-O*)
;;
*)
if [ "$endmarker"x = x ]; then
case $1 in
XCOMM ignore these flags
-w|-o|-cc)
shift
;;
-v)
;;
-s)
magic_string="$2"
shift
;;
-f*)
if [ "$1" = "-f-" ]; then
makefile="-"
elif [ "$1" = "-f" ]; then
makefile="$2"
shift
else
echo "$1" | sed 's/^\-f//' >${TMP}arg
makefile="`cat ${TMP}arg`"
rm -f ${TMP}arg
fi
;;
--*)
endmarker=`echo $1 | sed 's/^\-\-//'`
if [ "$endmarker"x = x ]; then
endmarker="--"
fi
;;
-a)
append=y
;;
-*)
echo "Unknown option '$1' ignored" 1>&2
;;
*)
files="$files $1"
;;
esac
fi
;;
esac
fi
shift
done
if [ x"$files" = x ]; then
XCOMM Nothing to do
exit 0
fi
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
;;
esac
if [ X"$makefile" != X- ]; then
if [ x"$append" = xn ]; then
sed -e "/^$magic_string/,\$d" < $makefile > $TMP
echo "$magic_string" >> $TMP
else
cp $makefile $TMP
fi
fi
CMD="$CC -M $args $files"
if [ X"$makefile" != X- ]; then
CMD="$CMD >> $TMP"
fi
eval $CMD
if [ X"$makefile" != X- ]; then
$RM ${makefile}.bak
$MV $makefile ${makefile}.bak
$MV $TMP $makefile
fi
$RM ${TMP}*
exit 0
/* OS/2 rexx script to emulate the "cd dir; command" mechanism in make
* which does not work with stupid CMD.EXE
*
* $XFree86: xc/config/util/indir.cmd,v 3.1 1996/01/24 21:56:12 dawes Exp $
*/
curdir = directory()
line = fixbadprefix(ARG(1))
w1 = TRANSLATE(WORD(line,1),'\','/')
new = directory(w1)
/*IF (SUBSTR(w1,1,2) = '..') | (POS(w1,new) > 0) THEN DO*/
subword(line,2)
old = directory(curdir)
/*END
ELSE DO
say 'Directory 'new' does not exist, ignoring command (nonfatal)'
END*/
EXIT
/* somehow make or cmd manages to convert a relative path ..\..\. to ..... */
fixbadprefix:
count = 1
str = ARG(1)
DO WHILE SUBSTR(str,count,3) = '...'
count = count+1
str = INSERT('\',str,count)
count = count+2
END
RETURN str
#!/bin/sh
#
# install - install a program, script, or datafile
#
# $Xorg: install.sh,v 1.3 2000/08/17 19:41:52 cpqbld 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
/* $Xorg: lndir.c,v 1.5 2001/02/09 02:03:17 xorgcvs Exp $ */
/* Create shadow link tree (after X11R4 script of the same name)
Mark Reinhold (mbr@lcs.mit.edu)/3 January 1990 */
/*
Copyright (c) 1990, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/config/util/lndir.c,v 3.18 2003/06/24 15:44:45 eich Exp $ */
/* From the original /bin/sh script:
Used to create a copy of the a directory tree that has links for all
non-directories (except, by default, those named BitKeeper, RCS, SCCS
or CVS.adm). If you are building the distribution on more than one
machine, you should use this technique.
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 <X11/Xfuncproto.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#if !defined(MINIX) && !defined(Lynx)
#include <sys/param.h>
#endif
#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
#ifndef MAXPATHLEN
#define MAXPATHLEN 2048
#endif
#include <stdarg.h>
int silent = 0; /* -silent */
int ignore_links = 0; /* -ignorelinks */
int with_revinfo = 0; /* -withrevinfo */
char *rcurdir;
char *curdir;
static void
quit (int code, char * fmt, ...)
{
va_list args;
va_start(args, fmt);
vfprintf (stderr, fmt, args);
va_end(args);
putc ('\n', stderr);
exit (code);
}
static void
quiterr (int code, char *s)
{
perror (s);
exit (code);
}
static void
msg (char * fmt, ...)
{
va_list args;
if (curdir) {
fprintf (stderr, "%s:\n", curdir);
curdir = 0;
}
va_start(args, fmt);
vfprintf (stderr, fmt, args);
va_end(args);
putc ('\n', stderr);
}
static void
mperror (char *s)
{
if (curdir) {
fprintf (stderr, "%s:\n", curdir);
curdir = 0;
}
perror (s);
}
static int
equivalent(char *lname, char *rname, char **p)
{
char *s;
if (!strcmp(lname, rname))
return 1;
for (s = lname; *s && (s = strchr(s, '/')); s++) {
while (s[1] == '/') {
strcpy(s+1, s+2);
if (*p) (*p)--;
}
}
return !strcmp(lname, rname);
}
/* Recursively create symbolic links from the current directory to the "from"
directory. Assumes that files described by fs and ts are directories. */
static int
dodir (char *fn, /* name of "from" directory, either absolute or
relative to cwd */
struct stat *fs,
struct stat *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];
char basesym[MAXPATHLEN + 1];
struct stat sb, sc;
int n_dirs;
int symlen;
int basesymlen = -1;
char *ocurdir;
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);
if (*(p - 1) != '/')
*p++ = '/';
n_dirs = fs->st_nlink;
while ((dp = readdir (df))) {
if (dp->d_name[strlen(dp->d_name) - 1] == '~')
continue;
#ifdef __DARWIN__
/* Ignore these Mac OS X Finder data files */
if (!strcmp(dp->d_name, ".DS_Store") ||
!strcmp(dp->d_name, "._.DS_Store"))
continue;
#endif
strcpy (p, dp->d_name);
if (n_dirs > 0) {
if (lstat (buf, &sb) < 0) {
mperror (buf);
continue;
}
#ifdef S_ISDIR
if(S_ISDIR(sb.st_mode))
#else
if ((sb.st_mode & S_IFMT) == S_IFDIR)
#endif
{
/* directory */
n_dirs--;
if (dp->d_name[0] == '.' &&
(dp->d_name[1] == '\0' || (dp->d_name[1] == '.' &&
dp->d_name[2] == '\0')))
continue;
if (!with_revinfo) {
if (!strcmp (dp->d_name, "BitKeeper"))
continue;
if (!strcmp (dp->d_name, "RCS"))
continue;
if (!strcmp (dp->d_name, "SCCS"))
continue;
if (!strcmp (dp->d_name, "CVS"))
continue;
if (!strcmp (dp->d_name, "CVS.adm"))
continue;
if (!strcmp (dp->d_name, ".svn"))
continue;
}
ocurdir = rcurdir;
rcurdir = buf;
curdir = silent ? buf : (char *)0;
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) {
mperror (dp->d_name);
curdir = rcurdir = ocurdir;
continue;
}
}
if (readlink (dp->d_name, symbuf, sizeof(symbuf) - 1) >= 0) {
msg ("%s: is a link instead of a directory", dp->d_name);
curdir = rcurdir = ocurdir;
continue;
}
if (chdir (dp->d_name) < 0) {
mperror (dp->d_name);
curdir = rcurdir = ocurdir;
continue;
}
dodir (buf, &sb, &sc, (buf[0] != '/'));
if (chdir ("..") < 0)
quiterr (1, "..");
curdir = rcurdir = ocurdir;
continue;
}
}
/* non-directory */
symlen = readlink (dp->d_name, symbuf, sizeof(symbuf) - 1);
if (symlen >= 0)
symbuf[symlen] = '\0';
/* The option to ignore links exists mostly because
checking for them slows us down by 10-20%.
But it is off by default because this really is a useful check. */
if (!ignore_links) {
/* see if the file in the base tree was a symlink */
basesymlen = readlink(buf, basesym, sizeof(basesym) - 1);
if (basesymlen >= 0)
basesym[basesymlen] = '\0';
}
if (symlen >= 0) {
/* Link exists in new tree. Print message if it doesn't match. */
if (!equivalent (basesymlen>=0 ? basesym : buf, symbuf,
basesymlen>=0 ? (char **) 0 : &p))
msg ("%s: %s", dp->d_name, symbuf);
} else {
char *sympath;
if (basesymlen>=0) {
if ((buf[0] == '.') && (buf[1] == '.') && (buf[2] == '/') &&
(basesym[0] == '.') && (basesym[1] == '.') &&
(basesym[2] == '/')) {
/* It becomes very tricky here. We have
../../bar/foo symlinked to ../xxx/yyy. We
can't just use ../xxx/yyy. We have to use
../../bar/foo/../xxx/yyy. */
int i;
char *start, *end;
strcpy (symbuf, buf);
/* Find the first char after "../" in symbuf. */
start = symbuf;
do {
start += 3;
} while ((start[0] == '.') && (start[1] == '.') &&
(start[2] == '/'));
/* Then try to eliminate "../"s in basesym. */
i = 0;
end = strrchr (symbuf, '/');
if (start < end) {
do {
i += 3;
end--;
while ((*end != '/') && (end != start))
end--;
if (end == start)
break;
} while ((basesym[i] == '.') &&
(basesym[i + 1] == '.') &&
(basesym[i + 2] == '/'));
}
if (*end == '/')
end++;
strcpy (end, &basesym[i]);
sympath = symbuf;
}
else
sympath = basesym;
}
else
sympath = buf;
if (symlink (sympath, dp->d_name) < 0)
mperror (dp->d_name);
}
}
closedir (df);
return 0;
}
int
main (int ac, char *av[])
{
char *prog_name = av[0];
char *fn, *tn;
struct stat fs, ts;
while (++av, --ac) {
if (strcmp(*av, "-silent") == 0)
silent = 1;
else if (strcmp(*av, "-ignorelinks") == 0)
ignore_links = 1;
else if (strcmp(*av, "-withrevinfo") == 0)
with_revinfo = 1;
else if (strcmp(*av, "--") == 0) {
++av, --ac;
break;
}
else
break;
}
if (ac < 1 || ac > 2)
quit (1, "usage: %s [-silent] [-ignorelinks] fromdir [todir]",
prog_name);
fn = av[0];
if (ac == 2)
tn = av[1];
else
tn = ".";
/* to directory */
if (stat (tn, &ts) < 0)
quiterr (1, tn);
#ifdef S_ISDIR
if (!(S_ISDIR(ts.st_mode)))
#else
if (!(ts.st_mode & S_IFMT) == S_IFDIR)
#endif
quit (2, "%s: Not a directory", tn);
if (chdir (tn) < 0)
quiterr (1, tn);
/* from directory */
if (stat (fn, &fs) < 0)
quiterr (1, fn);
#ifdef S_ISDIR
if (!(S_ISDIR(fs.st_mode)))
#else
if (!(fs.st_mode & S_IFMT) == S_IFDIR)
#endif
quit (2, "%s: Not a directory", fn);
exit (dodir (fn, &fs, &ts, 0));
}
.\" $Xorg: lndir.man,v 1.4 2001/02/09 02:03:17 xorgcvs Exp $
.\"
.\" Copyright (c) 1993, 1994, 1998 The Open Group
.\"
.\" Permission to use, copy, modify, distribute, and sell this software and its
.\" documentation for any purpose is hereby granted without fee, provided that
.\" the above copyright notice appear in all copies and that both that
.\" copyright notice and this permission notice appear in supporting
.\" documentation.
.\"
.\" The above copyright notice and this permission notice shall be
.\" included in all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
.\" OTHER DEALINGS IN THE SOFTWARE.
.\"
.\" Except as contained in this notice, the name of The Open Group shall
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from The Open Group.
.\"
.\"
.\" $XFree86: xc/config/util/lndir.man,v 1.3tsi Exp $
.\"
.TH LNDIR 1 __xorgversion__
.SH NAME
lndir \- create a shadow directory of symbolic links to another directory tree
.SH SYNOPSIS
.B lndir
[
.B \-silent
] [
.B \-ignorelinks
] [
.B \-withrevinfo
]
.I \|fromdir\|
[
.I todir
]
.SH DESCRIPTION
The
.I lndir
program 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
mounted from a remote machine. You can build in the shadow tree, and
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 scheme 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 all 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
.\" CVS.adm is used by the Concurrent Versions System.
Note that BitKeeper, RCS, SCCS, .svn, CVS and CVS.adm directories are
shadowed only if the \fB\-withrevinfo\fP flag is specified.
.PP
If you add files, simply run
.I lndir
again. New files will be silently added. Old files will be
checked that they have the correct link.
.PP
Deleting files is a more painful problem; the symlinks will
just point into never never land.
.PP
If a file in \fIfromdir\fP is a symbolic link, \fIlndir\fP will make
the same link in \fItodir\fP rather than making a link back to the
(symbolic link) entry in \fIfromdir.\fP The \fB\-ignorelinks\fP flag
changes this behavior.
.SH OPTIONS
.IP \-silent
Normally \fIlndir\fP outputs the name of each subdirectory as it
descends into it. The \fB\-silent\fP option suppresses these status
messages.
.IP \-ignorelinks
Causes the program to not treat symbolic links in \fIfromdir\fP
specially. The link created in \fItodir\fP will point back to the
corresponding (symbolic link) file in \fIfromdir\fP.
If the link is to a directory, this is almost certainly the wrong thing.
.IP
This option exists mostly to emulate the behavior the C version of
\fIlndir\fP had in X11R6. Its use is not recommended.
.IP \-withrevinfo
Causes any BitKeeper, RCS, SCCS, .svn, CVS and CVS.adm subdirectories to be
treated as any other directory, rather than ignored.
.SH DIAGNOSTICS
The program displays the name of each subdirectory it enters, followed
by a colon. The \fB\-silent\fP option suppresses these messages.
.PP
A warning message is displayed if the symbolic link cannot be created.
The usual problem is that a regular file of the same name already
exists.
.PP
If the link already exists but doesn't point to the correct file, the
program prints the link name and the location where it does point.
.\" $Xorg: makeg.man,v 1.4 2001/02/09 02:03:17 xorgcvs Exp $
.\" Copyright (c) 1996, 1998 The Open Group
.\"
.\" Permission to use, copy, modify, distribute, and sell this software and its
.\" documentation for any purpose is hereby granted without fee, provided that
.\" the above copyright notice appear in all copies and that both that
.\" copyright notice and this permission notice appear in supporting
.\" documentation.
.\"
.\" The above copyright notice and this permission notice shall be
.\" included in all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
.\" OTHER DEALINGS IN THE SOFTWARE.
.\"
.\" Except as contained in this notice, the name of The Open Group shall
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from The Open Group.
.\"
.\"
.\" $XFree86: xc/config/util/makeg.man,v 1.2 2001/01/27 18:19:55 dawes Exp $
.\"
.TH MAKEG 1 __xorgversion__
.SH NAME
makeg \- make a debuggable executable
.SH SYNOPSIS
.B makeg
[
.I make-options .\|.\|.
] [
.I targets .\|.\|.
]
.SH DESCRIPTION
The
.I makeg
script runs
.I make,
passing it variable settings to create a debuggable target when used
with a Makefile generated by
.I imake.
For example, it arranges for the C compiler to be called with the
.B \-g
option.
.SH ENVIRONMENT
.TP 8
.B MAKE
The
.I make
program to use. Default ``make''.
.TP 8
.B GDB
Set to a non-null value if using the
.I gdb
debugger on Solaris 2, which requires additional debugging options to
be passed to the compiler.
.SH "SEE ALSO"
.I make (1),
.I imake (1)
#! /bin/sh
# makeg - run "make" with options necessary to make a debuggable executable
# $Xorg: makeg.sh,v 1.3 2000/08/17 19:41:52 cpqbld Exp $
# set GDB=1 in your environment if using gdb on Solaris 2.
make="${MAKE-make}"
flags="CDEBUGFLAGS=-g CXXDEBUGFLAGS=-g"
# gdb on Solaris needs the stabs included in the executable
test "${GDB+yes}" = yes && flags="$flags -xs"
exec "$make" $flags LDSTRIPFLAGS= ${1+"$@"}
.\" $Xorg: makestrs.man,v 1.4 2001/02/09 02:03:17 xorgcvs Exp $
.\" Copyright (c) 1993, 1994, 1998 The Open Group
.\"
.\" Permission to use, copy, modify, distribute, and sell this software and its
.\" documentation for any purpose is hereby granted without fee, provided that
.\" the above copyright notice appear in all copies and that both that
.\" copyright notice and this permission notice appear in supporting
.\" documentation.
.\"
.\" The above copyright notice and this permission notice shall be included in
.\" all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
.\" THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
.\" SOFTWARE.
.\"
.\" Except as contained in this notice, the name of The Open Group shall not
.\" be used in advertising or otherwise to promote the sale, use or other
.\" dealing in this Software without prior written authorization from The
.\" Open Group.
.\"
.\" $XFree86: xc/config/util/makestrs.man,v 3.8 2001/12/14 19:53:22 dawes Exp $
.\"
.TH MAKESTRS 1 __xorgversion__
.SH NAME
makestrs \- makes string table C source and header(s)
.SH SYNOPSIS
.B makestrs [-f source] [-i includedir] [-abioptions ...]
.SH DESCRIPTION
The
.I makestrs
command creates string table C source files and headers.
If
.I -f
.I source
is not specified
.I makestrs
will read from
.I stdin.
The C source file is always written to
.I stdout.
.I makestrs
creates one or more C header files as specified in the source file.
The following options may be specified:
.I -sparcabi,
.I -intelabi,
.I -functionabi,
.I -arrayperabi,
and
.I -defaultabi.
.LP
.I -sparcabi
is used on SPARC platforms conforming to the SPARC
Compliance Definition, i.e. SVR4/Solaris.
.LP
.I -intelabi
is used on Intel platforms conforming to the System
V Application Binary Interface, i.e. SVR4.
.LP
.I -earlyR6abi
may be used in addition to
.I -intelabi
for situations
where the vendor wishes to maintain binary compatibility between
X11R6 public-patch 11 (and earlier) and X11R6 public-patch 12 (and later).
.LP
.I -functionabi
generates a functional abi to the string table. This
mechanism imposes a severe performance penalty and it's recommended
that you not use it.
.LP
.I -arrayperabi
results in a separate array for each string. This is
the default behavior if makestrs was compiled with -DARRAYPERSTR
(it almost never is).
.LP
.I -defaultabi
forces the generation of the "normal" string table even
if makestrs was compiled with -DARRAYPERSTR. Since makestrs is almost
never compiled with -DARRAYPERSTR this is the default behavior if
no abioptions are specified.
.LP
.I -i includedir
forces the reading of templates from the includedir instead of the local
directory. This is useful to have separate source and build directories.
.SH SYNTAX
The syntax for string-list file is (items in square brackets are optional):
.RS 4
\&#prefix <text>
.RE
.RS 4
\&#feature <text>
.RE
.RS 4
\&#externref <text>
.RE
.RS 4
\&#externdef [<text>]
.RE
.RS 4
[#ctempl <text>]
.RE
.LP
.RS 4
\&#file <filename>
.RE
.RS 4
\&#table <tablename>
.RE
.RS 4
[#htempl]
.RE
.RS 4
<text>
.RE
.RS 4
...
.RE
.RS 4
<text>
.RE
.RS 4
[#table <tablename>
.RE
.RS 4
<text>
.RE
.RS 4
...
.RE
.RS 4
<text>
.RE
.RS 4
...
.RE
.RS 4
\&#table <tablename>
.RE
.RS 4
...]
.RE
.RS 4
[#file <filename>
.RE
.RS 4
...]
.RE
.LP
In words you may have one or more #file directives. Each #file may have
one or more #table directives.
.LP
The #prefix directive determines the string that makestr will prefix
to each definition.
.LP
The #feature directive determines the string that makestr will use
for the feature-test macro, e.g. X[TM]STRINGDEFINES.
.LP
The #externref directive determines the string that makestr will use
for the extern clause, typically this will be "extern" but Motif wants
it to be "externalref"
.LP
The #externdef directive determines the string that makestr will use
for the declaration, typically this will be the null string (note that
makestrs requires a trailing space in this case, i.e. "#externdef "),
and Motif will use "externaldef(_xmstrings).
.LP
The #ctmpl directive determines the name of the file used as a template
for the C source file that is generated
.LP
Each #file <filename> directive will result in a corresponding header
file by that name containing the appropriate definitions as specified
by command line options. A single C source file containing the
declarations for the definitions in all the headers will be printed
to stdout.
.LP
The #htmpl directive determines the name of the file used as a template
for the C header file that is generated.
.LP
Each #table <tablename> directive will be processed in accordance with
the ABI. On most platforms all tables will be catenated into a single
table with the name of the first table for that file. To conform to
the Intel ABI separate tables will be generated with the names indicated.
.LP
The template files specified by the #ctmpl and #htmpl directives
are processed by copying line for line from the template file to
the appropriate output file. The line containing the string
.I <<<STRING_TABLE_GOES_HERE>>>
is not copied to the output file. The appropriate data is then
copied to the output file and then the remainder of the template
file is copied to the output file.
.SH BUGS
makestrs is not very forgiving of syntax errors. Sometimes you need
a trailing space after # directives, other times they will mess you
up. No warning messages are emitted.
.SH SEE ALSO
SPARC Compliance Definition 2.2., SPARC International Inc.,
535 Middlefield Road, Suite 210, Menlo Park, CA 94025
.LP
System V Application Binary Interface, Third Edition,
ISBN 0-13-100439-5
UNIX Press, PTR Prentice Hall, 113 Sylvan Avenue, Englewood Cliffs,
NJ 07632
.LP
System V Application Binary Interface, Third Edition, Intel386
Architecture Processor Supplement
ISBN 0-13-104670-5
UNIX Press, PTR Prentice Hall, 113 Sylvan Avenue, Englewood Cliffs,
NJ 07632
.LP
System V Application Binary Interface, Third Edition, SPARC
Architecture Processor Supplement
ISBN 0-13-104696-9
UNIX Press, PTR Prentice Hall, 113 Sylvan Avenue, Englewood Cliffs,
NJ 07632
XCOMM!/bin/sh
XCOMM
XCOMM $Xorg: mdepend.cpp,v 1.3 2000/08/17 19:41:52 cpqbld Exp $
XCOMM $XdotOrg: xc/config/util/mdepend.cpp,v 1.4 2005/08/26 05:01:37 daniels 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] [-v] [-a] [-cc compiler] [-d dependencyflag]
XCOMM
XCOMM Notes:
XCOMM
XCOMM The C compiler used can be overridden with the environment
XCOMM variable "CC" or the command line flag -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
XCOMM $XFree86: xc/config/util/mdepend.cpp,v 3.9 2001/04/26 20:55:10 dawes Exp $
XCOMM
CC=PREPROC
silent='-'
TMP=`pwd`/.mdep$$
rm -rf ${TMP}
if ! mkdir -p ${TMP}; then
echo "$0: cannot create ${TMP}, exit." >&2
fi
CPPCMD=${TMP}/a
DEPENDLINES=${TMP}/b
TMPMAKEFILE=${TMP}/c
MAGICLINE=${TMP}/d
ARGS=${TMP}/e
trap "rm -rf ${TMP}; exit 1" 1 2 15
trap "rm -rf ${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
append=n
compilerlistsdepends=n
while [ $# != 0 ]
do
if [ "$endmarker"x != x ] && [ "$endmarker" = "$1" ]; then
endmarker=""
else
case "$1" in
-D*|-I*|-U*)
echo $n " '$1'$c" >> $ARGS
;;
-g|-O) # ignore so we can just pass $(CFLAGS) in
;;
*)
if [ "$endmarker"x = x ]; then
case "$1" in
-w)
width="$2"
shift
;;
-s)
magic_string="$2"
shift
;;
-f*)
if [ "$1" = "-f-" ]; then
makefile="-"
elif [ "$1" = "-f" ]; then
makefile="$2"
shift
else
echo "$1" | sed 's/^\-f//' >${TMP}arg
makefile="`cat ${TMP}arg`"
rm -f ${TMP}arg
fi
;;
-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"
;;
-a)
append="y"
;;
-cc)
CC="$2"
shift
;;
# Flag to tell compiler to output dependencies directly
# For example, with Sun compilers, -xM or -xM1 or
# with gcc, -M
-d)
compilerlistsdepends="y"
compilerlistdependsflag="$2"
shift
;;
-*)
echo "Unknown option '$1' ignored" 1>&2
;;
*)
files="$files $1"
;;
esac
fi
;;
esac
fi
shift
done
echo ' $*' >> $ARGS
if [ "$compilerlistsdepends"x = "y"x ] ; then
CC="$CC $compilerlistdependsflag"
fi
echo "#!/bin/sh" > $CPPCMD
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
if [ "$compilerlistsdepends"x = "y"x ] ; then
for i in $files
do
$CPPCMD $i >> $DEPENDLINES
done
else
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" && $2 != "#pragma")
{
numparts = split( $1, ofileparts, "\." )
ofile = ""
for ( i = 1; i < numparts; i = i+1 )
{
if (i != 1 )
ofile = ofile "."
ofile = ofile ofileparts[i]
}
print ofile "'"$objsuffix"'", $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
fi
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 If not -a, append the magic string and a blank line so that
XCOMM /^$magic_string/+1,\$d can be used to delete everything from after
XCOMM the magic string to the end of the file. Then, append a blank
XCOMM line again and then the dependencies.
XCOMM
if [ "$append" = "n" ]
then
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
fi
cat $DEPENDLINES >>$makefile
case "$makefile" in
$TMPMAKEFILE)
cat $TMPMAKEFILE
;;
esac
rm -rf ${TMP}*
exit 0
XCOMM!/bin/sh
XCOMM
XCOMM $Xorg: mergelib.cpp,v 1.4 2001/02/09 02:03:17 xorgcvs Exp $
XCOMM
XCOMM Copyright (c) 1989, 1998 The Open Group
XCOMM
XCOMM Permission to use, copy, modify, distribute, and sell this software and
XCOMM its documentation for any purpose is hereby granted without fee, provided
XCOMM that the above copyright notice appear in all copies and that both that
XCOMM copyright notice and this permission notice appear in supporting
XCOMM documentation.
XCOMM
XCOMM The above copyright notice and this permission notice shall be included in
XCOMM all copies or substantial portions of the Software.
XCOMM
XCOMM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
XCOMM IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
XCOMM FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
XCOMM OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
XCOMM AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
XCOMM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
XCOMM
XCOMM Except as contained in this notice, the name of The Open Group shall not be
XCOMM used in advertising or otherwise to promote the sale, use or other dealings
XCOMM in this Software without prior written authorization from The Open Group.
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=..
XCOMM Remove directory if we fail
trap "rm -rf $tmpdir; exit 1" 1 2 15
trap "rm -rf $tmpdir; exit 0" 1 2 13
mkdir $tmpdir
XCOMM Security: if $tmpdir exists before mkdir exit immediately
if [ $? -gt 0 -o ! -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 || exit 1
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
.\" $XFree86$
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH MERGELIB 1 __xorgversion__
.SH NAME
mergelib \- merge one library into another
.SH SYNOPSIS
.B mergelib
.I to-library
.I from-library
.RI [ object-filename-prefix ]
.SH DESCRIPTION
The
.I mergelib
program merges objects from one library into another.
The names of object files in
.I from-library
will be prefixed by
.I object-filename-prefix
(\*q_\*q by default) to avoid name clashes.
The merged library will be left in
.IR to-library .
.SH AUTHOR
Jim Fulton wrote the
.I mergelib
program for the X Consortium.
.PP
Colin Watson wrote this manual page, originally for the Debian Project.
/* $Xorg: mkdirhier.c,v 1.4 2001/02/09 02:03:17 xorgcvs Exp $ */
/*
Copyright (C) 1996, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
/* $XFree86$ */
/*
* Simple mkdirhier program for Windows NT
*/
#include <sys/types.h>
#include <sys/stat.h>
#ifndef __UNIXOS2__
#include <direct.h>
#else
#include <dirent.h>
#endif
#include <stdlib.h>
#include <string.h>
char *
next_sep(char *path)
{
while (*path)
if (*path == '/' || *path == '\\')
return path;
else
path++;
return NULL;
}
int
main(int argc, char *argv[])
{
char *dirname, *next, *prev;
char buf[1024];
struct _stat sb;
if (argc < 2)
exit(1);
dirname = argv[1];
prev = dirname;
while (next = next_sep(prev)) {
strncpy(buf, dirname, next - dirname);
buf[next - dirname] = '\0';
/* if parent dir doesn't exist yet create it */
if (_stat(buf, &sb))
_mkdir(buf); /* no error checking to avoid barfing on C: */
prev = next + 1;
}
if (_mkdir(dirname) == -1) {
perror("mkdirhier failed");
exit(1);
}
exit(0);
}
/* OS/2 REXX SCRIPT */
/* $XFree86: xc/config/util/mkdirhier.cmd,v 3.1 1996/02/09 08:18:04 dawes Exp $ */
CALL RxFuncAdd 'SysMkDir', 'RexxUtil', 'SysMkDir'
IF ARG() = 0 THEN DO
SAY "mkdirhier: usage: mkdirhier directory ..."
EXIT 1
END
curdir=DIRECTORY()
drive=DELSTR(curdir,3)
status=""
PARSE ARG all
DO i=1 TO WORDS(all)
direc = TRANSLATE(WORD(all,i),'/','\')
SELECT
WHEN direc = "" THEN DO
SAY "mkdirhier: empty directory name"
status=1
ITERATE
END
WHEN POS('0a'x,direc) > 0 THEN DO
SAY "mkdirhier: directory name contains a newline: '" direc "'"
status=1
ITERATE
END
OTHERWISE NOP
END
IF POS(":",direc) = 0 THEN direc = INSERT(drive,direc)
dirbuf.0 = direc
DO k=1 TO 1000
direc1 = STRIP(direc,"t","/")
dpath1 = FILESPEC("path",direc1)
dirbuf.k=FILESPEC("drive",direc1)||STRIP(dpath1,"t","/")
IF POS("/",dirbuf.k) = 0 THEN LEAVE k
direc=dirbuf.k
END
DO m=k-1 TO 0 BY -1
dospath = TRANSLATE(dirbuf.m,'\','/')
targetdir=DIRECTORY(dospath)
IF targetdir = dospath THEN
NOP
ELSE
CALL SysMkDir(dospath)
CALL DIRECTORY curdir
END
END
EXIT status
.\" $Xorg: mkdirhier.man,v 1.4 2001/02/09 02:03:17 xorgcvs Exp $
.\" Copyright (c) 1993, 1994, 1998 The Open Group
.\"
.\" Permission to use, copy, modify, distribute, and sell this software and its
.\" documentation for any purpose is hereby granted without fee, provided that
.\" the above copyright notice appear in all copies and that both that
.\" copyright notice and this permission notice appear in supporting
.\" documentation.
.\"
.\" The above copyright notice and this permission notice shall be included in
.\" all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
.\" THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
.\" SOFTWARE.
.\"
.\" Except as contained in this notice, the name of The Open Group shall not
.\" be used in advertising or otherwise to promote the sale, use or other
.\" dealing in this Software without prior written authorization from The
.\" Open Group.
.\"
.\" $XFree86: xc/config/util/mkdirhier.man,v 1.2 2001/01/27 18:19:55 dawes Exp $
.\"
.TH MKDIRHIER 1 __xorgversion__
.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)
#!/bin/sh
# $Xorg: mkdirhier.sh,v 1.3 2000/08/17 19:41:53 cpqbld 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
case $2 in
*/*) # IFS parsing is broken
IFS=' '
set x `echo $directory | tr / ' '`
;;
esac
IFS=$newline
shift
for filename
do
path=$prefix$filename
prefix=$path/
shift
test -d "$path" || {
paths=$path
for filename
do
if [ -n "$filename" -a "$filename" != "." ]; then
path=$path/$filename
paths=$paths$newline$path
fi
done
mkdir $paths || status=$?
break
}
done
done
exit $status
.TH mkhtmlindex 1 __vendorversion__
.SH NAME
mkhtmlindex \- generate index files for HTML man pages
.SH SYNOPSIS
.B mkhtmlindex
.I htmlmandir
.SH DESCRIPTION
The
.I mkhtmlindex
program generates index files for a directory of HTML-formatted manual
pages.
It searches for files whose names are of the form \(lqname.1.html\(rq,
and outputs index files \(lqmanindex1.html\(rq, \(lqmanindex.2.html\(rq,
and so on, one for each manual volume.
Empty index files will be removed.
Names and descriptions are found by scanning the first
.I <H2>
section of each page.
.SH OPTIONS
.I mkhtmlindex
takes only one argument: the directory to process.
.SH NOTES
This utility is currently rather specific to X manual pages.
In particular, the format of the index files it outputs is not configurable,
nor is the HTML formatting it expects of manual pages.
.SH AUTHOR
The version of the
.I mkhtmlindex
included in this X.Org Foundation release was originally written
by David Dawes wrote as a part of XFree86.
.PP
Colin Watson wrote this manual page, originally for the Debian Project.
#!/usr/bin/perl
#
# $XFree86: xc/config/util/mkhtmlindex.pl,v 1.2 2001/03/15 19:02:31 dawes Exp $
#
# Copyright © 2000,2001 by VA Linux Systems, Inc.
#
# Generate index files for HTML man pages.
#
# Author: David Dawes <dawes@xfree86.org>
#
#
# Best viewed with tabs set to 4
#
if ($#ARGV ne 0) {
print STDERR "Usage: mkhtmlindex.pl htmlmandir\n";
exit 1;
}
$dir = $ARGV[0];
if (! -d $dir) {
print STDERR "$dir is not a directory\n";
exit 1;
}
@vollist = ("1", "2", "3", "4", "5", "6", "7", "8", "9", "o", "l", "n", "p");
$indexprefix = "manindex";
foreach $vol (@vollist) {
$empty = "yes";
$indexname="$dir/$indexprefix$vol.html";
# print "Processing volume $vol\n";
open(mindex, ">$indexname") || die "Can't create $indexname";
opendir(dir, "$dir") || die "Can't open $dir";
print mindex <<EOF;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>X.Org Manual pages: Section $vol</TITLE>
</HEAD>
<BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red">
<H1>X.Org Manual pages: Section $vol</H1>
<P>
<UL>
EOF
foreach $file (sort readdir dir) {
if ($file =~ "\.$vol\.html") {
open(file, "<$dir/$file") || die "Can't open $dir/$file";
while (<file>) {
chop;
if (/^<[hH]2>/) {
if (! /<\/[hH]2>$/) {
while (<file> && ! /<\/[hH]2>$/) {
;
}
}
$heading = "";
while (<file>) {
if (/^<[hH]2>/) {
last;
}
$heading = "$heading" . "$_";
}
if ($heading) {
undef $empty;
$heading =~ s/--/-/;
($name, $descr) = split(/-/, $heading, 2);
$file =~ /(.*)\.$vol\.html/;
$fname = $1;
$descr =~ s/<[pP]>//g;
print mindex
"<LI><A href=\"$file\">$fname</A> - $descr</LI>";
}
last;
}
}
close file;
}
}
print mindex <<EOF;
</UL>
<P>
</BODY>
</HTML>
EOF
close mindex;
closedir dir;
if (defined $empty) {
# print "Removing empty $indexname\n";
unlink $indexname;
}
}
#!/bin/sh
#
# $XFree86: xc/config/util/mkhtmlindex.sh,v 1.3 2000/08/26 04:30:49 dawes Exp $
#
# Copyright © 2000 by Precision Insight, Inc.
#
# Generate index files for the HTML man pages
#
# Author: David Dawes <dawes@xfree86.org>
#
VOLLIST="1 2 3 4 5 6 7 8 9 o l n p"
INDEX="manindex"
if [ $# != 1 ]; then
echo Usage: $0 htmlmandir
exit 1
fi
if [ ! -d $1 ]; then
echo $1 is not a directory
exit 1
fi
cd $1
for s in $VOLLIST; do
list="`ls *.$s.html 2> /dev/null`" || : # ignore failed glob expansion
if [ X"$list" != X ]; then
file=$INDEX$s.html
rm -f $file
cat <<EOF > $file
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>X.Org Manual pages: Section $s</TITLE>
</HEAD>
<BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red">
<H1>X.Org Manual pages: Section $s</H1>
<P>
<UL>
EOF
for i in $list; do
title="`sed -e '/^[^0-9A-Za-z]/d' -e '/^$/' -e '/^Name/d' -e q $i`"
name="`echo \"$title\" | sed -e 's/ - .*//'`"
desc="`echo \"$title\" | sed -e 's/[^-]* - //' -e 's/<P>//'`"
echo "<LI><A href=\"$i\">$name</A> - $desc</LI>" >> $file
done
cat <<EOF >> $file
</UL>
<P>
</BODY>
</HTML>
EOF
fi
done
exit 0
XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:41:53 cpqbld Exp $
SRCS = mkshadow.c savedir.c wildmat.c
OBJS = mkshadow.o savedir.o wildmat.o
ComplexProgramTarget(mkshadow)
The mkshadow programs makes a "shadow tree" of a directory tree.
It logically copies all of the "MASTER" directory into ".".
However, ordinary files, and RCS/SCCS directories are "copied"
by creating a sybolic link to the corresponding file in MASTER.
The wildmat.c file is by Rich Salz, and from comp.sources.misc, volume 17.
The savedir.c file is lightly modified from the version written
by David MacKenzie for GNU fileutils; the Free Software Foundation
has graciously agreed to waive their usual copyright so this
program can be distributed by the X Consortium.
If you have problems compiling savedir.c, try setting the DIRENT make
variable as suggested in the Makefile.
* Usage: mkshadow [-X exclude_file] [-x exclude_pattern] ... MASTER
* Makes the current directory be a "shadow copy" of MASTER.
* Sort of like a recursive copy of MASTER to .
* However, symbolic links are used instead of actually
* copying (non-directory) files.
* Also, directories named RCS or SCCS are shared (with a symbolic link).
* Warning messages are printed for files (and directories) in .
* that don't match a corresponding file in MASTER (though
* symbolic links are silently removed).
* Also, a warning message is printed for non-directory files
* under . that are not symbolic links.
*
* Files and directories can be excluded from the sharing
* with the -X and -x flags. The flag `-x pattern' (or `-xpattern')
* means that mkshadow should ignore any file whose name matches
* the pattern. The pattern is a "globbing" pattern, i.e. the
* characters *?[^-] are interpreted as by the shell.
* If the pattern contains a '/' is is matched against the complete
* current path (relative to '.'); otherwise, it is matched
* against the last component of the path.
* A `-X filename' flag means to read a set of exclusion patterns
* from the named file, one pattern to a line.
Author: Per Bothner. bothner@cygnus.com. November 1990, 1993.
/* $Xorg: savedir.c,v 1.3 2000/08/17 19:41:53 cpqbld Exp $ */
/* savedir.c -- save the list of files in a directory in a string
Copyright 1990, 1993 Free Software Foundation, Inc.
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 that
notice be given that copying and distribution is by permission of
the Free Software Foundation. The Free Software Foundation makes
no representations about the suitability of this software for any
purpose. It is provided "as is" without expressed or implied
warranty.
(The FSF has modified its usual distribution terms, for this file,
as a courtesy to the X project.) */
/* $XFree86$ */
/* Written by David MacKenzie <djm@ai.mit.edu>.
Modified to use <dirent.h> by default. Per Bothner <bothner@cygnus.com>. */
#include <sys/types.h>
#if !defined(DIRECT) && !defined(BSD)
#include <dirent.h>
#define NLENGTH(direct) (strlen((direct)->d_name))
#else
#undef dirent
#define dirent direct
#define NLENGTH(direct) ((direct)->d_namlen)
#ifdef BSD
#include <sys/dir.h>
#else
#ifdef SYSNDIR
#include <sys/ndir.h>
#else
#include <ndir.h>
#endif
#endif
#endif
#if defined(VOID_CLOSEDIR) || defined(BSD)
/* Fake a return value. */
#define CLOSEDIR(d) (closedir (d), 0)
#else
#define CLOSEDIR(d) closedir (d)
#endif
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
char *stpcpy ();
/* Return a freshly allocated string containing the filenames
in directory DIR, separated by '\0' characters;
the end is marked by two '\0' characters in a row.
NAME_SIZE is the number of bytes to initially allocate
for the string; it will be enlarged as needed.
Return NULL if DIR cannot be opened or if out of memory. */
char *
savedir (dir, name_size)
char *dir;
unsigned name_size;
{
DIR *dirp;
struct dirent *dp;
char *name_space;
char *namep;
dirp = opendir (dir);
if (dirp == NULL)
return NULL;
name_space = (char *) malloc (name_size);
if (name_space == NULL)
{
closedir (dirp);
return NULL;
}
namep = name_space;
while ((dp = readdir (dirp)) != NULL)
{
/* Skip "." and ".." (some NFS filesystems' directories lack them). */
if (dp->d_name[0] != '.'
|| (dp->d_name[1] != '\0'
&& (dp->d_name[1] != '.' || dp->d_name[2] != '\0')))
{
unsigned size_needed = (namep - name_space) + NLENGTH (dp) + 2;
if (size_needed > name_size)
{
char *new_name_space;
while (size_needed > name_size)
name_size += 1024;
new_name_space = realloc (name_space, name_size);
if (new_name_space == NULL)
{
closedir (dirp);
return NULL;
}
namep += new_name_space - name_space;
name_space = new_name_space;
}
strcpy (namep, dp->d_name);
namep += strlen (namep) + 1;
}
}
*namep = '\0';
if (CLOSEDIR (dirp))
{
free (name_space);
return NULL;
}
return name_space;
}
/* $Xorg: wildmat.c,v 1.3 2000/08/17 19:41:53 cpqbld Exp $ */
/*
**
** Do shell-style pattern matching for ?, \, [], and * characters.
** Might not be robust in face of malformed patterns; e.g., "foo[a-"
** could cause a segmentation violation. It is 8bit clean.
**
** Written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
** Rich $alz is now <rsalz@bbn.com>.
** April, 1991: Replaced mutually-recursive calls with in-line code
** for the star character.
**
** Special thanks to Lars Mathiesen <thorinn@diku.dk> for the ABORT code.
** This can greatly speed up failing wildcard patterns. For example:
** pattern: -*-*-*-*-*-*-12-*-*-*-m-*-*-*
** text 1: -adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1
** text 2: -adobe-courier-bold-o-normal--12-120-75-75-X-70-iso8859-1
** Text 1 matches with 51 calls, while text 2 fails with 54 calls. Without
** the ABORT, then it takes 22310 calls to fail. Ugh. The following
** explanation is from Lars:
** The precondition that must be fulfilled is that DoMatch will consume
** at least one character in text. This is true if *p is neither '*' nor
** '\0'.) The last return has ABORT instead of FALSE to avoid quadratic
** behaviour in cases like pattern "*a*b*c*d" with text "abcxxxxx". With
** FALSE, each star-loop has to run to the end of the text; with ABORT
** only the last one does.
**
** Once the control of one instance of DoMatch enters the star-loop, that
** instance will return either TRUE or ABORT, and any calling instance
** will therefore return immediately after (without calling recursively
** again). In effect, only one star-loop is ever active. It would be
** possible to modify the code to maintain this context explicitly,
** eliminating all recursive calls at the cost of some complication and
** loss of clarity (and the ABORT stuff seems to be unclear enough by
** itself). I think it would be unwise to try to get this into a
** released version unless you have a good test data base to try it out
** on.
*/
#define TRUE 1
#define FALSE 0
#define ABORT -1
/* What character marks an inverted character class? */
#define NEGATE_CLASS '^'
/* Is "*" a common pattern? */
#define OPTIMIZE_JUST_STAR
/* Do tar(1) matching rules, which ignore a trailing slash? */
#undef MATCH_TAR_PATTERN
/*
** Match text and p, return TRUE, FALSE, or ABORT.
*/
static int
DoMatch(text, p)
register char *text;
register char *p;
{
register int last;
register int matched;
register int reverse;
for ( ; *p; text++, p++) {
if (*text == '\0' && *p != '*')
return ABORT;
switch (*p) {
case '\\':
/* Literal match with following character. */
p++;
/* FALLTHROUGH */
default:
if (*text != *p)
return FALSE;
continue;
case '?':
/* Match anything. */
continue;
case '*':
while (*++p == '*')
/* Consecutive stars act just like one. */
continue;
if (*p == '\0')
/* Trailing star matches everything. */
return TRUE;
while (*text)
if ((matched = DoMatch(text++, p)) != FALSE)
return matched;
return ABORT;
case '[':
reverse = p[1] == NEGATE_CLASS ? TRUE : FALSE;
if (reverse)
/* Inverted character class. */
p++;
for (last = 0400, matched = FALSE; *++p && *p != ']'; last = *p)
/* This next line requires a good C compiler. */
if (*p == '-' ? *text <= *++p && *text >= last : *text == *p)
matched = TRUE;
if (matched == reverse)
return FALSE;
continue;
}
}
#ifdef MATCH_TAR_PATTERN
if (*text == '/')
return TRUE;
#endif /* MATCH_TAR_ATTERN */
return *text == '\0';
}
/*
** User-level routine. Returns TRUE or FALSE.
*/
int
wildmat(text, p)
char *text;
char *p;
{
#ifdef OPTIMIZE_JUST_STAR
if (p[0] == '*' && p[1] == '\0')
return TRUE;
#endif /* OPTIMIZE_JUST_STAR */
return DoMatch(text, p) == TRUE;
}
#ifdef TEST
#include <stdio.h>
/* Yes, we use gets not fgets. Sue me. */
extern char *gets();
main()
{
char p[80];
char text[80];
printf("Wildmat tester. Enter pattern, then strings to test.\n");
printf("A blank line gets prompts for a new pattern; a blank pattern\n");
printf("exits the program.\n");
for ( ; ; ) {
printf("\nEnter pattern: ");
(void)fflush(stdout);
if (gets(p) == NULL || p[0] == '\0')
break;
for ( ; ; ) {
printf("Enter text: ");
(void)fflush(stdout);
if (gets(text) == NULL)
exit(0);
if (text[0] == '\0')
/* Blank line; go back and get a new pattern. */
break;
printf(" %s\n", wildmat(text, p) ? "YES" : "NO");
}
}
exit(0);
/* NOTREACHED */
}
#endif /* TEST */
/*
* A simple program to make it possible to print the XFree86 version and
* date info as defined in xf86Version.h and xf86Date.h very early in the
* build process.
*/
/* $XFree86: xc/config/util/printver.c,v 1.2 2003/02/26 09:21:33 dawes Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include "xf86Version.h"
#include "xf86Date.h"
int
main()
{
#ifdef XF86_VERSION_MAJOR
printf(" version %d.%d.%d", XF86_VERSION_MAJOR, XF86_VERSION_MINOR,
XF86_VERSION_PATCH);
if (XF86_VERSION_SNAP != 0)
printf(".%d", XF86_VERSION_SNAP);
#ifdef XF86_DATE
printf(" (%s)", XF86_DATE);
#endif
#endif
exit(0);
}
/*
* Copyright 1999 by The XFree86 Project, Inc.
*/
/* $XFree86: xc/config/util/revpath.c,v 1.2 1999/02/01 11:55:49 dawes Exp $ */
/*
* Reverse a pathname. It returns a relative path that can be used to undo
* 'cd argv[1]'.
*
* It is impossible to do this in general, but this handles the cases that
* come up in imake. Maybe imake should use an absolute path for $(TOP)
* instead of a relative path so that this problem can be avoided?
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int
main(int argc, char *argv[])
{
int levels = 0;
char *p;
/* Silently ignore invalid usage */
if (argc != 2)
exit(0);
/* Split the path and count the levels */
p = strtok(argv[1], "/");
while (p) {
if (strcmp(p, ".") == 0)
;
else if (strcmp(p, "..") == 0)
levels--;
else
levels++;
p = strtok(NULL, "/");
}
while (levels-- > 0)
printf("../");
printf("\n");
exit(0);
}
.\" $XFree86: xc/config/util/revpath.man,v 1.1 1999/01/03 03:58:14 dawes Exp $
.TH REVPATH 1 __vendorversion__
.SH NAME
revpath \- generate a relative path that can be used to undo a change-directory
.SH SYNOPSIS
.B revpath
.I path
.SH DESCRIPTION
The
.I revpath
program prints out a relative path that is the ``reverse'' or ``inverse'' of
.IR path .
Start with two directories
.I top
and
.IR bottom ,
with the latter below the former, and
.I path
is the location of
.I bottom
relative to
.IR top .
The output of
.I revpath
is the location of
.I top
relative to
.IR bottom .
The resulting path contains a trailing `/' character when the result is
non-trivial.
If
.I path
is equivalent to `.', the resulting output is empty.
If
.I path
is invalid in some way (e.g., doesn't represent the path to a subdirectory)
the output is also empty and no error messages are ever generated.
.SH DIAGNOSTICS
There are no diagnostics. Error conditions are silently ignored, and the
exit status is always 0.
.SH BUGS
It isn't possible to reverse arbitrary relative paths.
If any path element between the two end points of
.I path
is a symbolic link, the results will probably be incorrect.
#!/bin/sh
#
# 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
#!/bin/sh
#
# 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)
/* REXX */
/* $XFree86: xc/config/util/xmake.cmd,v 3.0 1996/01/24 21:56:17 dawes Exp $ */
'@echo off'
PARSE ARG a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
x11make.exe 'MAKE=x11make.exe SHELL=' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
XCOMM!/bin/sh
XCOMM $XFree86: xc/config/util/xmkmf.cpp,v 1.3 2000/11/06 21:57:10 dawes Exp $
XCOMM
XCOMM make a Makefile from an Imakefile from inside or outside the sources
XCOMM
XCOMM $Xorg: xmkmf.cpp,v 1.3 2000/08/17 19:41:53 cpqbld Exp $
usage="usage: $0 [-a] [top_of_sources_pathname [current_directory]]"
configdirspec=CONFIGDIRSPEC
topdir=
curdir=.
do_all=
imake_defines=
while [ $# -gt 0 ]
do
case "$1" in
-D*)
imake_defines="$imake_defines $1"
shift
;;
-a)
do_all="yes"
shift
;;
*)
break
;;
esac
done
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 -f Makefile Makefile.bak
mv -f Makefile Makefile.bak
fi
if [ "$topdir" = "" ]; then
args="-DUseInstalled "$configdirspec
else
args="-I$topdir/config/cf -DTOPDIR=$topdir -DCURDIR=$curdir"
fi
echo imake $imake_defines $args
case "$do_all" in
yes)
imake $imake_defines $args &&
echo "make Makefiles" &&
make Makefiles &&
echo "make includes" &&
make includes &&
echo "make depend" &&
make depend
;;
*)
imake $imake_defines $args
;;
esac
.\" $Xorg: xmkmf.man,v 1.4 2001/02/09 02:03:17 xorgcvs Exp $
.\" Copyright (c) 1993, 1994, 1998 The Open Group
.\"
.\" Permission to use, copy, modify, distribute, and sell this software and its
.\" documentation for any purpose is hereby granted without fee, provided that
.\" the above copyright notice appear in all copies and that both that
.\" copyright notice and this permission notice appear in supporting
.\" documentation.
.\"
.\" The above copyright notice and this permission notice shall be included in
.\" all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
.\" THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
.\" SOFTWARE.
.\"
.\" Except as contained in this notice, the name of The Open Group shall not
.\" be used in advertising or otherwise to promote the sale, use or other
.\" dealing in this Software without prior written authorization from The
.\" Open Group.
.\"
.\" $XFree86: xc/config/util/xmkmf.man,v 1.2 2001/01/27 18:19:55 dawes Exp $
.\"
.TH XMKMF 1 __xorgversion__
.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 X Consortium build tree.
.PP
If working inside the X Consortium 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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment