Module Name:    src
Committed By:   rillig
Date:           Mon Dec 27 22:22:49 UTC 2021

Modified Files:
        src/usr.bin/make: main.c
        src/usr.bin/make/unit-tests: opt-debug-file.exp

Log Message:
make: remove usage message if the debug file cannot be opened

Since a non-writable file is not a syntax error, there is no point in
showing the usage in this situation.  Showing the usage may have been a
copy-and-paste mistake from a few lines below, when this option was
added back in main.c 1.133 from 2006-10-15.


To generate a diff of this commit:
cvs rdiff -u -r1.553 -r1.554 src/usr.bin/make/main.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-debug-file.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.553 src/usr.bin/make/main.c:1.554
--- src/usr.bin/make/main.c:1.553	Mon Dec 27 21:27:25 2021
+++ src/usr.bin/make/main.c	Mon Dec 27 22:22:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.553 2021/12/27 21:27:25 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.554 2021/12/27 22:22:48 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.553 2021/12/27 21:27:25 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.554 2021/12/27 22:22:48 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	    "The Regents of the University of California.  "
@@ -222,9 +222,9 @@ MainParseArgDebugFile(const char *arg)
 
 	opts.debug_file = fopen(fname, mode);
 	if (opts.debug_file == NULL) {
-		fprintf(stderr, "Cannot open debug file %s\n",
+		fprintf(stderr, "Cannot open debug file \"%s\"\n",
 		    fname);
-		usage();
+		exit(2);
 	}
 	free(fname);
 }

Index: src/usr.bin/make/unit-tests/opt-debug-file.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-file.exp:1.2 src/usr.bin/make/unit-tests/opt-debug-file.exp:1.3
--- src/usr.bin/make/unit-tests/opt-debug-file.exp:1.2	Mon Dec 27 22:04:20 2021
+++ src/usr.bin/make/unit-tests/opt-debug-file.exp	Mon Dec 27 22:22:48 2021
@@ -1,6 +1,2 @@
-Cannot open debug file opt-debug-file.debuglog/file
-usage: make [-BeikNnqrSstWwX]
-            [-C directory] [-D variable] [-d flags] [-f makefile]
-            [-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]
-            [-V variable] [-v variable] [variable=value] [target ...]
+Cannot open debug file "opt-debug-file.debuglog/file"
 exit status 2

Reply via email to