cproto-4.6/lex.yy.c
cproto-4.6/stamp-h
cproto-4.6/y.tab.c
-cross
+stage0
+stage1
lib/libc/compat-4.1/compat-4.1lib
lib/libc/compat-4.1/compat-4.1lib_p
lib/libc/compat-sys5/compat-sys5lib
/*#include <sys/signal.h> gen.h*/
#include <sys/wait.h>
+#ifdef X_
+#include <sys/stat.h>
+#endif
+
#if defined(DOSCCS) && !defined(lint)
static char sccsid[] = "@(#)cc.c 4.13 9/18/85";
#endif
/*#include <sys/dir.h>*/
#ifdef X_
+char bin[MAXPATHLEN];
char *cpp;
char *ccom;
char *sccom;
char *strspl __P((char *left, char *right));
void main(argc, argv) int argc; char **argv; {
-#ifdef X_
- char *root;
-#endif
char *t;
char *assource;
int i, j, c;
-
#ifdef X_
- root = savestr(argv[0]);
- for (i = strlen(root); i > 0 && root[i - 1] != '/'; --i)
+ char *pathptr;
+ struct stat statbuf;
+
+ for (i = strlen(argv[0]); i > 0 && argv[0][i - 1] != '/'; --i)
;
- root[i] = 0;
- cpp = strspl(root, "../lib/cpp");
- ccom = strspl(root, "../lib/ccom");
- sccom = strspl(root, "../lib/sccom");
- c2 = strspl(root, "../lib/c2");
- as = strspl(root, "as");
- ld = strspl(root, "ld");
- crt0 = strspl(root, "../lib/crt0.o");
+ if (i)
+ bcopy(argv[0], bin, i);
+ else if ((pathptr = getenv("PATH")) != 0)
+ do {
+ for (; pathptr[i] && pathptr[i] != ':'; ++i)
+ ;
+ bcopy(pathptr, bin, i);
+ bin[i++] = '/';
+ strcpy(bin + i, argv[0]);
+ if (stat(bin, &statbuf) == 0)
+ break;
+ pathptr += i;
+ i = 0;
+ } while (pathptr[-1]);
+ bin[i] = 0;
+ cpp = strspl(bin, "../lib/cpp");
+ ccom = strspl(bin, "../lib/ccom");
+ sccom = strspl(bin, "../lib/sccom");
+ c2 = strspl(bin, "../lib/c2");
+ as = strspl(bin, "as");
+ ld = strspl(bin, "ld");
+ crt0 = strspl(bin, "../lib/crt0.o");
#endif
+
/* ld currently adds upto 5 args; 10 is room to spare */
av = (char **)calloc(argc+10, sizeof (char **));
clist = (char **)calloc(argc, sizeof (char **));
case 'p':
proflag++;
#ifdef X_
- t = "../lib/mcrt0.o";
- if (argv[i][2] == 'g')
- t = "../usr/lib/gcrt0.o";
- crt0 = strspl(root, t);
+ crt0 = strspl(bin, argv[i][2] == 'g' ? "../usr/lib/gcrt0.o" : "../lib/mcrt0.o");
#else
crt0 = "/lib/mcrt0.o";
if (argv[i][2] == 'g')
/*#include <sys/stat.h>*/
/*#include <sys/file.h>*/
+#ifdef X_
+char bin[MAXPATHLEN];
+#endif
+
/*
* Basic strategy:
*
void bseek __P((register struct biobuf *bp, register off_t off));
void main(argc, argv) int argc; char **argv; {
-#ifdef X_
- char *root;
-#endif
register int c, i;
int num;
register char *ap, **p;
char save;
-
#ifdef X_
- root = savestr(argv[0]);
- for (i = strlen(root); i > 0 && root[i - 1] != '/'; --i)
+ char *pathptr;
+ struct stat statbuf;
+
+ for (i = strlen(argv[0]); i > 0 && argv[0][i - 1] != '/'; --i)
;
- root[i] = 0;
+ if (i)
+ bcopy(argv[0], bin, i);
+ else if ((pathptr = getenv("PATH")) != 0)
+ do {
+ for (; pathptr[i] && pathptr[i] != ':'; ++i)
+ ;
+ bcopy(pathptr, bin, i);
+ bin[i++] = '/';
+ strcpy(bin + i, argv[0]);
+ if (stat(bin, &statbuf) == 0)
+ break;
+ pathptr += i;
+ i = 0;
+ } while (pathptr[-1]);
+ bin[i] = 0;
#endif
+
if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
signal(SIGINT, (void (*) __P((int sig)))delexit);
signal(SIGTERM, (void (*) __P((int sig)))delexit);
}
/* add default search directories */
#ifdef X_
- dirs[ndir++] = strspl(root, "../lib");
- dirs[ndir++] = strspl(root, "../usr/lib");
- dirs[ndir++] = strspl(root, "../usr/local/lib");
+ dirs[ndir++] = strspl(bin, "../lib");
+ dirs[ndir++] = strspl(bin, "../usr/lib");
+ dirs[ndir++] = strspl(bin, "../usr/local/lib");
#else
dirs[ndir++] = "/lib";
dirs[ndir++] = "/usr/lib";
#else
#define COMPACT(e) tp = pwd->pw_/**/e; while (*cp++ = *tp++);
#endif
-#ifdef X_
-/* without this adjustment it tries to access x_pwd->x_pw_x_name etc */
- COMPACT(nox_name);
- COMPACT(nox_passwd);
-#else
COMPACT(name);
COMPACT(passwd);
-#endif
bcopy((char *)&pwd->pw_uid, cp, sizeof (int));
cp += sizeof (int);
bcopy((char *)&pwd->pw_gid, cp, sizeof (int));
cp += sizeof (int);
bcopy((char *)&pwd->pw_quota, cp, sizeof (int));
cp += sizeof (int);
-#ifdef X_
-/* without this adjustment it tries to access x_pwd->x_pw_x_name etc */
- COMPACT(nox_comment);
- COMPACT(nox_gecos);
- COMPACT(nox_dir);
- COMPACT(nox_shell);
-#else
COMPACT(comment);
COMPACT(gecos);
COMPACT(dir);
COMPACT(shell);
-#endif
content.dptr = buf;
content.dsize = cp - buf;
key.dptr = pwd->pw_name;
export ROOT=`pwd`
+
export INCLUDE=$ROOT/cross/usr/include
export SCRIPTS=$ROOT/scripts
+export STAGE0=$ROOT/stage0
+export STAGE1=$ROOT/stage1
+
export PATH=$SCRIPTS:$PATH
#else
#define EXPAND(e) passwd.pw_/**/e = tp; while (*tp++ = *cp++);
#endif
-#ifdef X_
-/* without this adjustment it tries to access x_passwd.x_pw_x_name etc */
- EXPAND(nox_name);
- EXPAND(nox_passwd);
-#else
EXPAND(name);
EXPAND(passwd);
-#endif
bcopy(cp, (char *)&passwd.pw_uid, sizeof (int));
cp += sizeof (int);
bcopy(cp, (char *)&passwd.pw_gid, sizeof (int));
cp += sizeof (int);
bcopy(cp, (char *)&passwd.pw_quota, sizeof (int));
cp += sizeof (int);
-#ifdef X_
-/* without this adjustment it tries to access x_passwd.x_pw_x_name etc */
- EXPAND(nox_comment);
- EXPAND(nox_gecos);
- EXPAND(nox_dir);
- EXPAND(nox_shell);
-#else
EXPAND(comment);
EXPAND(gecos);
EXPAND(dir);
EXPAND(shell);
-#endif
return (&passwd);
}
-#include <nox_stdlib.h>
+#pragma include <stdlib.h>
#include <gen.h>
-#include <nox_math.h>
+#pragma include <math.h>
#include <math.h>
-#include <nox_unistd.h>
+#pragma include <unistd.h>
#include <sys/proc.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/proc.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <errno.h>
#include <sys/proc.h>
-#include <nox_errno.h>
-#include <sys/nox_stat.h>
-#include <sys/nox_types.h>
+#pragma include <errno.h>
+#pragma include <sys/stat.h>
+#pragma include <sys/types.h>
#include <errno.h>
#include <sys/stat.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
-#include <sys/nox_types.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
+#pragma include <sys/types.h>
#include <errno.h>
#include <sys/stat.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <errno.h>
#include <sys/proc.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/file.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <errno.h>
#include <sys/file.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <errno.h>
#include <sys/file.h>
-#include <nox_errno.h>
-#include <nox_stdlib.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <stdlib.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/exec.h>
-#include <nox_errno.h>
-#include <sys/nox_stat.h>
-#include <sys/nox_types.h>
+#pragma include <errno.h>
+#pragma include <sys/stat.h>
+#pragma include <sys/types.h>
#include <errno.h>
#include <sys/stat.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
-#include <sys/nox_types.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
+#pragma include <sys/types.h>
#include <errno.h>
#include <sys/stat.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/proc.h>
-#include <nox_errno.h>
-#include <sys/nox_stat.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <sys/stat.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/stat.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
-#include <sys/nox_types.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
+#pragma include <sys/types.h>
#include <errno.h>
#include <sys/file.h>
-#include <nox_unistd.h>
+#pragma include <unistd.h>
#include <sys.h>
-#include <nox_unistd.h>
-#include <sys/nox_types.h>
+#pragma include <unistd.h>
+#pragma include <sys/types.h>
#include <sys.h>
#include <sys/types.h>
-#include <nox_unistd.h>
-#include <sys/nox_types.h>
+#pragma include <unistd.h>
+#pragma include <sys/types.h>
#include <sys.h>
#include <sys/types.h>
-#include <nox_unistd.h>
-#include <sys/nox_types.h>
+#pragma include <unistd.h>
+#pragma include <sys/types.h>
#include <sys.h>
#include <sys/types.h>
-/*#include <nox_unistd.h>*/
+/*#pragma include <unistd.h>*/
#include <sys.h>
-#include <nox_errno.h>
-#include <sys/nox_types.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <sys/types.h>
+#pragma include <unistd.h>
#include <errno.h>
#include <sys.h>
-#include <nox_unistd.h>
+#pragma include <unistd.h>
int getpid() {
return (int)nox_getpid();
-#include <nox_unistd.h>
+#pragma include <unistd.h>
int getpid() {
return (int)nox_getppid();
-#include <nox_errno.h>
-#include <nox_stdlib.h>
-#include <sys/nox_resource.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <stdlib.h>
+#pragma include <sys/resource.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/resource.h>
-#include <nox_errno.h>
-#include <sys/nox_time.h>
-#include <sys/nox_types.h>
+#pragma include <errno.h>
+#pragma include <sys/time.h>
+#pragma include <sys/types.h>
#include <errno.h>
#include <sys/time.h>
-#include <nox_unistd.h>
-#include <sys/nox_types.h>
+#pragma include <unistd.h>
+#pragma include <sys/types.h>
#include <sys.h>
#include <sys/types.h>
-#include <nox_errno.h>
-#include <sys/nox_ioctl.h>
-#include <sys/nox_types.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <sys/ioctl.h>
+#pragma include <sys/types.h>
+#pragma include <unistd.h>
#include <string.h>
#include <sys/errno.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <errno.h>
#include <sys/file.h>
-#include <nox_dirent.h>
-#include <nox_errno.h>
-#include <nox_stdlib.h>
-#include <nox_string.h>
-#include <sys/nox_wait.h>
-#include <nox_unistd.h>
+#pragma include <dirent.h>
+#pragma include <errno.h>
+#pragma include <stdlib.h>
+#pragma include <string.h>
+#pragma include <sys/wait.h>
+#pragma include <unistd.h>
#include <gen.h>
#include <string.h>
#ifndef _LINUX_SYS_LINUX_H_
#define _LINUX_SYS_LINUX_H_
-#include <nox_signal.h>
-#include <sys/nox_resource.h>
-#include <sys/nox_stat.h>
-#include <sys/nox_types.h>
+#pragma include <signal.h>
+#pragma include <sys/resource.h>
+#pragma include <sys/stat.h>
+#pragma include <sys/types.h>
#include <sys/resource.h>
#include <sys/stat.h>
-#include <nox_errno.h>
-#include <nox_stdlib.h>
-#include <nox_unistd.h>
-#include <sys/nox_types.h>
+#pragma include <errno.h>
+#pragma include <stdlib.h>
+#pragma include <unistd.h>
+#pragma include <sys/types.h>
#include <sys/errno.h>
#include <sys/file.h>
-#include <nox_errno.h>
-#include <sys/nox_stat.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <sys/stat.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/stat.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <errno.h>
#include <sys/file.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/file.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <errno.h>
#include <sys/file.h>
-#include <nox_errno.h>
-#include <nox_stdlib.h>
-#include <nox_unistd.h>
-#include <sys/nox_uio.h>
+#pragma include <errno.h>
+#pragma include <stdlib.h>
+#pragma include <unistd.h>
+#pragma include <sys/uio.h>
#include <sys/errno.h>
#include <sys/file.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/proc.h>
-#include <nox_errno.h>
-#include <sys/nox_types.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <sys/types.h>
+#pragma include <unistd.h>
#include <errno.h>
#include <sys.h>
-#include <nox_errno.h>
-#include <sys/nox_types.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <sys/types.h>
+#pragma include <unistd.h>
#include <errno.h>
#include <sys.h>
-#include <nox_errno.h>
-#include <sys/nox_types.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <sys/types.h>
+#pragma include <unistd.h>
#include <errno.h>
#include <sys.h>
-#include <nox_errno.h>
-#include <sys/nox_time.h>
-#include <sys/nox_types.h>
+#pragma include <errno.h>
+#pragma include <sys/time.h>
+#pragma include <sys/types.h>
#include <errno.h>
#include <sys/time.h>
-#include <nox_stdlib.h>
-#include <sys/nox_signal.h>
-#include <sys/nox_types.h>
-#include <nox_unistd.h>
+#pragma include <stdlib.h>
+#pragma include <sys/signal.h>
+#pragma include <sys/types.h>
+#pragma include <unistd.h>
#include <sys/signal.h>
#include <sys/types.h>
-#include <nox_errno.h>
-#include <nox_stdlib.h>
-#include <sys/nox_signal.h>
-#include <sys/nox_types.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <stdlib.h>
+#pragma include <sys/signal.h>
+#pragma include <sys/types.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/signal.h>
-#include <nox_stdlib.h>
-#include <sys/nox_signal.h>
-#include <sys/nox_types.h>
-#include <nox_unistd.h>
+#pragma include <stdlib.h>
+#pragma include <sys/signal.h>
+#pragma include <sys/types.h>
+#pragma include <unistd.h>
#include <sys/signal.h>
#include <sys/types.h>
-#include <nox_errno.h>
-#include <nox_signal.h>
-#include <nox_stdlib.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <signal.h>
+#pragma include <stdlib.h>
+#pragma include <unistd.h>
#include <errno.h>
#include <sys/file.h>
-#include <nox_errno.h>
-#include <sys/nox_stat.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <sys/stat.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/stat.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <errno.h>
#include <sys/file.h>
-#include <nox_unistd.h>
+#pragma include <unistd.h>
#include <sys.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
-#include <sys/nox_types.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
+#pragma include <sys/types.h>
#include <errno.h>
#include <sys/file.h>
-#include <sys/nox_stat.h>
-#include <sys/nox_types.h>
+#pragma include <sys/stat.h>
+#pragma include <sys/types.h>
#include <sys/stat.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/file.h>
-#include <nox_errno.h>
-#include <sys/nox_time.h>
-#include <sys/nox_types.h>
+#pragma include <errno.h>
+#pragma include <sys/time.h>
+#pragma include <sys/types.h>
#include <errno.h>
#include <sys/time.h>
-#include <nox_errno.h>
-#include <nox_fcntl.h>
-#include <nox_stdlib.h>
-#include <sys/nox_stat.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <fcntl.h>
+#pragma include <stdlib.h>
+#pragma include <sys/stat.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/file.h>
-#include <nox_errno.h>
-#include <nox_stdlib.h>
-#include <sys/nox_types.h>
-#include <sys/nox_wait.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <stdlib.h>
+#pragma include <sys/types.h>
+#pragma include <sys/wait.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/types.h>
-#include <nox_errno.h>
-#include <sys/nox_resource.h>
-#include <sys/nox_types.h>
-#include <sys/nox_wait.h>
+#pragma include <errno.h>
+#pragma include <sys/resource.h>
+#pragma include <sys/types.h>
+#pragma include <sys/wait.h>
#include <sys/errno.h>
#include <sys/resource.h>
-#include <nox_errno.h>
-#include <nox_unistd.h>
+#pragma include <errno.h>
+#pragma include <unistd.h>
#include <sys/errno.h>
#include <sys/file.h>
-#include <nox_errno.h>
-#include <nox_stdlib.h>
-#include <nox_unistd.h>
-#include <sys/nox_uio.h>
+#pragma include <errno.h>
+#pragma include <stdlib.h>
+#pragma include <unistd.h>
+#pragma include <sys/uio.h>
#include <sys/errno.h>
#include <sys/file.h>
#!/bin/sh -e
ROOT=`pwd`
-PATH=$ROOT/scripts:$PATH
-
-rm -rf cross
-mkdir -p cross/bin
-mkdir -p cross/lib
-mkdir -p cross/usr/bin
-mkdir -p cross/usr/include
-mkdir -p cross/usr/lib
-
-(cd xify && make clean && make && make install)
-(cd include && make.sh SHARED=copies install)
+STAGE0=$ROOT/stage0
+STAGE1=$ROOT/stage1
+OLDPATH="$PATH"
+# these should always exist, but are sometimes lost due to git on empty dirs
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/ns/profiled
mkdir -p lib/libc/stdio/profiled
mkdir -p lib/libc/sys/profiled
-(cd lib/libc && make.sh clean && make.sh && make.sh install)
-(cd usr.bin/yacc && make.sh clean && make.sh && make.sh install)
-(cd usr.bin/lex && make.sh clean && make.sh && make.sh install)
+rm -rf $STAGE0
+mkdir -p $STAGE0/bin
+mkdir -p $STAGE0/lib
+mkdir -p $STAGE0/usr/bin
+mkdir -p $STAGE0/usr/include
+mkdir -p $STAGE0/usr/lib
+
+export PATH="$STAGE0/bin:$STAGE0/usr/bin:$OLDPATH"
+
+(cd xify && make clean && PATH="$OLDPATH" make && make DESTDIR=$STAGE0 install)
+(cd include && make SHARED=copies DESTDIR=$STAGE0 install)
+cat <<EOF >$STAGE0/usr/include/setjmp.h
+#pragma include <setjmp.h>
+#pragma typedef jmp_buf
+EOF
+cat <<EOF >$STAGE0/usr/include/stdarg.h
+#pragma include <stdarg.h>
+#pragma keyword va_start va_arg va_endarg
+#pragma typedef va_list
+EOF
+cat <<EOF >$STAGE0/usr/include/stdint.h
+#pragma include <stdint.h>
+#pragma typedef int8_t int16_t int32_t int64_t intptr_t ssize_t
+#pragma typedef uint8_t uint16_t uint32_t uint64_t uintptr_t size_t
+EOF
+rm -f $STAGE0/usr/include/varargs.h
+(cd lib/libc && make clean && make && make DESTDIR=$STAGE0 install)
+(cd usr.bin/yacc && make clean && make && make DESTDIR=$STAGE0 install)
+cat - usr.bin/yacc/yaccpar <<EOF >$STAGE0/usr/lib/yaccpar
+#pragma ifdef __GNUC__
+#pragma pragma GCC diagnostic ignored "-Wunused-label"
+#pragma endif
+EOF
+(cd usr.bin/lex && make clean && make && make DESTDIR=$STAGE0 install)
+
+rm -rf $STAGE1
+mkdir -p $STAGE1/bin
+mkdir -p $STAGE1/lib
+mkdir -p $STAGE1/usr/bin
+mkdir -p $STAGE1/usr/include
+mkdir -p $STAGE1/usr/lib
-(cd bin && make.sh clean && make.sh SUBDIR="as csh diff sed sh tp" NSTD= KMEM= && make.sh SUBDIR="as csh diff sed sh tp" NSTD= KMEM= install)
-(cd usr.bin && make.sh clean && make.sh SUBDIR=find NSTD= KMEM= && make.sh SUBDIR=find NSTD= KMEM= install)
+(cd bin && make clean && make SUBDIR="as csh diff sed sh tp" NSTD= KMEM= && make DESTDIR=$STAGE1 SUBDIR="as csh diff sed sh tp" NSTD= KMEM= install)
+(cd usr.bin && make clean && make SUBDIR="find lex yacc" NSTD= KMEM= && make DESTDIR=$STAGE1 SUBDIR="find lex yacc" NSTD= KMEM= install)
+++ /dev/null
-#!/bin/sh
-ROOT=`dirname $0`/..
-ROOT=`cd $ROOT && pwd`
-make X_="x_" CC="$ROOT/cross/bin/hostcc -Dunix -Dvax" LD="$ROOT/cross/bin/hostld" YACC="$ROOT/cross/usr/bin/yacc" LEX="$ROOT/cross/usr/bin/lex" DESTDIR="$ROOT/cross" "$@"
--- /dev/null
+#!/bin/sh
+ROOT=`dirname $0`/..
+ROOT=`cd $ROOT && pwd`
+STAGE0=$ROOT/stage0
+PATH=$STAGE0/bin:$STAGE0/usr/bin:$PATH make DESTDIR=$STAGE0 "$@"
/* sizes and limits */
/* Nick changed memory size to reflect that some words allocated are pointers */
-# ifdef HUGE
+# ifdef _HUGE
# define ACTSIZE 12000
# define MEMSIZE (24000 * sizeof(char *) / sizeof(int))
# define NSTATES 750
# define PARSER "/usr/lib/yaccpar"
/* basic size of the Yacc implementation */
-# define HUGE
+# define _HUGE
#endif
--- /dev/null
+s/@/ATSIGN/g
+s/^/@/
+s/$/@/
+s/[^A-Za-z0-9_]\+/@&@/g
+
+s/@HUGE@/@_HUGE@/
+
+s/@//g
+s/ATSIGN/@/g
+++ /dev/null
-#if defined(DOSCCS) && !defined(lint)
-static char yaccpar_sccsid[] = "@(#)yaccpar 4.1 (Berkeley) 2/11/83";
-#endif
-
-#ifdef __GNUC__
-#pragma nox_GCC nox_diagnostic nox_ignored "-Wunused-label"
-#endif
-
-#
-# define YYFLAG -1000
-# define YYERROR goto yyerrlab
-# define YYACCEPT return(0)
-# define YYABORT return(1)
-
-/* parser for yacc output */
-
-#ifdef YYDEBUG
-int yydebug = 0; /* 1 for debugging */
-#endif
-YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
-int yychar = -1; /* current input token number */
-int yynerrs = 0; /* number of errors */
-short yyerrflag = 0; /* error recovery flag */
-
-int yyparse() {
-
- short yys[YYMAXDEPTH];
- short yyj, yym;
- register YYSTYPE *yypvt;
- register short yystate, *yyps, yyn;
- register YYSTYPE *yypv;
- register short *yyxi;
-
- yystate = 0;
- yychar = -1;
- yynerrs = 0;
- yyerrflag = 0;
- yyps= &yys[-1];
- yypv= &yyv[-1];
-
- yystack: /* put a state and value onto the stack */
-
-#ifdef YYDEBUG
- if( yydebug ) printf( "state %d, char 0%o\n", yystate, yychar );
-#endif
- if( ++yyps> &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); }
- *yyps = yystate;
- ++yypv;
- *yypv = yyval;
-
- yynewstate:
-
- yyn = yypact[yystate];
-
- if( yyn<= YYFLAG ) goto yydefault; /* simple state */
-
- if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0;
- if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault;
-
- if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */
- yychar = -1;
- yyval = yylval;
- yystate = yyn;
- if( yyerrflag > 0 ) --yyerrflag;
- goto yystack;
- }
-
- yydefault:
- /* default state action */
-
- if( (yyn=yydef[yystate]) == -2 ) {
- if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0;
- /* look through exception table */
-
- for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */
-
- while( *(yyxi+=2) >= 0 ){
- if( *yyxi == yychar ) break;
- }
- if( (yyn = yyxi[1]) < 0 ) return(0); /* accept */
- }
-
- if( yyn == 0 ){ /* error */
- /* error ... attempt to resume parsing */
-
- switch( yyerrflag ){
-
- case 0: /* brand new error */
-
- yyerror( "syntax error" );
- yyerrlab:
- ++yynerrs;
-
- case 1:
- case 2: /* incompletely recovered error ... try again */
-
- yyerrflag = 3;
-
- /* find a state where "error" is a legal shift action */
-
- while ( yyps >= yys ) {
- yyn = yypact[*yyps] + YYERRCODE;
- if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){
- yystate = yyact[yyn]; /* simulate a shift of "error" */
- goto yystack;
- }
- yyn = yypact[*yyps];
-
- /* the current yyps has no shift onn "error", pop stack */
-
-#ifdef YYDEBUG
- if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
-#endif
- --yyps;
- --yypv;
- }
-
- /* there is no state on the stack with an error shift ... abort */
-
- yyabort:
- return(1);
-
-
- case 3: /* no shift yet; clobber input char */
-
-#ifdef YYDEBUG
- if( yydebug ) printf( "error recovery discards char %d\n", yychar );
-#endif
-
- if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
- yychar = -1;
- goto yynewstate; /* try again in the same state */
-
- }
-
- }
-
- /* reduction by production yyn */
-
-#ifdef YYDEBUG
- if( yydebug ) printf("reduce %d\n",yyn);
-#endif
- yyps -= yyr2[yyn];
- yypvt = yypv;
- yypv -= yyr2[yyn];
- yyval = yypv[1];
- yym=yyn;
- /* consult goto table to find next state */
- yyn = yyr1[yyn];
- yyj = yypgo[yyn] + *yyps + 1;
- if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
- switch(yym){
- $A
- }
- goto yystack; /* stack new state and value */
-
- }
/*#include "files.h" dextern.h*/
#ifdef X_
-#include <string.h>
+#include <gen.h>
+/*#include <strings.h> gen.h*/
+#include <sys/stat.h>
#endif
#if defined(DOSCCS) && !defined(lint)
int main(argc, argv) int argc; char *argv[]; {
#ifdef X_
int i;
+ char *pathptr;
+ struct stat statbuf;
for (i = strlen(argv[0]); i > 0 && argv[0][i - 1] != '/'; --i)
;
- bcopy(argv[0], parser, i);
+ if (i)
+ bcopy(argv[0], parser, i);
+ else if ((pathptr = getenv("PATH")) != 0)
+ do {
+ for (; pathptr[i] && pathptr[i] != ':'; ++i)
+ ;
+ bcopy(pathptr, parser, i);
+ parser[i++] = '/';
+ strcpy(parser + i, argv[0]);
+ if (stat(parser, &statbuf) == 0)
+ break;
+ pathptr += i;
+ i = 0;
+ } while (pathptr[-1]);
strcpy(parser + i, "../lib/yaccpar");
#endif
-ROOT=..
-CC=gcc -g -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-result
-DESTDIR=${ROOT}/cross
+CFLAGS=-fno-strict-aliasing -g -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-parentheses -Wno-strict-aliasing -Wno-unused-result
xifyfilt: xifyfilt.c
- ${CC} -o $@ xifyfilt.c
+ ${CC} ${CFLAGS} -o $@ xifyfilt.c
clean:
rm -f xifyfilt *.o
install: xifyfilt
- install hostcc.sh ${DESTDIR}/bin/hostcc
- install hostld.sh ${DESTDIR}/bin/hostld
+ install cc.sh ${DESTDIR}/bin/cc
+ install ld.sh ${DESTDIR}/bin/ld
install -s xifyfilt ${DESTDIR}/lib
install xify.sh ${DESTDIR}/lib/xify
#!/bin/sh
-BIN=`dirname $0`
-cpp="$BIN/../lib/cpp"
-ccom="$BIN/../lib/ccom"
-sccom="$BIN/../lib/sccom"
-c2="$BIN/../lib/c2"
-as="$BIN/as"
+BIN="$0"
+if ! echo $BIN |grep -q /
+then
+ BIN=`which $BIN`
+fi
+BIN=`dirname $BIN`
+
+hostcpp=cpp
+include="$BIN/../usr/include"
+xify="$BIN/../lib/xify"
+hostcc=gcc
ld="$BIN/ld"
rm=rm
+export PATH=/bin:/usr/bin
+
clist=
llist=
plist=
Mflag=
debug=
dflag=
+xflag=
nc=0
nxo=0
-crt0="$BIN/../lib/crto0.o"
+crt0="$BIN/../lib/crt0.o"
while test $# -ge 1
do
-d*)
dflag=$1
;;
+ -X)
+ xflag=1
+ ;;
-*)
echo "$0: error: bad flag $1" >&2
exit 1
#echo "Mflag=$Mflag"
#echo "debug=$debug"
#echo "dflag=$dflag"
+#echo "xflag=$xflag"
#echo "nc=$nc"
#echo "nxo=$nxo"
#echo "crt0=$crt0"
if test -z "$pflag"
then
tmp=`mktemp /tmp/ctmXXXXXX`
+ rm $tmp # we only want $tmp.i, $tmp.s and so on
else
tmp=
fi
fi
if test -n "$debug"
then
- echo $cpp $i$j$plist
+# echo $hostcpp $i$j $plist
+ echo $hostcpp $i$j -nostdinc -DX_ -Dunix -Dvax$plist -I$include
fi
- if ! $cpp $i$j$plist
+# if ! $hostcpp $i$j$plist
+ if ! $hostcpp $i$j -nostdinc -DX_ -Dunix -Dvax$plist -I$include
then
cflag=1
eflag=1
continue
fi
+ j=
+ if test -z "$xflag"
+ then
+ j=" $tmp.c"
+ fi
+ if test -n "$debug"
+ then
+ echo $xify $tmp_i$j
+ fi
+ if ! $xify $tmp_i$j
+ then
+ cflag=1
+ eflag=1
+ continue
+ fi
+ if test -n "$xflag"
+ then
+ cflag=1
+ continue
+ fi
+
if test -n "$sflag"
then
if test $nc -eq 1 -a -n "$outfile"
tmp_s=`echo $i |sed -e 's/.$/s/'`
fi
else
- tmp_s="$tmp.s"
+# optimization: don't call compiler and assembler separately unless have -S
+ tmp_s="$tmp.c"
+ assource="$tmp_s"
+# since we can't "goto" out of enclosing if, duplicate all code until "done"
+ if test -n "$cflag" -a $nc -eq 1 -a -n "$outfile"
+ then
+ j="$outfile"
+ else
+ j=`echo $i |sed -e 's/.$/o/'`
+ fi
+ # if test -n "$Rflag"
+ # then
+ # j="$j -R"
+ # fi
+ # if test -n "$dflag"
+ # then
+ # j="$j $dflag"
+ # fi
+ j="$j -fno-strict-aliasing"
+ if test -n "$proflag"
+ then
+ j="$j -pg"
+ fi
+ if test -n "$gflag" -o -n "$Gflag"
+ then
+ j="$j -g"
+ fi
+ if test -z "$wflag"
+ then
+ j="$j -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-parentheses -Wno-strict-aliasing -Wno-unused-result"
+ fi
+ if test -n "$debug"
+ then
+ # echo $as -o $j $assource
+ echo $hostcc -o $j -c $assource
+ fi
+ # if ! $as -o $j $assource && $? -gt 1
+ if ! $hostcc -o $j -c $assource
+ then
+ cflag=1
+ eflag=1
+ continue
+ fi
+ if test -n "$tmp_s"
+ then
+ $rm -f $tmp_s
+ fi
+ continue
+# else
+# tmp_s="$tmp.s"
+# end
fi
- if test -n "$fflag"
- then
- j="$sccom"
- else
- j="$ccom"
- fi
- if test -n "$oflag"
- then
- k="$tmp.c2s"
- else
- k="$tmp_s"
- fi
+# if test -n "$oflag"
+# then
+# k="$tmp.c2s"
+# else
+# k="$tmp_s"
+# fi
+# if test -n "$proflag"
+# then
+# k="$k -XP"
+# fi
+# if test -n "$gflag"
+# then
+# k="$k -Xg"
+# elif test -n "$Gflag"
+# then
+# k="$k -XG"
+# fi
+# if test -n "$wflag"
+# then
+# k="$k -w"
+# fi
+# if test -n "$debug"
+# then
+# echo $j $tmp_i $k
+# fi
+# if ! $j $tmp_i $k
+# then
+# cflag=1
+# eflag=1
+# continue
+# fi
+# $rm -f $tmp_i
+#
+# if test -n "$oflag"
+# then
+# if test -n "$debug"
+# then
+# echo $c2 $tmp.c2s $tmp_s
+# fi
+# if ! $c2 $tmp.c2s $tmp_s
+# then
+# $rm -f $tmp_s
+# tmp_s="$tmp.c2s"
+# else
+# $rm -f $tmp.c2s
+# fi
+# fi
+ j="$tmp_s -fno-strict-aliasing"
if test -n "$proflag"
then
- k="$k -XP"
+ j="$j -pg"
fi
- if test -n "$gflag"
+ if test -n "$gflag" -o -n "$Gflag"
then
- k="$k -Xg"
- elif test -n "$Gflag"
- then
- k="$k -XG"
+ j="$j -g"
fi
- if test -n "$wflag"
+ if test -z "$wflag"
then
- k="$k -w"
+ j="$j -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-parentheses -Wno-strict-aliasing -Wno-unused-result"
fi
if test -n "$debug"
then
- echo $j $tmp_i $k
+ echo $hostcc -o $j -S $tmp.c
fi
- if ! $j $tmp_i $k
+ if ! $hostcc -o $j -S $tmp.c
then
cflag=1
eflag=1
continue
fi
- $rm -f $tmp_i
- if test -n "$oflag"
- then
- if test -n "$debug"
- then
- echo $c2 $tmp.c2s $tmp_s
- fi
- if ! $c2 $tmp.c2s $tmp_s
- then
- $rm -f $tmp_s
- tmp_s="$tmp.c2s"
- else
- $rm -f $tmp.c2s
- fi
- fi
-
- if test -n "$sflag"
- then
+# if test -n "$sflag"
+# then
continue
- fi
-
- assource="$tmp_s"
+# fi
+#
+# assource="$tmp_s"
fi
if test -n "$cflag" -a $nc -eq 1 -a -n "$outfile"
else
j=`echo $i |sed -e 's/.$/o/'`
fi
- if test -n "$Rflag"
+# if test -n "$Rflag"
+# then
+# j="$j -R"
+# fi
+# if test -n "$dflag"
+# then
+# j="$j $dflag"
+# fi
+ j="$j -fno-strict-aliasing"
+ if test -n "$proflag"
+ then
+ j="$j -pg"
+ fi
+ if test -n "$gflag" -o -n "$Gflag"
then
- j="$j -R"
+ j="$j -g"
fi
- if test -n "$dflag"
+ if test -z "$wflag"
then
- j="$j $dflag"
+ j="$j -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-parentheses -Wno-strict-aliasing -Wno-unused-result"
fi
if test -n "$debug"
then
- echo $as -o $j $assource
+# echo $as -o $j $assource
+ echo $hostcc -o $j -c $assource
fi
- if ! $as -o $j $assource && $? -gt 1
+# if ! $as -o $j $assource && $? -gt 1
+ if ! $hostcc -o $j -c $assource
then
cflag=1
eflag=1
+++ /dev/null
-#!/bin/sh
-
-BIN=`dirname $0`
-cpp=/lib/cpp
-include="$BIN/../usr/include"
-xify="$BIN/../lib/xify"
-cc=/usr/bin/gcc
-ld="$BIN/hostld"
-rm=rm
-
-clist=
-llist=
-plist=
-cflag=
-oflag=
-pflag=
-sflag=
-Rflag=
-exflag=
-proflag=
-fflag=
-gflag=
-Gflag=
-Mflag=
-debug=
-dflag=
-xflag=
-nc=0
-nxo=0
-crt0="$BIN/../lib/crto0.o"
-
-while test $# -ge 1
-do
- case "$1" in
- -S)
- sflag=1
- cflag=1
- ;;
- -o)
- if test -z "$2"
- then
- echo "$0: error: -o where?" >&2
- exit 1
- fi
- outfile=$2
- shift
- if echo $outfile |grep -q '\.c$'
- then
- echo "$0: error: -o would overwrite $outfile" >&2
- exit 1
- fi
- ;;
- -R)
- Rflag=1
- ;;
- -O)
- oflag=1
- ;;
- -p)
- proflag=1
- crt0="$BIN/../lib/mcrt0.o"
- ;;
- -pg)
- proflag=1
- crt0="$BIN/../usr/lib/gcrt0.o"
- ;;
- -f)
- fflag=1
- ;;
- -go)
- Gflag=1
- ;;
- -g)
- gflag=1
- ;;
- -w)
- wflag=1
- ;;
- -E)
- exflag=1
- pflag=1
- plist="$plist $1" # this is ignored by 4.3bsd cpp
- ;;
- -P)
- pflag=1
- echo "$0: warning: -P option obsolete; you should use -E instead"
- plist="$plist $1"
- ;;
- -c)
- cflag=1
- ;;
- -M*)
- exflag=1
- pflag=1
- Mflag=1
- plist="$plist $1"
- ;;
- -Dnox_*)
- plist="$plist `echo $1 |sed -e 's/^-Dnox_/-D/'`"
- ;;
- -D*)
- plist="$plist `echo $1 |sed -e 's/^-D/-Dx_/'`"
- ;;
- -Unox_*)
- plist="$plist `echo $1 |sed -e 's/^-Unox_/-U/'`"
- ;;
- -U*)
- plist="$plist `echo $1 |sed -e 's/^-U/-Ux_/'`"
- ;;
- -I*)
- plist="$plist $1"
- ;;
- -C)
- plist="$plist $1"
- ;;
- -L*)
- llist="$llist $1"
- ;;
- # chpass and passname stuff not implemented
- -d)
- debug=1
- ;;
- -d*)
- dflag=$1
- ;;
- -X)
- xflag=1
- ;;
- -*)
- echo "$0: error: bad flag $1" >&2
- exit 1
- ;;
- *)
- t=$1
- if echo $t |grep -q '\.[cs]$' || test -n "$exflag"
- then
- clist="$clist $t"
- nc=`expr $nc + 1`
- t=`echo $t |sed -e 's/.$/o/'`
- fi
-
- dup=
- for i in $llist
- do
- if test "$i" = "$t"
- then
- dup=1
- break
- fi
- done
- if test -z "$dup"
- then
- llist="$llist $t"
- if echo $t |grep -q '\.o$'
- then
- nxo=`expr $nxo + 1`
- fi
- fi
- ;;
- esac
- shift
-done
-
-#echo "clist=$clist"
-#echo "llist=$llist"
-#echo "plist=$plist"
-#echo "cflag=$cflag"
-#echo "oflag=$oflag"
-#echo "pflag=$pflag"
-#echo "sflag=$sflag"
-#echo "Rflag=$Rflag"
-#echo "exflag=$exflag"
-#echo "proflag=$proflag"
-#echo "fflag=$fflag"
-#echo "gflag=$gflag"
-#echo "Gflag=$Gflag"
-#echo "Mflag=$Mflag"
-#echo "debug=$debug"
-#echo "dflag=$dflag"
-#echo "xflag=$xflag"
-#echo "nc=$nc"
-#echo "nxo=$nxo"
-#echo "crt0=$crt0"
-
-if test \( -n "$gflag" -o -n "$Gflag" \) -a -n "$oflag"
-then
- echo "$0: warning: -g disables -O" >&2
- oflag=
-fi
-
-eflag=
-
-if test -n "$clist"
-then
- # signal stuff not implemented
-
- if test -z "$pflag"
- then
- tmp=`mktemp /tmp/ctmXXXXXX`
- else
- tmp=
- fi
-
- for i in $clist
- do
- if test $nc -gt 1 -a -z "$Mflag"
- then
- echo "$i:"
- fi
-
- if test -z "$Mflag" && echo $i |grep -q '\.s$'
- then
- tmp_s=
- assource=$i
- else
- if test -n "$pflag"
- then
- tmp_i=`echo $i |sed -e 's/.$/i/'`
- else
- tmp_i="$tmp.i"
- fi
-
- j=
- if test -z "$exflag"
- then
- j=" $tmp_i"
- fi
- if test -n "$debug"
- then
-# echo $cpp $i$j$plist
- echo $cpp $i$j -nostdinc$plist -I$include
- fi
-# if ! $cpp $i$j$plist
- if ! $cpp $i$j -nostdinc$plist -I$include
- then
- cflag=1
- eflag=1
- continue
- fi
- if test -n "$pflag"
- then
- cflag=1
- continue
- fi
-
- j=
- if test -z "$xflag"
- then
- j=" $tmp.c"
- fi
- if test -n "$debug"
- then
- echo $xify $tmp_i$j
- fi
- if ! $xify $tmp_i$j
- then
- cflag=1
- eflag=1
- continue
- fi
- if test -n "$xflag"
- then
- cflag=1
- continue
- fi
-
- if test -n "$sflag"
- then
- if test $nc -eq 1 -a -n "$outfile"
- then
- tmp_s="$outfile"
- else
- tmp_s=`echo $i |sed -e 's/.$/s/'`
- fi
- else
-# optimization: don't call compiler and assembler separately unless have -S
- tmp_s="$tmp.c"
- assource="$tmp_s"
-# since we can't "goto" out of enclosing if, duplicate all code until "done"
- if test -n "$cflag" -a $nc -eq 1 -a -n "$outfile"
- then
- j="$outfile"
- else
- j=`echo $i |sed -e 's/.$/o/'`
- fi
- # if test -n "$Rflag"
- # then
- # j="$j -R"
- # fi
- # if test -n "$dflag"
- # then
- # j="$j $dflag"
- # fi
- j="$j -fno-strict-aliasing"
- if test -n "$proflag"
- then
- j="$j -pg"
- fi
- if test -n "$gflag" -o -n "$Gflag"
- then
- j="$j -g"
- fi
- if test -z "$wflag"
- then
- j="$j -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-parentheses -Wno-strict-aliasing -Wno-unused-result"
- fi
- if test -n "$debug"
- then
- # echo $as -o $j $assource
- echo $cc -o $j -c $assource
- fi
- # if ! $as -o $j $assource && $? -gt 1
- if ! $cc -o $j -c $assource
- then
- cflag=1
- eflag=1
- continue
- fi
- if test -n "$tmp_s"
- then
- $rm -f $tmp_s
- fi
- continue
-# else
-# tmp_s="$tmp.s"
-# end
- fi
-
-# if test -n "$oflag"
-# then
-# k="$tmp.c2s"
-# else
-# k="$tmp_s"
-# fi
-# if test -n "$proflag"
-# then
-# k="$k -XP"
-# fi
-# if test -n "$gflag"
-# then
-# k="$k -Xg"
-# elif test -n "$Gflag"
-# then
-# k="$k -XG"
-# fi
-# if test -n "$wflag"
-# then
-# k="$k -w"
-# fi
-# if test -n "$debug"
-# then
-# echo $j $tmp_i $k
-# fi
-# if ! $j $tmp_i $k
-# then
-# cflag=1
-# eflag=1
-# continue
-# fi
-# $rm -f $tmp_i
-#
-# if test -n "$oflag"
-# then
-# if test -n "$debug"
-# then
-# echo $c2 $tmp.c2s $tmp_s
-# fi
-# if ! $c2 $tmp.c2s $tmp_s
-# then
-# $rm -f $tmp_s
-# tmp_s="$tmp.c2s"
-# else
-# $rm -f $tmp.c2s
-# fi
-# fi
- j="$tmp_s -fno-strict-aliasing"
- if test -n "$proflag"
- then
- j="$j -pg"
- fi
- if test -n "$gflag" -o -n "$Gflag"
- then
- j="$j -g"
- fi
- if test -z "$wflag"
- then
- j="$j -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-parentheses -Wno-strict-aliasing -Wno-unused-result"
- fi
- if test -n "$debug"
- then
- echo $cc -o $j -S $tmp.c
- fi
- if ! $cc -o $j -S $tmp.c
- then
- cflag=1
- eflag=1
- continue
- fi
-
-# if test -n "$sflag"
-# then
- continue
-# fi
-#
-# assource="$tmp_s"
- fi
-
- if test -n "$cflag" -a $nc -eq 1 -a -n "$outfile"
- then
- j="$outfile"
- else
- j=`echo $i |sed -e 's/.$/o/'`
- fi
-# if test -n "$Rflag"
-# then
-# j="$j -R"
-# fi
-# if test -n "$dflag"
-# then
-# j="$j $dflag"
-# fi
- j="$j -fno-strict-aliasing"
- if test -n "$proflag"
- then
- j="$j -pg"
- fi
- if test -n "$gflag" -o -n "$Gflag"
- then
- j="$j -g"
- fi
- if test -z "$wflag"
- then
- j="$j -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-parentheses -Wno-strict-aliasing -Wno-unused-result"
- fi
- if test -n "$debug"
- then
-# echo $as -o $j $assource
- echo $cc -o $j -c $assource
- fi
-# if ! $as -o $j $assource && $? -gt 1
- if ! $cc -o $j -c $assource
- then
- cflag=1
- eflag=1
- continue
- fi
- if test -n "$tmp_s"
- then
- $rm -f $tmp_s
- fi
- done
-fi
-
-if test -z "$cflag" -a -n "$llist"
-then
- if test -n "$outfile"
- then
- j=" -o $outfile"
- else
- j=
- fi
- if test -n "$gflag" -o -n "$Gflag"
- then
- k=" -lg"
- else
- k=
- fi
- if test -n "$proflag"
- then
- k="$k -lc_p"
- else
- k="$k -lc"
- fi
- if test -n "$debug"
- then
- echo $ld -X $crt0$j $llist$k
- fi
- if ! $ld -X $crt0$j $llist$k
- then
- eflag=1
- elif test $nc -eq 1 -a $nxo -eq 1 -a -z "$eflag"
- then
- set $clist
- $rm -f `echo $1 |sed -e 's/.$/o/'`
- fi
-fi
-
-#echo "eflag=$eflag"
-exit $eflag
#!/bin/sh
-BIN=`dirname $0`
-cc=/usr/bin/gcc
-ld=/usr/bin/ld
+BIN="$0"
+if ! echo $BIN |grep -q /
+then
+ BIN=`which $BIN`
+fi
+BIN=`dirname $BIN`
+
+hostcc=gcc
+hostld=ld
mkdir=mkdir
ln=ln
rm=rm
+export PATH=/bin:/usr/bin
+
outfile=
dirs=
files=
if test -n "$rflag"
then
- cmd="$ld"
+ cmd="$hostld"
else
- cmd="$cc"
+ cmd="$hostcc"
fi
if test -n "$outfile"
then
#!/bin/sh
(
cat <<EOF
-#ifndef X_
-#define X_
-
#include <stdint.h>
#define _va_arg_short(argp) va_arg(argp, int)
typedef uint16_t x_unsigned_short;
typedef uint32_t x_unsigned_int;
typedef uint32_t x_unsigned_long;
-
-#endif
EOF
"`dirname "$0"`/xifyfilt" <$1 |sed -e 's/\(extern\|register\|static\) x_int\([ ]\+\(int\|long\|short\|unsigned\|x_Bignum\|x_Iptr\|x_YYSTYPE\|x_bytetoktype\|x_bool\|x_caddr_t\|x_chptr\|x_datum\|x_inttoktype\|x_lgtype\|x_off_t\|x_time_t\|x_u_char\|x_u_int\|x_u_short\|x_u_long\)\)/\1\2/g; s/va_arg(x_argp, x_\(unsigned_\)\?\(short\|int\|long\))/_va_arg_\1\2(x_argp)/g'
) >$2
}
continue;
}
+ else if (n == 7 && memcmp(r, "keyword", 7) == 0) {
+ while (isblank(r[n]))
+ ++n;
+ p = r + n;
+ l = 0;
+ while (isalpha(p[l]) || p[l] == '_') {
+ while (isalnum(p[l]) || p[l] == '_')
+ ++l;
+ fprintf(stderr, "keyword name: ");
+ fwrite(p, l, 1, stderr);
+ putc('\n', stderr);
+ while (isblank(p[l]))
+ ++l;
+ p += l;
+ l = 0;
+ }
+ if (p[l] != '\n') {
+ fprintf(stderr, "%s: warning: garbage after #pragma keyword: ", argv[0]);
+ while (p[l] && p[l] != '\n')
+ putc(p[l++], stderr);
+ putc('\n', stderr);
+ }
+ continue;
+ }
}
fwrite(p, l, 1, stdout);
fputs(p + l + m, stdout);