Sun Nov 8 08:53:22 2020 UTC ()
make(1): use common indentation style for else


(rillig)
diff -r1.443 -r1.444 src/usr.bin/make/main.c
diff -r1.190 -r1.191 src/usr.bin/make/make.c
diff -r1.66 -r1.67 src/usr.bin/make/util.c

cvs diff -r1.443 -r1.444 src/usr.bin/make/main.c (expand / switch to unified diff)

--- src/usr.bin/make/main.c 2020/11/08 02:56:43 1.443
+++ src/usr.bin/make/main.c 2020/11/08 08:53:22 1.444
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: main.c,v 1.443 2020/11/08 02:56:43 rillig Exp $ */ 1/* $NetBSD: main.c,v 1.444 2020/11/08 08:53:22 rillig Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1989, 1990, 1993 4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor. 8 * Adam de Boor.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -99,27 +99,27 @@ @@ -99,27 +99,27 @@
99 99
100#include <errno.h> 100#include <errno.h>
101#include <signal.h> 101#include <signal.h>
102#include <stdarg.h> 102#include <stdarg.h>
103#include <time.h> 103#include <time.h>
104 104
105#include "make.h" 105#include "make.h"
106#include "dir.h" 106#include "dir.h"
107#include "job.h" 107#include "job.h"
108#include "pathnames.h" 108#include "pathnames.h"
109#include "trace.h" 109#include "trace.h"
110 110
111/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ 111/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
112MAKE_RCSID("$NetBSD: main.c,v 1.443 2020/11/08 02:56:43 rillig Exp $"); 112MAKE_RCSID("$NetBSD: main.c,v 1.444 2020/11/08 08:53:22 rillig Exp $");
113#if defined(MAKE_NATIVE) && !defined(lint) 113#if defined(MAKE_NATIVE) && !defined(lint)
114__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " 114__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
115 "The Regents of the University of California. " 115 "The Regents of the University of California. "
116 "All rights reserved."); 116 "All rights reserved.");
117#endif 117#endif
118 118
119#ifndef DEFMAXLOCAL 119#ifndef DEFMAXLOCAL
120#define DEFMAXLOCAL DEFMAXJOBS 120#define DEFMAXLOCAL DEFMAXJOBS
121#endif 121#endif
122 122
123CmdOpts opts; 123CmdOpts opts;
124time_t now; /* Time at start of make */ 124time_t now; /* Time at start of make */
125GNode *DEFAULT; /* .DEFAULT node */ 125GNode *DEFAULT; /* .DEFAULT node */
@@ -248,32 +248,30 @@ parse_debug_options(const char *argvalue @@ -248,32 +248,30 @@ parse_debug_options(const char *argvalue
248 case 'd': 248 case 'd':
249 opts.debug |= DEBUG_DIR; 249 opts.debug |= DEBUG_DIR;
250 break; 250 break;
251 case 'e': 251 case 'e':
252 opts.debug |= DEBUG_ERROR; 252 opts.debug |= DEBUG_ERROR;
253 break; 253 break;
254 case 'f': 254 case 'f':
255 opts.debug |= DEBUG_FOR; 255 opts.debug |= DEBUG_FOR;
256 break; 256 break;
257 case 'g': 257 case 'g':
258 if (modules[1] == '1') { 258 if (modules[1] == '1') {
259 opts.debug |= DEBUG_GRAPH1; 259 opts.debug |= DEBUG_GRAPH1;
260 ++modules; 260 ++modules;
261 } 261 } else if (modules[1] == '2') {
262 else if (modules[1] == '2') { 
263 opts.debug |= DEBUG_GRAPH2; 262 opts.debug |= DEBUG_GRAPH2;
264 ++modules; 263 ++modules;
265 } 264 } else if (modules[1] == '3') {
266 else if (modules[1] == '3') { 
267 opts.debug |= DEBUG_GRAPH3; 265 opts.debug |= DEBUG_GRAPH3;
268 ++modules; 266 ++modules;
269 } 267 }
270 break; 268 break;
271 case 'h': 269 case 'h':
272 opts.debug |= DEBUG_HASH; 270 opts.debug |= DEBUG_HASH;
273 break; 271 break;
274 case 'j': 272 case 'j':
275 opts.debug |= DEBUG_JOB; 273 opts.debug |= DEBUG_JOB;
276 break; 274 break;
277 case 'L': 275 case 'L':
278 opts.debug |= DEBUG_LINT; 276 opts.debug |= DEBUG_LINT;
279 break; 277 break;

cvs diff -r1.190 -r1.191 src/usr.bin/make/make.c (expand / switch to unified diff)

--- src/usr.bin/make/make.c 2020/11/08 08:33:07 1.190
+++ src/usr.bin/make/make.c 2020/11/08 08:53:22 1.191
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: make.c,v 1.190 2020/11/08 08:33:07 rillig Exp $ */ 1/* $NetBSD: make.c,v 1.191 2020/11/08 08:53:22 rillig Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1989, 1990, 1993 4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor. 8 * Adam de Boor.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -98,27 +98,27 @@ @@ -98,27 +98,27 @@
98 * GNode_IsOODate Determine if a target is out-of-date. 98 * GNode_IsOODate Determine if a target is out-of-date.
99 * 99 *
100 * Make_HandleUse See if a child is a .USE node for a parent 100 * Make_HandleUse See if a child is a .USE node for a parent
101 * and perform the .USE actions if so. 101 * and perform the .USE actions if so.
102 * 102 *
103 * Make_ExpandUse Expand .USE nodes 103 * Make_ExpandUse Expand .USE nodes
104 */ 104 */
105 105
106#include "make.h" 106#include "make.h"
107#include "dir.h" 107#include "dir.h"
108#include "job.h" 108#include "job.h"
109 109
110/* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ 110/* "@(#)make.c 8.1 (Berkeley) 6/6/93" */
111MAKE_RCSID("$NetBSD: make.c,v 1.190 2020/11/08 08:33:07 rillig Exp $"); 111MAKE_RCSID("$NetBSD: make.c,v 1.191 2020/11/08 08:53:22 rillig Exp $");
112 112
113/* Sequence # to detect recursion. */ 113/* Sequence # to detect recursion. */
114static unsigned int checked = 1; 114static unsigned int checked = 1;
115 115
116/* The current fringe of the graph. 116/* The current fringe of the graph.
117 * These are nodes which await examination by MakeOODate. 117 * These are nodes which await examination by MakeOODate.
118 * It is added to by Make_Update and subtracted from by MakeStartJobs */ 118 * It is added to by Make_Update and subtracted from by MakeStartJobs */
119static GNodeList *toBeMade; 119static GNodeList *toBeMade;
120 120
121static int MakeCheckOrder(void *, void *); 121static int MakeCheckOrder(void *, void *);
122static int MakeBuildParent(void *, void *); 122static int MakeBuildParent(void *, void *);
123 123
124void 124void
@@ -540,28 +540,27 @@ Make_Recheck(GNode *gn) @@ -540,28 +540,27 @@ Make_Recheck(GNode *gn)
540 * little, so this stuff is commented out unless you're sure it's ok. 540 * little, so this stuff is commented out unless you're sure it's ok.
541 * -- ardeb 1/12/88 541 * -- ardeb 1/12/88
542 */ 542 */
543 /* 543 /*
544 * Christos, 4/9/92: If we are saving commands pretend that 544 * Christos, 4/9/92: If we are saving commands pretend that
545 * the target is made now. Otherwise archives with ... rules 545 * the target is made now. Otherwise archives with ... rules
546 * don't work! 546 * don't work!
547 */ 547 */
548 if (!GNode_ShouldExecute(gn) || (gn->type & OP_SAVE_CMDS) || 548 if (!GNode_ShouldExecute(gn) || (gn->type & OP_SAVE_CMDS) ||
549 (mtime == 0 && !(gn->type & OP_WAIT))) { 549 (mtime == 0 && !(gn->type & OP_WAIT))) {
550 DEBUG2(MAKE, " recheck(%s): update time from %s to now\n", 550 DEBUG2(MAKE, " recheck(%s): update time from %s to now\n",
551 gn->name, Targ_FmtTime(gn->mtime)); 551 gn->name, Targ_FmtTime(gn->mtime));
552 gn->mtime = now; 552 gn->mtime = now;
553 } 553 } else {
554 else { 
555 DEBUG2(MAKE, " recheck(%s): current update time: %s\n", 554 DEBUG2(MAKE, " recheck(%s): current update time: %s\n",
556 gn->name, Targ_FmtTime(gn->mtime)); 555 gn->name, Targ_FmtTime(gn->mtime));
557 } 556 }
558#endif 557#endif
559 return mtime; 558 return mtime;
560} 559}
561 560
562/* 561/*
563 * Set the .PREFIX and .IMPSRC variables for all the implied parents 562 * Set the .PREFIX and .IMPSRC variables for all the implied parents
564 * of this node. 563 * of this node.
565 */ 564 */
566static void 565static void
567UpdateImplicitParentsVars(GNode *cgn, const char *cname) 566UpdateImplicitParentsVars(GNode *cgn, const char *cname)

cvs diff -r1.66 -r1.67 src/usr.bin/make/util.c (expand / switch to unified diff)

--- src/usr.bin/make/util.c 2020/11/07 22:29:58 1.66
+++ src/usr.bin/make/util.c 2020/11/08 08:53:22 1.67
@@ -1,45 +1,44 @@ @@ -1,45 +1,44 @@
1/* $NetBSD: util.c,v 1.66 2020/11/07 22:29:58 rillig Exp $ */ 1/* $NetBSD: util.c,v 1.67 2020/11/08 08:53:22 rillig Exp $ */
2 2
3/* 3/*
4 * Missing stuff from OS's 4 * Missing stuff from OS's
5 */ 5 */
6#if defined(__MINT__) || defined(__linux__) 6#if defined(__MINT__) || defined(__linux__)
7#include <signal.h> 7#include <signal.h>
8#endif 8#endif
9 9
10#include <sys/param.h> 10#include <sys/param.h>
11 11
12#include <errno.h> 12#include <errno.h>
13#include <time.h> 13#include <time.h>
14#include <signal.h> 14#include <signal.h>
15 15
16#include "make.h" 16#include "make.h"
17 17
18MAKE_RCSID("$NetBSD: util.c,v 1.66 2020/11/07 22:29:58 rillig Exp $"); 18MAKE_RCSID("$NetBSD: util.c,v 1.67 2020/11/08 08:53:22 rillig Exp $");
19 19
20#if !defined(MAKE_NATIVE) && !defined(HAVE_STRERROR) 20#if !defined(MAKE_NATIVE) && !defined(HAVE_STRERROR)
21extern int errno, sys_nerr; 21extern int errno, sys_nerr;
22extern char *sys_errlist[]; 22extern char *sys_errlist[];
23 23
24char * 24char *
25strerror(int e) 25strerror(int e)
26{ 26{
27 static char buf[100]; 27 static char buf[100];
28 if (e < 0 || e >= sys_nerr) { 28 if (e < 0 || e >= sys_nerr) {
29 snprintf(buf, sizeof buf, "Unknown error %d", e); 29 snprintf(buf, sizeof buf, "Unknown error %d", e);
30 return buf; 30 return buf;
31 } 31 } else
32 else 
33 return sys_errlist[e]; 32 return sys_errlist[e];
34} 33}
35#endif 34#endif
36 35
37#if !defined(MAKE_NATIVE) && !defined(HAVE_SETENV) 36#if !defined(MAKE_NATIVE) && !defined(HAVE_SETENV)
38extern char **environ; 37extern char **environ;
39 38
40static char * 39static char *
41findenv(const char *name, int *offset) 40findenv(const char *name, int *offset)
42{ 41{
43 size_t i, len; 42 size_t i, len;
44 char *p, *q; 43 char *p, *q;
45 44
@@ -281,28 +280,27 @@ getwd(char *pathname) @@ -281,28 +280,27 @@ getwd(char *pathname)
281 if ((dp = opendir(nextpathptr)) == NULL) { 280 if ((dp = opendir(nextpathptr)) == NULL) {
282 (void)sprintf(pathname, 281 (void)sprintf(pathname,
283 "getwd: Cannot open directory \"%s\" (%s)", 282 "getwd: Cannot open directory \"%s\" (%s)",
284 nextpathptr, strerror(errno)); 283 nextpathptr, strerror(errno));
285 return NULL; 284 return NULL;
286 } 285 }
287 286
288 /* look in the parent for the entry with the same inode */ 287 /* look in the parent for the entry with the same inode */
289 if (DEV_DEV_COMPARE(st_dotdot.st_dev, st_cur.st_dev)) { 288 if (DEV_DEV_COMPARE(st_dotdot.st_dev, st_cur.st_dev)) {
290 /* Parent has same device. No need to stat every member */ 289 /* Parent has same device. No need to stat every member */
291 for (d = readdir(dp); d != NULL; d = readdir(dp)) 290 for (d = readdir(dp); d != NULL; d = readdir(dp))
292 if (d->d_fileno == st_cur.st_ino) 291 if (d->d_fileno == st_cur.st_ino)
293 break; 292 break;
294 } 293 } else {
295 else { 
296 /* 294 /*
297 * Parent has a different device. This is a mount point so we 295 * Parent has a different device. This is a mount point so we
298 * need to stat every member 296 * need to stat every member
299 */ 297 */
300 for (d = readdir(dp); d != NULL; d = readdir(dp)) { 298 for (d = readdir(dp); d != NULL; d = readdir(dp)) {
301 if (ISDOT(d->d_name) || ISDOTDOT(d->d_name)) 299 if (ISDOT(d->d_name) || ISDOTDOT(d->d_name))
302 continue; 300 continue;
303 (void)strcpy(cur_name_add, d->d_name); 301 (void)strcpy(cur_name_add, d->d_name);
304 if (lstat(nextpathptr, &st_next) == -1) { 302 if (lstat(nextpathptr, &st_next) == -1) {
305 (void)sprintf(pathname, 303 (void)sprintf(pathname,
306 "getwd: Cannot stat \"%s\" (%s)", 304 "getwd: Cannot stat \"%s\" (%s)",
307 d->d_name, strerror(errno)); 305 d->d_name, strerror(errno));
308 (void)closedir(dp); 306 (void)closedir(dp);