diff options
author | charnier <charnier@FreeBSD.org> | 2002-04-12 13:23:33 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 2002-04-12 13:23:33 +0000 |
commit | a67f50f0155e7abb5fdaf887a718c51a5980cf3d (patch) | |
tree | 605ee85c40271746a8d8bef8d3da881f8cd0467e /usr.bin/make | |
parent | 2ae20464b14a531edccecd7e009a9ca64b3c5382 (diff) | |
download | FreeBSD-src-a67f50f0155e7abb5fdaf887a718c51a5980cf3d.zip FreeBSD-src-a67f50f0155e7abb5fdaf887a718c51a5980cf3d.tar.gz |
Reorder #include. Cast arg #2 of lseek to an off_t when constant. No need to
test if failsafe memory allocation fails, it can't. perror -> warn. Use
failsafe memory allocation provided.
Use .Pa and .Ar. Uppercase (first letter) programname after dot.
Diffstat (limited to 'usr.bin/make')
-rw-r--r-- | usr.bin/make/job.c | 14 | ||||
-rw-r--r-- | usr.bin/make/main.c | 14 | ||||
-rw-r--r-- | usr.bin/make/make.1 | 30 |
3 files changed, 27 insertions, 31 deletions
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index b12b39a..b1aad95 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -108,13 +108,14 @@ __RCSID("$FreeBSD$"); #include <sys/file.h> #include <sys/time.h> #include <sys/wait.h> -#include <fcntl.h> +#include <err.h> #include <errno.h> -#include <utime.h> +#include <fcntl.h> #include <stdio.h> #include <string.h> #include <signal.h> #include <unistd.h> +#include <utime.h> #include "make.h" #include "hash.h" #include "dir.h" @@ -1062,7 +1063,7 @@ Job_Touch(gn, silent) * modification time, then close the file. */ if (read(streamID, &c, 1) == 1) { - (void) lseek(streamID, 0L, SEEK_SET); + (void) lseek(streamID, (off_t)0, SEEK_SET); (void) write(streamID, &c, 1); } @@ -1235,7 +1236,7 @@ JobExec(job, argv) if (dup2(FILENO(job->cmdFILE), 0) == -1) Punt("Cannot dup2: %s", strerror(errno)); (void) fcntl(0, F_SETFD, 0); - (void) lseek(0, 0, SEEK_SET); + (void) lseek(0, (off_t)0, SEEK_SET); if (usePipes) { /* @@ -1681,9 +1682,6 @@ JobStart(gn, flags, previous) job = previous; } else { job = (Job *) emalloc(sizeof(Job)); - if (job == NULL) { - Punt("JobStart out of memory"); - } flags |= JOB_FIRST; } @@ -2061,7 +2059,7 @@ end_loop: JOB_BUFSIZE - job->curPos); if (nRead < 0) { if (DEBUG(JOB)) { - perror("JobDoOutput(piperead)"); + warn("JobDoOutput(piperead)"); } nr = 0; } else { diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 027f0e4..ee42384 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -273,9 +273,7 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) { break; } case 'E': - p = malloc(strlen(optarg) + 1); - if (!p) - Punt("make: cannot allocate memory."); + p = emalloc(strlen(optarg) + 1); (void)strcpy(p, optarg); (void)Lst_AtEnd(envFirstVars, (void *)p); Var_Append(MAKEFLAGS, "-E", VAR_GLOBAL); @@ -529,10 +527,8 @@ main(argc, argv) #ifndef MACHINE struct utsname utsname; - if (uname(&utsname) == -1) { - perror("make: uname"); - exit(2); - } + if (uname(&utsname) == -1) + err(2, "uname"); machine = utsname.machine; #else machine = MACHINE; @@ -817,9 +813,7 @@ main(argc, argv) ln = Lst_Succ(ln)) { char *value; if (expandVars) { - p1 = malloc(strlen((char *)Lst_Datum(ln)) + 1 + 3); - if (!p1) - Punt("make: cannot allocate memory."); + p1 = emalloc(strlen((char *)Lst_Datum(ln)) + 1 + 3); /* This sprintf is safe, because of the malloc above */ (void)sprintf(p1, "${%s}", (char *)Lst_Datum(ln)); value = Var_Subst(NULL, p1, VAR_GLOBAL, FALSE); diff --git a/usr.bin/make/make.1 b/usr.bin/make/make.1 index 3338778..10ca5d3 100644 --- a/usr.bin/make/make.1 +++ b/usr.bin/make/make.1 @@ -139,7 +139,9 @@ macro assignments within makefiles. Specify that environment values override macro assignments within makefiles for all variables. .It Fl f Ar makefile -Specify a makefile to read instead of the default +Specify a +.Ar makefile +to read instead of the default .Ql Pa makefile and .Ql Pa Makefile . @@ -170,8 +172,9 @@ flag is also specified. Continue processing after errors are encountered, but only on those targets that do not depend on the target whose creation caused the error. .It Fl m Ar directory -Specify a directory in which to search for sys.mk and makefiles included -via the <...> style. +Specify a directory in which to search for +.Pa sys.mk +and makefiles included via the <...> style. Multiple directories can be added to form a search path. This path will override the default system include path: .Pa /usr/share/mk . @@ -465,7 +468,7 @@ was executed with A path to the directory where .Nm was executed. -.Nm +.Nm Make sets .Va .CURDIR to the canonical path given by @@ -510,7 +513,7 @@ If they are undefined and is unable to change into any of the remaining three directories, then the current directory is used. .Pp -.Nm +.Nm Make sets .Va .OBJDIR to the canonical path given by @@ -569,9 +572,7 @@ Makefiles may assign a colon-delimited list of directories to .Va VPATH . These directories will be searched for source files by .Nm -after -.Nm -has finished parsing all input makefiles. +after it has finished parsing all input makefiles. .El .Pp Variable expansion may be modified to select or modify each word of the @@ -643,7 +644,7 @@ the rest of the modifier. .It Cm Q Quotes every shell meta-character in the variable, so that it can be passed safely through recursive invocations of -.Nm . +.Nm Ns . .It Cm R Replaces each word in the variable with everything but its suffix. .Sm off @@ -719,7 +720,7 @@ Converts variable to upper-case letters. .Sh DIRECTIVES, CONDITIONALS, AND FOR LOOPS Directives, conditionals, and for loops reminiscent of the C programming language are provided in -.Nm . +.Nm Ns . All such structures are identified by a line beginning with a single dot .Pq Ql \&. @@ -844,7 +845,8 @@ The may be any one of the following: .Bl -tag -width "Cm XX" .It Cm \&|\&| -logical OR +logical +.Tn OR .It Cm \&&& Logical .Tn AND ; @@ -1097,7 +1099,9 @@ no effect. .It Ic .NOTPARALLEL Disable parallel mode. .It Ic .NO_PARALLEL -Same as above, for compatibility with other pmake variants. +Same as above, for compatibility with other +.Nm pmake +variants. .It Ic .ORDER The named targets are made in sequence. .\" XXX: NOT YET!!!! @@ -1149,7 +1153,7 @@ attribute is applied to every command in the file. .It Ic .SUFFIXES Each source specifies a suffix to -.Nm . +.Nm Ns . If no sources are specified, any previous specified suffices are deleted. .El .Sh COMPATIBILITY |