Minor changes to support building on other systems (i.e. SunOS).

This commit is contained in:
gwr 1996-11-07 22:59:39 +00:00
parent 7ecf22ab74
commit 26793c36d4
7 changed files with 121 additions and 11 deletions

View File

@ -0,0 +1,50 @@
# $NetBSD: Makefile.boot,v 1.1 1996/11/07 22:59:39 gwr Exp $
# from: @(#)Makefile 8.2 (Berkeley) 4/19/94
#
# a very simple makefile...
#
# You only want to use this if you aren't running NetBSD.
#
CC=gcc -O
CFLAGS= -I. -DMAKE_BOOTSTRAP
# Uncomment this if your system does not have strtoul (i.e. SunOS)
STRTOUL= -Dstrtoul=strtol
# Note: The scanner here uses features specific to "flex" so
# do not bother even trying to make lex build the scanner.
# If you do not have flex, the source can be found in:
# src/usr.bin/lex (See Makefile.boot)
LEX=flex -l
YACC=yacc
OBJS= files.o hash.o main.o mkheaders.o mkioconf.o mkmakefile.o \
mkswap.o pack.o sem.o util.o y.tab.o lex.yy.o strerror.o
config: ${OBJS}
${CC} -o $@ ${OBJS}
y.tab.o : y.tab.c
${CC} ${CFLAGS} -c y.tab.c
y.tab.c y.tab.h : gram.y
${YACC} -d gram.y
lex.yy.o : lex.yy.c
${CC} ${CFLAGS} ${STRTOUL} -c lex.yy.c
lex.yy.c : scan.l
${LEX} scan.l
${OBJS} : config.h
y.tab.o mkmakefile.o mkswap.o sem.o : sem.h
lex.yy.o : y.tab.h
.c.o:
${CC} ${CFLAGS} -c $<
clean:
rm -f *.o config lex.yy.c y.tab.[ch]

View File

@ -1,4 +1,4 @@
/* $NetBSD: config.h,v 1.26 1996/08/31 21:15:05 mycroft Exp $ */
/* $NetBSD: config.h,v 1.27 1996/11/07 22:59:40 gwr Exp $ */
/*
* Copyright (c) 1992, 1993
@ -44,6 +44,38 @@
* from: @(#)config.h 8.1 (Berkeley) 6/6/93
*/
/*
* config.h: Global definitions for "config"
*/
#include <sys/types.h>
#include <sys/param.h>
#if !defined(MAKE_BOOTSTRAP) && defined(BSD)
#include <sys/cdefs.h>
#include <paths.h>
#else /* ...BSD */
#if defined(__STDC__) || defined(__cplusplus)
#define __P(protos) protos /* full-blown ANSI C */
#else /* ...STDC */
#define __P(protos) () /* traditional C preprocessor */
#endif /* ...STDC */
#endif /* ...BSD */
#if __STDC__
#include <stdlib.h>
#include <unistd.h>
#endif
/* These are really for MAKE_BOOTSTRAP but harmless. */
#ifndef __dead
#define __dead
#endif
#ifndef _PATH_DEVNULL
#define _PATH_DEVNULL "/dev/null"
#endif
/*
* Name/value lists. Values can be strings or pointers and/or can carry
* integers. The names can be NULL, resulting in simple value lists.
@ -203,7 +235,7 @@ struct files {
u_char fi_flags; /* as below */
char fi_lastc; /* last char from path */
const char *fi_path; /* full file path */
const char *fi_tail; /* name, i.e., rindex(fi_path, '/') + 1 */
const char *fi_tail; /* name, i.e., strrchr(fi_path, '/') + 1 */
const char *fi_base; /* tail minus ".c" (or whatever) */
struct nvlist *fi_optx;/* options expression */
struct nvlist *fi_optf;/* flattened version of above, if needed */
@ -308,6 +340,7 @@ void pack __P((void));
/* scan.l */
int currentline __P((void));
int include __P((const char *, int));
/* sem.c, other than for yacc actions */
void initsem __P((void));

View File

@ -1,4 +1,4 @@
/* $NetBSD: files.c,v 1.6 1996/03/17 13:18:17 cgd Exp $ */
/* $NetBSD: files.c,v 1.7 1996/11/07 22:59:41 gwr Exp $ */
/*
* Copyright (c) 1992, 1993
@ -120,12 +120,12 @@ addfile(path, optx, flags, rule)
}
/* find last part of pathname, and same without trailing suffix */
tail = rindex(path, '/');
tail = strrchr(path, '/');
if (tail == NULL)
tail = path;
else
tail++;
dotp = rindex(tail, '.');
dotp = strrchr(tail, '.');
if (dotp == NULL || dotp[1] == 0 ||
(baselen = dotp - tail) >= sizeof(base)) {
error("invalid pathname `%s'", path);

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: gram.y,v 1.10 1996/11/02 01:00:14 cgd Exp $ */
/* $NetBSD: gram.y,v 1.11 1996/11/07 22:59:42 gwr Exp $ */
/*
* Copyright (c) 1992, 1993
@ -49,7 +49,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash.c,v 1.3 1996/03/17 13:18:20 cgd Exp $ */
/* $NetBSD: hash.c,v 1.4 1996/11/07 22:59:43 gwr Exp $ */
/*
* Copyright (c) 1992, 1993
@ -49,6 +49,17 @@
#include <string.h>
#include "config.h"
/*
* These are really for MAKE_BOOTSTRAP but harmless.
* XXX - Why not just use malloc in here, anyway?
*/
#ifndef ALIGNBYTES
#define ALIGNBYTES 3
#endif
#ifndef ALIGN
#define ALIGN(p) (((long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
#endif
/*
* Interned strings are kept in a hash table. By making each string
* unique, the program can compare strings by comparing pointers.

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: scan.l,v 1.7 1996/08/31 21:15:13 mycroft Exp $ */
/* $NetBSD: scan.l,v 1.8 1996/11/07 22:59:44 gwr Exp $ */
/*
* Copyright (c) 1992, 1993
@ -58,8 +58,6 @@ int yyline;
const char *yyfile;
const char *lastfile;
int include __P((const char *, int));
/*
* Data for returning to previous files from include files.
*/

View File

@ -0,0 +1,19 @@
/*
* strerror() - for those systems that don't have it yet.
*/
/* These are part of the C library. (See perror.3) */
extern char *sys_errlist[];
extern int sys_nerr;
static char errmsg[80];
char *strerror(en)
int en;
{
if ((0 <= en) && (en < sys_nerr))
return sys_errlist[en];
sprintf(errmsg, "Error %d", en);
return errmsg;
}