test/hello.txt
xify/cc
xify/ld
-xify/newline
-xify/nocomment
-xify/nostring
-xify/xifyfilt
+xify/xify
+scripts/newline
+scripts/nocomment
+scripts/nostring
+LD=ld
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
.c.o:
${CC} -p ${CFLAGS} -c $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
compat-4.1lib compat-4.1lib_p: ${OBJS}
+LD=ld
# Makefile 1.5 85/09/05
#
CFLAGS= -O ${DEFS}
.c.o:
${CC} -p ${CFLAGS} -c $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
compat-sys5lib compat-sys5lib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
.c.o:
${CC} -p ${CFLAGS} -c $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
genlib genlib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
.c.o:
${CC} -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
inetlib inetlib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
# cc -S ${DFLAGS} -DCRT0 crt0.c
# /lib/cpp crt0.s > x.s
# as -o x.o x.s
-# ld -x -r -o crt0.o x.o
+# ${LD} -x -r -o crt0.o x.o
# rm -f x.s x.o crt0.s
#
#moncrt0.o: crt0.c
# cc -S ${DFLAGS} -DMCRT0 crt0.c
# /lib/cpp crt0.s > x.s
# as -o x.o x.s
-# ld -x -r -o moncrt0.o x.o
+# ${LD} -x -r -o moncrt0.o x.o
# rm -f x.s x.o crt0.s
#
#gcrt0.o: moncrt0.o gmon.o
-# ld -x -r -o gcrt0.o moncrt0.o gmon.o
+# ${LD} -x -r -o gcrt0.o moncrt0.o gmon.o
#
#mcrt0.o: moncrt0.o mon.o
-# ld -x -r -o mcrt0.o moncrt0.o mon.o
+# ${LD} -x -r -o mcrt0.o moncrt0.o mon.o
#
#mon.o: mon.c mon.ex
# cc -S ${DEFS} ${DFLAGS} mon.c
# ex - mon.s < mon.ex
# as -o x.o mon.s
-# ld -x -r -o mon.o x.o
+# ${LD} -x -r -o mon.o x.o
# rm -f x.o mon.s
#
#gmon.o: gmon.c gmon.h gmon.ex
# cc -S ${DEFS} ${DFLAGS} gmon.c
# ex - gmon.s < gmon.ex
# as -o x.o gmon.s
-# ld -x -r -o gmon.o x.o
+# ${LD} -x -r -o gmon.o x.o
# rm -f x.o gmon.s
tags:
+LD=ld
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
.c.o:
${CC} -p ${CFLAGS} -c $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
genlib genlib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
.c.o:
${CC} -p ${CFLAGS} -c $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
syslib syslib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1983 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
.c.o:
${CC} -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
netlib netlib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1983 Regents of the University of California.
.c.o:
${CC} -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
hostlib hostlib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1983 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
.c.o:
${CC} -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
hostlib hostlib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
.c.o:
${CC} -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
nslib nslib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
.c.o:
${CC} -p ${CFLAGS} -c $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
stdiolib stdiolib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
.c.o:
${CC} -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
syslib syslib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
.c.o:
/lib/cpp -E ${CFLAGS} -DPROF $*.c | ${AS} -o $*.o
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
/lib/cpp -E ${CFLAGS} $*.c | ${AS} -o $*.o
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
compat-4.1lib compat-4.1lib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
cc -S ${DFLAGS} -DCRT0 crt0.c
/lib/cpp crt0.s > x.s
as -o x.o x.s
- ld -x -r -o crt0.o x.o
+ ${LD} -x -r -o crt0.o x.o
rm -f x.s x.o crt0.s
moncrt0.o: crt0.c
cc -S ${DFLAGS} -DMCRT0 crt0.c
/lib/cpp crt0.s > x.s
as -o x.o x.s
- ld -x -r -o moncrt0.o x.o
+ ${LD} -x -r -o moncrt0.o x.o
rm -f x.s x.o crt0.s
gcrt0.o: moncrt0.o gmon.o
- ld -x -r -o gcrt0.o moncrt0.o gmon.o
+ ${LD} -x -r -o gcrt0.o moncrt0.o gmon.o
mcrt0.o: moncrt0.o mon.o
- ld -x -r -o mcrt0.o moncrt0.o mon.o
+ ${LD} -x -r -o mcrt0.o moncrt0.o mon.o
mon.o: mon.c mon.ex
cc -S ${DEFS} ${DFLAGS} mon.c
ex - mon.s < mon.ex
as -o x.o mon.s
- ld -x -r -o mon.o x.o
+ ${LD} -x -r -o mon.o x.o
rm -f x.o mon.s
gmon.o: gmon.c gmon.h gmon.ex
cc -S ${DEFS} ${DFLAGS} gmon.c
ex - gmon.s < gmon.ex
as -o x.o gmon.s
- ld -x -r -o gmon.o x.o
+ ${LD} -x -r -o gmon.o x.o
rm -f x.o gmon.s
tags:
+LD=ld
# Makefile 4.13 86/01/09
#
SRCS= _setjmp.s abs.s alloca.s atof.s bcmp.s bcopy.s bzero.s disktab.c \
.s.o:
/lib/cpp -E ${DEFS} -DPROF $*.s | ${AS} -o $*.o
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
/lib/cpp -E ${DEFS} $*.s | ${AS} -o $*.o
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
.c.o:
cc -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
cc -c ${CFLAGS} $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
genlib genlib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1983 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
.c.o:
/lib/cpp -E ${CFLAGS} -DPROF $*.c | ${AS} -o $*.o
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out profiled/$*.o
/lib/cpp -E ${CFLAGS} $*.c | ${AS} -o $*.o
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
netlib netlib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
.c.o:
cc -E -DPROF ${CFLAGS} $*.c | as -o $*.o
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out profiled/$*.o
cc -E ${CFLAGS} $*.c | as -o $*.o
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
stdiolib stdiolib_p: ${OBJS}
+LD=ld
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
.c.o:
/lib/cpp -E ${DEFS} -DPROF $*.c | ${AS} -o $*.o
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out profiled/$*.o
/lib/cpp -E ${DEFS} $*.c | ${AS} -o $*.o
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
syslib syslib_p: ${OBJS}
mkdir -p cross/usr/lib
(cd xify && make clean && make && make DESTDIR=$ROOT/cross install)
+(cd include && make DESTDIR=$ROOT/cross SHARED=copies install)
-# new way, not working yet because no prototypes in include yet:
-#(cd include && make DESTDIR=$ROOT/cross SHARED=copies install)
-# old way:
-(cd lib/libx_c && make DESTDIR=$ROOT/cross install-headers)
-
-mkdir -p lib/libx_c/compat-4.1/profiled
-mkdir -p lib/libx_c/compat-sys5/profiled
-mkdir -p lib/libx_c/gen/profiled
-mkdir -p lib/libx_c/inet/profiled
-mkdir -p lib/libx_c/linux/gen/profiled
-mkdir -p lib/libx_c/linux/profiled
-mkdir -p lib/libx_c/linux/sys/profiled
-mkdir -p lib/libx_c/net/hosttable/profiled
-mkdir -p lib/libx_c/net/named/profiled
-mkdir -p lib/libx_c/net/profiled
-mkdir -p lib/libx_c/ns/profiled
-mkdir -p lib/libx_c/stdio/profiled
-mkdir -p lib/libx_c/sys/profiled
+mkdir -p lib/libc/compat-4.1/profiled
+mkdir -p lib/libc/compat-sys5/profiled
+mkdir -p lib/libc/gen/profiled
+mkdir -p lib/libc/inet/profiled
+mkdir -p lib/libc/linux/gen/profiled
+mkdir -p lib/libc/linux/profiled
+mkdir -p lib/libc/linux/sys/profiled
+mkdir -p lib/libc/net/hosttable/profiled
+mkdir -p lib/libc/net/named/profiled
+mkdir -p lib/libc/net/profiled
+mkdir -p lib/libc/ns/profiled
+mkdir -p lib/libc/stdio/profiled
+mkdir -p lib/libc/sys/profiled
(
- cd lib/libx_c && \
+ cd lib/libc && \
make clean && \
- FAKEROOT=$ROOT/cross PATH=$ROOT/cross/bin:$PATH make CC="cc -Dvax" && \
+ make CC="${ROOT}/cross/bin/hostcc -Dvax" LD="${ROOT}/cross/bin/hostld" && \
make DESTDIR=$ROOT/cross install
)
--- /dev/null
+CC=gcc -g -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-result
+
+ALL=newline nocomment nostring
+
+all: ${ALL}
+
+newline: newline.c
+ ${CC} -o $@ newline.c
+
+nocomment: nocomment.c
+ ${CC} -o $@ nocomment.c
+
+nostring: nostring.c
+ ${CC} -o $@ nostring.c
+
+clean:
+ rm -f ${ALL}
ROOT=..
-CC=FAKEROOT=${ROOT}/cross ${ROOT}/cross/bin/cc
-CFLAGS=-I. -d -g -Dvax
+CC=${ROOT}/cross/bin/hostcc
+CFLAGS=-d -g -Dvax
hello: hello.o
${CC} ${CFLAGS} -o $@ hello.o
CC=gcc -g -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-result
DESTDIR=${ROOT}/cross
-BIN=cc ld
-LIB=newline nocomment nostring xifyfilt
+ALL=cc ld xify
-all: ${BIN} ${LIB}
+all: ${ALL}
cc: cc.c
${CC} -DXIFY -o $@ cc.c
ld: ld.c
${CC} -DXIFY -o $@ ld.c
-newline: newline.c
- ${CC} -o $@ newline.c
-
-nocomment: nocomment.c
- ${CC} -o $@ nocomment.c
-
-nostring: nostring.c
- ${CC} -o $@ nostring.c
-
xifyfilt: xifyfilt.c
${CC} -o $@ xifyfilt.c
clean:
- rm -f ${BIN} ${LIB}
+ rm -f ${ALL}
install: all
- mkdir -p ${DESTDIR}/bin
- cp ${BIN} ${DESTDIR}/bin
- mkdir -p ${DESTDIR}/lib
- cp ${LIB} xify ${DESTDIR}/lib
+ install -s cc ${DESTDIR}/bin/hostcc
+ install -s ld ${DESTDIR}/bin/hostld
+ install -s xify ${DESTDIR}/lib/xifyfilt
+ install xify.sh ${DESTDIR}/lib/xify
#ifdef XIFY
char *gcc = "/usr/bin/gcc";
-char *xify = "/lib/xify";
-char *include = "/usr/include/.xify";
+char *ld;
+char *xify;
+char *include;
+char *crt0;
#else
char *cpp = "/lib/cpp";
char *ccom = "/lib/ccom";
char *sccom = "/lib/sccom";
char *c2 = "/lib/c2";
char *as = "/bin/as";
-#endif
char *ld = "/bin/ld";
char *crt0 = "/lib/crt0.o";
+#endif
#ifndef XIFY
char tmp0[30]; /* big enough for /tmp/ctm%05.5d */
int xify_enqueue __P((char *in_name, char *prev_name));
int xify_file __P((char *in_name, struct timespec *in_mtime));
#endif
-int callsys __P((char *f, char **v));
+int callsys __P((/*char *f,*/ char **v));
int nodup __P((char **l, char *os));
char *savestr __P((register char *cp));
char *strspl __P((char *left, char *right));
#endif
int i, j, c;
#ifdef XIFY
- char **p;
struct stat statbuf;
#endif
clist = (char **)calloc(argc, sizeof (char **));
llist = (char **)calloc(argc, sizeof (char **));
plist = (char **)calloc(argc, sizeof (char **));
+#ifdef XIFY
+ t = argv[0];
+ j = strlen(t);
+ for (i = j; i > 0 && t[i - 1] != '/'; --i)
+ ;
+ j = (j >= 2 && t[j - 2] == 'c' && t[j - 1] == 'c') ? j - 2 : i;
+ bcopy(t, in_path, j);
+ strcpy(in_path + j, "ld");
+ ld = savestr(in_path);
+ strcpy(in_path + i, "../lib/xify");
+ xify = savestr(in_path);
+ strcpy(in_path + i, "../usr/include/.xify");
+ include = savestr(in_path);
+ strcpy(in_path + i, "../lib/crt0.o");
+ crt0 = savestr(in_path);
+#endif
for (i = 1; i < argc; i++) {
if (*argv[i] == '-') switch (argv[i][1]) {
if (signal(SIGHUP, SIG_IGN) != SIG_IGN)
signal(SIGHUP, (void (*) __P((int sig)))idexit);
#ifdef XIFY
- plist[np++] = "-I/usr/include/.xify";
- t = getenv("FAKEROOT");
- if (t) {
- xify = strspl(t, xify);
- for (i = 0; i < np; ++i)
- if (plist[i][2] == '/')
- plist[i] = strspl("-I", strspl(t, plist[i] + 2));
- }
- for (i = 0; environ[i]; ++i)
- if (strncmp(environ[i], "PATH=", 5) == 0)
- goto found_path_var;
- p = (char **)calloc(i + 2, sizeof(char *));
- bcopy(environ, p, i * sizeof(char *));
- environ = p;
-found_path_var:
- environ[i] = "PATH=/bin:/usr/bin";
+ plist[np++] = strspl("-I", include);
#else
if (pflag==0)
sprintf(tmp0, "/tmp/ctm%05.5d", getpid());
++in_queue_head;
}
}
- av[0] = "gcc"; av[1] = "-o";
+ av[0] = /*"gcc"*/gcc; av[1] = "-o";
na = 2;
if (cflag && nc==1 && outfile)
av[na++] = outfile;
av[na++] = "-c";
av[na++] = clist[i];
av[na] = 0;
- if (callsys(gcc, av)) {
+ if (callsys(/*gcc,*/ av)) {
nogood:
cflag++;
eflag++;
assource = tmp3;
if (pflag)
tmp4 = setsuf(clist[i], 'i');
- av[0] = "cpp"; av[1] = clist[i];
+ av[0] = /*"cpp"*/cpp; av[1] = clist[i];
na = 2;
if (!exflag)
av[na++] = tmp4;
for (j = 0; j < np; j++)
av[na++] = plist[j];
av[na++] = 0;
- if (callsys(cpp, av)) {
+ if (callsys(/*cpp,*/ av)) {
exfail++;
eflag++;
}
tmp3 = setsuf(clist[i], 's');
assource = tmp3;
}
- av[0] = fflag ? "sccom" : "ccom";
+ av[0] = fflag ? /*"sccom"*/sccom : /*"ccom"*/ccom;
av[1] = tmp4; av[2] = oflag?tmp5:tmp3; na = 3;
if (proflag)
av[na++] = "-XP";
if (wflag)
av[na++] = "-w";
av[na] = 0;
- if (callsys(fflag ? sccom : ccom, av)) {
+ if (callsys(/*fflag ? sccom : ccom,*/ av)) {
cflag++;
eflag++;
continue;
}
if (oflag) {
- av[0] = "c2"; av[1] = tmp5; av[2] = tmp3; av[3] = 0;
- if (callsys(c2, av)) {
+ av[0] = /*"c2"*/c2; av[1] = tmp5; av[2] = tmp3; av[3] = 0;
+ if (callsys(/*c2,*/ av)) {
unlink(tmp3);
tmp3 = assource = tmp5;
} else
continue;
assemble:
cunlink(tmp1); cunlink(tmp2); cunlink(tmp4);
- av[0] = "as"; av[1] = "-o";
+ av[0] = /*"as"*/as; av[1] = "-o";
if (cflag && nc==1 && outfile)
av[2] = outfile;
else
av[na++] = dflag;
av[na++] = assource;
av[na] = 0;
- if (callsys(as, av) > 1) {
+ if (callsys(/*as,*/ av) > 1) {
cflag++;
eflag++;
continue;
}
nocom:
if (cflag==0 && nl!=0) {
-#ifdef XIFY
- t = getenv("FAKEROOT");
- if (t) {
- ld = strspl(t, ld);
- if (crt0[0] == '/')
- crt0 = strspl(t, crt0);
- }
-#endif
i = 0;
- av[0] = "ld"; av[1] = "-X"; av[2] = crt0; na = 3;
+ av[0] = /*"ld"*/ld; av[1] = "-X"; av[2] = crt0; na = 3;
if (outfile) {
av[na++] = "-o";
av[na++] = outfile;
else
av[na++] = "-lc";
av[na++] = 0;
- eflag |= callsys(ld, av);
+ eflag |= callsys(/*ld,*/ av);
if (nc==1 && nxo==1 && eflag==0)
unlink(setsuf(clist[0], 'o'));
}
}
out_path[i + 5] = '/';
- av[0] = "xify"; av[1] = in_name; av[2] = out_path; av[3] = err_path; av[4] = 0;
- if (callsys(xify, av))
+ av[0] = /*"xify"*/xify; av[1] = in_name; av[2] = out_path; av[3] = err_path; av[4] = 0;
+ if (callsys(/*xify,*/ av))
return 1;
}
}
#endif
-int callsys(f, v) char *f; char **v; {
+int callsys(/*f,*/ v) /*char *f;*/ char **v; {
int t, status;
+#if 1
+ int i;
+
+ if (debug) {
+ fprintf(stderr, "%s", v[0]);
+ for (i = 1; v[i]; ++i)
+ fprintf(stderr, " %s", v[i]);
+ fprintf(stderr, "\n");
+ }
+#else
char **cpp;
if (debug) {
- fprintf(stderr, "%s:", f);
+ fprintf(stderr, "%s:", /*f*/v[0]);
for (cpp = v; *cpp != 0; cpp++)
fprintf(stderr, " %s", *cpp);
fprintf(stderr, "\n");
}
+#endif
t = vfork();
if (t == -1) {
printf("No more processes\n");
return (100);
}
if (t == 0) {
- execv(f, v);
- printf("Can't find %s\n", f);
+ execv(/*f*/v[0], v);
+ printf("Can't find %s\n", /*f*/v[0]);
fflush(stdout);
_exit(100);
}
;
if ((t=(status&0377)) != 0 && t!=14) {
if (t!=2) {
- printf("Fatal error in %s\n", f);
+ printf("Fatal error in %s\n", /*f*/v[0]);
eflag = 8;
}
dexit();
void endload __P((int argc, char **argv));
#ifdef XIFY
void xify_library __P((char *in_name));
-int callsys __P((char *f, char **v));
+int callsys __P((/*char *f,*/ char **v));
#else
void load1arg __P((register char *cp));
int step __P((off_t nloc));
}
/* add default search directories */
#ifdef XIFY
- dirs[ndir++] = "/lib/.xify";
- dirs[ndir++] = "/usr/lib/.xify";
- dirs[ndir++] = "/usr/local/lib/.xify";
- ap = getenv("FAKEROOT");
- if (ap) {
- for (i = 0; i < ndir; ++i)
- if (dirs[i][0] == '/')
- dirs[i] = strspl(ap, dirs[i]);
- }
- for (i = 0; environ[i]; ++i)
- if (strncmp(environ[i], "PATH=", 5) == 0)
- goto found_path_var;
- p = (char **)calloc(i + 2, sizeof(char *));
- bcopy(environ, p, i * sizeof(char *));
- environ = p;
-found_path_var:
- environ[i] = "PATH=/bin:/usr/bin";
+ ap = argv[0];
+ for (i = strlen(ap); i > 0 && ap[i - 1] != '/'; --i)
+ ;
+ bcopy(ap, in_path, i);
+ strcpy(in_path + i, "../lib/.xify");
+ dirs[ndir++] = savestr(in_path);
+ strcpy(in_path + i, "../usr/lib/.xify");
+ dirs[ndir++] = savestr(in_path);
+ strcpy(in_path + i, "../usr/local/lib/.xify");
+ dirs[ndir++] = savestr(in_path);
#else
dirs[ndir++] = "/lib";
dirs[ndir++] = "/usr/lib";
#ifdef XIFY
/* ld currently adds upto 5 args; 10 is room to spare */
av = (char **)calloc(argc+10, sizeof (char **));
- av[0] = rflag ? "ld" : "gcc"; av[1] = "-o"; av[2] = ofilename;
+ av[0] = rflag ? /*"ld"*/ld : /*"gcc"*/gcc; av[1] = "-o"; av[2] = ofilename;
na = 3;
for (i = 0; i < ndir; ++i)
av[na++] = strspl("-L", dirs[i]);
;
}
#ifdef XIFY
- if (callsys(rflag ? ld : gcc, av))
+ if (callsys(/*rflag ? ld : gcc,*/ av))
delexit();
#endif
finishout();
strcat(in_path + j, ".a");
if (stat(in_path, &statbuf) == 0)
goto found;
+
+ strcpy(in_path + j, ".xify/libx_");
+ strcat(in_path + j, in_name);
+ strcat(in_path + j, ".a");
+ if (trace)
+ fprintf(stderr, "unlink %s\n", in_path);
+ if (unlink(in_path) && errno != ENOENT) {
+ filname=in_path;
+ error(1, "can't unlink\n");
+ }
}
error(1, "not found\n");
exit(1);
strcat(out_path + j, ".a");
if (stat(out_path, &statbuf) == 0)
return;
+ if (trace)
+ fprintf(stderr, "mkdir %s\n", dirs[i]);
if (mkdir(dirs[i], 0777) == -1 && errno != EEXIST) {
filname = dirs[i];
error(1, "can't mkdir\n");
strcpy(in_path, "../lib");
strcat(in_path, in_name);
strcat(in_path, ".a");
+ if (trace)
+ fprintf(stderr, "symlink %s %s\n", in_path, out_path);
if (symlink(in_path, out_path) == -1) {
filname = out_path;
error(1, "can't symlink\n");
}
}
-int callsys(f, v) char *f; char **v; {
+int callsys(/*f,*/ v) /*char *f;*/ char **v; {
int t, status;
+#if 1
+ int i;
+
+ if (/*debug*/trace) {
+ fprintf(stderr, "%s", v[0]);
+ for (i = 1; v[i]; ++i)
+ fprintf(stderr, " %s", v[i]);
+ fprintf(stderr, "\n");
+ }
+#else
char **cpp;
if (/*debug*/trace) {
- fprintf(stderr, "%s:", f);
+ fprintf(stderr, "%s:", /*f*/v[0]);
for (cpp = v; *cpp != 0; cpp++)
fprintf(stderr, " %s", *cpp);
fprintf(stderr, "\n");
}
+#endif
t = vfork();
if (t == -1) {
printf("No more processes\n");
return (100);
}
if (t == 0) {
- execv(f, v);
- printf("Can't find %s\n", f);
+ execv(/*f*/v[0], v);
+ printf("Can't find %s\n", /*f*/v[0]);
fflush(stdout);
_exit(100);
}
;
if ((t=(status&0377)) != 0 && t!=14) {
if (t!=2) {
- printf("Fatal error in %s\n", f);
+ printf("Fatal error in %s\n", /*f*/v[0]);
/*eflag*/delarg = 8;
}
/*dexit*/delexit();