diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-02-22 22:24:52 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-02-22 22:24:52 +0000 |
commit | a1af50e492a0fe75c1d06ee538abb365947fb218 (patch) | |
tree | a7a2100c944ccfdda0a9e30241ed8e972ef1a600 /usr.bin/make | |
parent | dceae2c8b9b6e9a2e7437fd943b4cdc48dc409cc (diff) |
From NetBSD:
Support SVR4 style archives.
Fix pr/1421 (from Matthew Green) and pr/1997 (from Jeff Thieleke).
In ParseDoInclude(), make a temporary copy of the current file name
while searching for ""-type include files, since the current file name
might not be a writeable string.
Diffstat (limited to 'usr.bin/make')
-rw-r--r-- | usr.bin/make/Makefile | 4 | ||||
-rw-r--r-- | usr.bin/make/arch.c | 24 | ||||
-rw-r--r-- | usr.bin/make/config.h | 8 | ||||
-rw-r--r-- | usr.bin/make/dir.c | 8 | ||||
-rw-r--r-- | usr.bin/make/job.c | 27 | ||||
-rw-r--r-- | usr.bin/make/lst.h | 4 | ||||
-rw-r--r-- | usr.bin/make/main.c | 6 | ||||
-rw-r--r-- | usr.bin/make/make.h | 4 | ||||
-rw-r--r-- | usr.bin/make/parse.c | 14 |
9 files changed, 60 insertions, 39 deletions
diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile index 5a6b7a0bfd5..1405f3ee50f 100644 --- a/usr.bin/make/Makefile +++ b/usr.bin/make/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.8 1995/06/14 15:18:37 christos Exp $ +# $NetBSD: Makefile,v 1.9 1996/02/04 22:20:27 christos Exp $ # @(#)Makefile 5.2 (Berkeley) 12/28/90 PROG= make -CFLAGS+= -I${.CURDIR} -DPOSIX +CFLAGS+= -I${.CURDIR} -DPOSIX -DSYSVINCLUDE SRCS= arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \ make.c parse.c str.c suff.c targ.c var.c SRCS+= lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \ diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index 89a84be3e98..a66af088ed9 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.11 1995/11/22 17:39:53 christos Exp $ */ +/* $NetBSD: arch.c,v 1.13 1996/02/04 22:20:34 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)arch.c 5.7 (Berkeley) 12/28/90"; #else -static char rcsid[] = "$NetBSD: arch.c,v 1.11 1995/11/22 17:39:53 christos Exp $"; +static char rcsid[] = "$NetBSD: arch.c,v 1.13 1996/02/04 22:20:34 christos Exp $"; #endif #endif /* not lint */ @@ -100,9 +100,10 @@ static char rcsid[] = "$NetBSD: arch.c,v 1.11 1995/11/22 17:39:53 christos Exp $ #include <sys/param.h> #include <ctype.h> #include <ar.h> -#ifndef __svr4__ +#if !defined(__svr4__) && !defined(__SVR4) #include <ranlib.h> #endif +#include <utime.h> #include <stdio.h> #include <stdlib.h> #include "make.h" @@ -561,6 +562,12 @@ ArchStatMember (archive, member, hash) } cp[1] = '\0'; +#if defined(__svr4__) || defined(__SVR4) + /* svr4 names are slash terminated */ + if (cp[0] == '/') + cp[0] = '\0'; +#endif + #ifdef AR_EFMT1 /* * BSD 4.4 extended AR format: #1/<namelen>, with name as the @@ -828,9 +835,10 @@ void Arch_TouchLib (gn) GNode *gn; /* The node of the library to touch */ { +#ifdef RANLIBMAG FILE * arch; /* Stream open to archive */ struct ar_hdr arh; /* Header describing table of contents */ - struct timeval times[2]; /* Times for utimes() call */ + struct utimbuf times; /* Times for utime() call */ arch = ArchFindMember (gn->path, RANLIBMAG, &arh, "r+"); sprintf(arh.ar_date, "%-12ld", (long) now); @@ -839,10 +847,10 @@ Arch_TouchLib (gn) (void)fwrite ((char *)&arh, sizeof (struct ar_hdr), 1, arch); fclose (arch); - times[0].tv_sec = times[1].tv_sec = now; - times[0].tv_usec = times[1].tv_usec = 0; - utimes(gn->path, times); + times.actime = times.modtime = now; + utime(gn->path, ×); } +#endif } /*- @@ -983,7 +991,7 @@ Arch_FindLib (gn, path) Var_Set (TARGET, gn->name, gn); #else Var_Set (TARGET, gn->path == (char *) NULL ? gn->name : gn->path, gn); -#endif LIBRARIES +#endif /* LIBRARIES */ } /*- diff --git a/usr.bin/make/config.h b/usr.bin/make/config.h index 7d2324c612d..f49e7d62c31 100644 --- a/usr.bin/make/config.h +++ b/usr.bin/make/config.h @@ -1,4 +1,4 @@ -/* $NetBSD: config.h,v 1.4 1995/06/14 15:19:03 christos Exp $ */ +/* $NetBSD: config.h,v 1.5 1996/02/04 20:34:43 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -88,7 +88,9 @@ #define LIBSUFF ".a" #define RECHECK -#ifndef RANLIBMAG -#define RANLIBMAG "__.SYMDEF" +#if !defined(__svr4__) && !defined(__SVR4) +# ifndef RANLIBMAG +# define RANLIBMAG "__.SYMDEF" +# endif #endif /*#define POSIX*/ diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c index abb30fec5dd..75eb6e3bb2e 100644 --- a/usr.bin/make/dir.c +++ b/usr.bin/make/dir.c @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.9 1995/11/22 17:40:05 christos Exp $ */ +/* $NetBSD: dir.c,v 1.10 1996/02/04 22:20:38 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)dir.c 5.6 (Berkeley) 12/28/90"; #else -static char rcsid[] = "$NetBSD: dir.c,v 1.9 1995/11/22 17:40:05 christos Exp $"; +static char rcsid[] = "$NetBSD: dir.c,v 1.10 1996/02/04 22:20:38 christos Exp $"; #endif #endif /* not lint */ @@ -1065,7 +1065,7 @@ Dir_AddDir (path, name) (void)readdir(d); while ((dp = readdir (d)) != (struct dirent *) NULL) { -#if defined(sun) && !defined(__svr4__) +#if defined(sun) && defined(d_ino) /* d_ino is a sunos4 #define for d_fileno */ /* * The sun directory library doesn't check for a 0 inode * (0-inode slots just take up space), so we have to do @@ -1074,7 +1074,7 @@ Dir_AddDir (path, name) if (dp->d_fileno == 0) { continue; } -#endif /* sun && !__svr4__ */ +#endif /* sun && d_ino */ (void)Hash_CreateEntry(&p->files, dp->d_name, (Boolean *)NULL); } (void) closedir (d); diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index f6b9dda0368..112bad95ce5 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.13 1995/11/22 17:40:09 christos Exp $ */ +/* $NetBSD: job.c,v 1.14 1996/02/04 22:20:42 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)job.c 5.15 (Berkeley) 3/1/91"; #else -static char rcsid[] = "$NetBSD: job.c,v 1.13 1995/11/22 17:40:09 christos Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.14 1996/02/04 22:20:42 christos Exp $"; #endif #endif /* not lint */ @@ -109,6 +109,7 @@ static char rcsid[] = "$NetBSD: job.c,v 1.13 1995/11/22 17:40:09 christos Exp $" #include <sys/wait.h> #include <fcntl.h> #include <errno.h> +#include <utime.h> #include <signal.h> #include <stdio.h> #include <string.h> @@ -375,6 +376,7 @@ JobPassSig(signo) int signo; /* The signal number we've received */ { sigset_t nmask, omask; + struct sigaction act; if (DEBUG(JOB)) { (void) fprintf(stdout, "JobPassSig(%d) called.\n", signo); @@ -406,8 +408,13 @@ JobPassSig(signo) * This ensures that all our jobs get continued when we wake up before * we take any other signal. */ - sigfillset(&nmask); - (void) sigprocmask(SIG_BLOCK, &nmask, &omask); + sigemptyset(&nmask); + sigaddset(&nmask, signo); + sigprocmask(SIG_SETMASK, &nmask, &omask); + act.sa_handler = SIG_DFL; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + sigaction(signo, &act, NULL); if (DEBUG(JOB)) { (void) fprintf(stdout, @@ -423,8 +430,9 @@ JobPassSig(signo) Lst_ForEach(jobs, JobCondPassSig, (ClientData) &signo); (void) sigprocmask(SIG_SETMASK, &omask, NULL); - (void) signal(signo, JobPassSig); - + sigprocmask(SIG_SETMASK, &omask, NULL); + act.sa_handler = JobPassSig; + sigaction(signo, &act, NULL); } /*- @@ -1009,7 +1017,7 @@ Job_Touch(gn, silent) Boolean silent; /* TRUE if should not print messages */ { int streamID; /* ID of stream opened to do the touch */ - struct timeval times[2]; /* Times for utimes() call */ + struct utimbuf times; /* Times for utime() call */ if (gn->type & (OP_JOIN|OP_USE|OP_EXEC|OP_OPTIONAL)) { /* @@ -1035,9 +1043,8 @@ Job_Touch(gn, silent) } else { char *file = gn->path ? gn->path : gn->name; - times[0].tv_sec = times[1].tv_sec = now; - times[0].tv_usec = times[1].tv_usec = 0; - if (utimes(file, times) < 0){ + times.actime = times.modtime = now; + if (utime(file, ×) < 0){ streamID = open(file, O_RDWR | O_CREAT, 0666); if (streamID >= 0) { diff --git a/usr.bin/make/lst.h b/usr.bin/make/lst.h index 9b783c25495..e48945bcb69 100644 --- a/usr.bin/make/lst.h +++ b/usr.bin/make/lst.h @@ -1,4 +1,4 @@ -/* $NetBSD: lst.h,v 1.5 1995/06/14 15:19:31 christos Exp $ */ +/* $NetBSD: lst.h,v 1.6 1996/02/04 22:20:46 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -48,7 +48,7 @@ #define _LST_H_ #include <sprite.h> -#include <sys/cdefs.h> +#include <sys/param.h> #if __STDC__ #include <stdlib.h> #endif diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 5ff3e33217d..6aec6531a2f 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.23 1995/11/22 17:40:14 christos Exp $ */ +/* $NetBSD: main.c,v 1.24 1996/02/04 22:20:49 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -48,7 +48,7 @@ char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 5.25 (Berkeley) 4/1/91"; #else -static char rcsid[] = "$NetBSD: main.c,v 1.23 1995/11/22 17:40:14 christos Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.24 1996/02/04 22:20:49 christos Exp $"; #endif #endif /* not lint */ @@ -103,7 +103,7 @@ static char rcsid[] = "$NetBSD: main.c,v 1.23 1995/11/22 17:40:14 christos Exp $ #ifndef DEFMAXLOCAL #define DEFMAXLOCAL DEFMAXJOBS -#endif DEFMAXLOCAL +#endif /* DEFMAXLOCAL */ #define MAKEFLAGS ".MAKEFLAGS" diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h index de81246c8dc..b28ed3021d4 100644 --- a/usr.bin/make/make.h +++ b/usr.bin/make/make.h @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.7 1995/12/16 05:03:11 christos Exp $ */ +/* $NetBSD: make.h,v 1.8 1996/02/04 22:20:53 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -52,7 +52,7 @@ #include <stdio.h> #include <string.h> #include <ctype.h> -#ifndef MAKE_BOOTSTRAP +#if !defined(MAKE_BOOTSTRAP) && defined(BSD) #include <sys/cdefs.h> #else #if defined(__STDC__) || defined(__cplusplus) diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index d654157ef5d..785fad21dff 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.18 1995/12/16 05:03:13 christos Exp $ */ +/* $NetBSD: parse.c,v 1.19 1996/02/07 23:04:04 thorpej Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)parse.c 5.18 (Berkeley) 2/19/91"; #else -static char rcsid[] = "$NetBSD: parse.c,v 1.18 1995/12/16 05:03:13 christos Exp $"; +static char rcsid[] = "$NetBSD: parse.c,v 1.19 1996/02/07 23:04:04 thorpej Exp $"; #endif #endif /* not lint */ @@ -1728,9 +1728,12 @@ ParseDoInclude (file) * leading path components and call Dir_FindFile to see if * we can locate the beast. */ - char *prefEnd; + char *prefEnd, *Fname; - prefEnd = strrchr (fname, '/'); + /* Make a temporary copy of this, to be safe. */ + Fname = strdup(fname); + + prefEnd = strrchr (Fname, '/'); if (prefEnd != (char *)NULL) { char *newName; @@ -1738,7 +1741,7 @@ ParseDoInclude (file) if (file[0] == '/') newName = strdup(file); else - newName = str_concat (fname, file, STR_ADDSLASH); + newName = str_concat (Fname, file, STR_ADDSLASH); fullname = Dir_FindFile (newName, parseIncPath); if (fullname == (char *)NULL) { fullname = Dir_FindFile(newName, dirSearchPath); @@ -1748,6 +1751,7 @@ ParseDoInclude (file) } else { fullname = (char *)NULL; } + free (Fname); } else { fullname = (char *)NULL; } |