svn commit: r217086 - releng/7.4/usr.sbin/config

Lawrence Stewart lstewart at FreeBSD.org
Fri Jan 7 01:50:26 UTC 2011


Author: lstewart
Date: Fri Jan  7 01:50:25 2011
New Revision: 217086
URL: http://svn.freebsd.org/changeset/base/217086

Log:
  MFC r210144 (originally committed by imp):
  
  Put warnings out to stderr rather than stdout.
  
  Approved by:	re (kib)

Modified:
  releng/7.4/usr.sbin/config/config.y
  releng/7.4/usr.sbin/config/mkmakefile.c
  releng/7.4/usr.sbin/config/mkoptions.c
Directory Properties:
  releng/7.4/usr.sbin/config/   (props changed)
  releng/7.4/usr.sbin/config/SMM.doc/   (props changed)

Modified: releng/7.4/usr.sbin/config/config.y
==============================================================================
--- releng/7.4/usr.sbin/config/config.y	Fri Jan  7 01:46:27 2011	(r217085)
+++ releng/7.4/usr.sbin/config/config.y	Fri Jan  7 01:50:25 2011	(r217086)
@@ -384,7 +384,8 @@ newdev(char *name)
 	struct device *np;
 
 	if (finddev(&dtab, name)) {
-		printf("WARNING: duplicate device `%s' encountered.\n", name);
+		fprintf(stderr,
+		    "WARNING: duplicate device `%s' encountered.\n", name);
 		return;
 	}
 
@@ -444,7 +445,8 @@ newopt(struct opt_head *list, char *name
 
 	op2 = findopt(list, name);
 	if (op2 != NULL && !append) {
-		printf("WARNING: duplicate option `%s' encountered.\n", name);
+		fprintf(stderr,
+		    "WARNING: duplicate option `%s' encountered.\n", name);
 		return;
 	}
 

Modified: releng/7.4/usr.sbin/config/mkmakefile.c
==============================================================================
--- releng/7.4/usr.sbin/config/mkmakefile.c	Fri Jan  7 01:46:27 2011	(r217085)
+++ releng/7.4/usr.sbin/config/mkmakefile.c	Fri Jan  7 01:50:25 2011	(r217086)
@@ -341,7 +341,8 @@ next:
 	if (eq(wd, "include")) {
 		next_quoted_word(fp, wd);
 		if (wd == 0) {
-			printf("%s: missing include filename.\n", fname);
+			fprintf(stderr, "%s: missing include filename.\n",
+			    fname);
 			exit(1);
 		}
 		(void) snprintf(ifname, sizeof(ifname), "../../%s", wd);
@@ -353,8 +354,7 @@ next:
 	this = ns(wd);
 	next_word(fp, wd);
 	if (wd == 0) {
-		printf("%s: No type for %s.\n",
-		    fname, this);
+		fprintf(stderr, "%s: No type for %s.\n", fname, this);
 		exit(1);
 	}
 	tp = fl_lookup(this);
@@ -381,8 +381,9 @@ next:
 	} else if (eq(wd, "mandatory")) {
 		mandatory = 1;
 	} else if (!eq(wd, "optional")) {
-		printf("%s: %s must be optional, mandatory or standard\n",
-		       fname, this);
+		fprintf(stderr,
+		    "%s: %s must be optional, mandatory or standard\n",
+		    fname, this);
 		exit(1);
 	}
 nextparam:
@@ -395,7 +396,7 @@ nextparam:
 	}
 	if (eq(wd, "|")) {
 		if (nreqs == 0) {
-			printf("%s: syntax error describing %s\n",
+			fprintf(stderr, "%s: syntax error describing %s\n",
 			    fname, this);
 			exit(1);
 		}
@@ -410,9 +411,9 @@ nextparam:
 	}
 	if (eq(wd, "no-implicit-rule")) {
 		if (compilewith == 0) {
-			printf("%s: alternate rule required when "
-			       "\"no-implicit-rule\" is specified.\n",
-			       fname);
+			fprintf(stderr, "%s: alternate rule required when "
+			    "\"no-implicit-rule\" is specified.\n",
+			    fname);
 		}
 		imp_rule++;
 		goto nextparam;
@@ -424,8 +425,9 @@ nextparam:
 	if (eq(wd, "dependency")) {
 		next_quoted_word(fp, wd);
 		if (wd == 0) {
-			printf("%s: %s missing compile command string.\n",
-			       fname, this);
+			fprintf(stderr,
+			    "%s: %s missing compile command string.\n",
+			    fname, this);
 			exit(1);
 		}
 		depends = ns(wd);
@@ -434,8 +436,8 @@ nextparam:
 	if (eq(wd, "clean")) {
 		next_quoted_word(fp, wd);
 		if (wd == 0) {
-			printf("%s: %s missing clean file list.\n",
-			       fname, this);
+			fprintf(stderr, "%s: %s missing clean file list.\n",
+			    fname, this);
 			exit(1);
 		}
 		clean = ns(wd);
@@ -444,8 +446,9 @@ nextparam:
 	if (eq(wd, "compile-with")) {
 		next_quoted_word(fp, wd);
 		if (wd == 0) {
-			printf("%s: %s missing compile command string.\n",
-			       fname, this);
+			fprintf(stderr,
+			    "%s: %s missing compile command string.\n",
+			    fname, this);
 			exit(1);
 		}
 		compilewith = ns(wd);
@@ -454,8 +457,9 @@ nextparam:
 	if (eq(wd, "warning")) {
 		next_quoted_word(fp, wd);
 		if (wd == 0) {
-			printf("%s: %s missing warning text string.\n",
-				fname, this);
+			fprintf(stderr,
+			    "%s: %s missing warning text string.\n",
+			    fname, this);
 			exit(1);
 		}
 		warning = ns(wd);
@@ -484,13 +488,14 @@ nextparam:
 			goto nextparam;
 		}
 	if (mandatory) {
-		printf("%s: mandatory device \"%s\" not found\n",
+		fprintf(stderr, "%s: mandatory device \"%s\" not found\n",
 		       fname, wd);
 		exit(1);
 	}
 	if (std) {
-		printf("standard entry %s has a device keyword - %s!\n",
-		       this, wd);
+		fprintf(stderr,
+		    "standard entry %s has a device keyword - %s!\n",
+		    this, wd);
 		exit(1);
 	}
 	SLIST_FOREACH(op, &opt, op_next)
@@ -501,13 +506,13 @@ nextparam:
 
 doneparam:
 	if (std == 0 && nreqs == 0) {
-		printf("%s: what is %s optional on?\n",
+		fprintf(stderr, "%s: what is %s optional on?\n",
 		    fname, this);
 		exit(1);
 	}
 
 	if (wd) {
-		printf("%s: syntax error describing %s\n",
+		fprintf(stderr, "%s: syntax error describing %s\n",
 		    fname, this);
 		exit(1);
 	}
@@ -687,7 +692,7 @@ do_rules(FILE *f)
 
 	STAILQ_FOREACH(ftp, &ftab, f_next) {
 		if (ftp->f_warn)
-			printf("WARNING: %s\n", ftp->f_warn);
+			fprintf(stderr, "WARNING: %s\n", ftp->f_warn);
 		cp = (np = ftp->f_fn) + strlen(ftp->f_fn) - 1;
 		och = *cp;
 		if (ftp->f_flags & NO_IMPLCT_RULE) {
@@ -732,7 +737,8 @@ do_rules(FILE *f)
 				ftype = "PROFILE";
 				break;
 			default:
-				printf("config: don't know rules for %s\n", np);
+				fprintf(stderr,
+				    "config: don't know rules for %s\n", np);
 				break;
 			}
 			snprintf(cmd, sizeof(cmd), "${%s_%c%s}\n"

Modified: releng/7.4/usr.sbin/config/mkoptions.c
==============================================================================
--- releng/7.4/usr.sbin/config/mkoptions.c	Fri Jan  7 01:46:27 2011	(r217085)
+++ releng/7.4/usr.sbin/config/mkoptions.c	Fri Jan  7 01:50:25 2011	(r217086)
@@ -77,12 +77,14 @@ options(void)
 	}	
 
 	if (maxusers == 0) {
-		/* printf("maxusers not specified; will auto-size\n"); */
+		/* fprintf(stderr, "maxusers not specified; will auto-size\n"); */
 	} else if (maxusers < users.u_min) {
-		printf("minimum of %d maxusers assumed\n", users.u_min);
+		fprintf(stderr, "minimum of %d maxusers assumed\n",
+		    users.u_min);
 		maxusers = users.u_min;
 	} else if (maxusers > users.u_max)
-		printf("warning: maxusers > %d (%d)\n", users.u_max, maxusers);
+		fprintf(stderr, "warning: maxusers > %d (%d)\n",
+		    users.u_max, maxusers);
 
 	/* Fake MAXUSERS as an option. */
 	op = (struct opt *)calloc(1, sizeof(*op));
@@ -112,7 +114,7 @@ options(void)
 		SLIST_FOREACH(ol, &otab, o_next) {
 			if (eq(op->op_name, ol->o_name) &&
 			    (ol->o_flags & OL_ALIAS)) {
-				printf("Mapping option %s to %s.\n",
+				fprintf(stderr, "Mapping option %s to %s.\n",
 				    op->op_name, ol->o_file);
 				op->op_name = ol->o_file;
 				break;
@@ -123,7 +125,7 @@ options(void)
 		do_option(ol->o_name);
 	SLIST_FOREACH(op, &opt, op_next) {
 		if (!op->op_ownfile && strncmp(op->op_name, "DEV_", 4)) {
-			printf("%s: unknown option \"%s\"\n",
+			fprintf(stderr, "%s: unknown option \"%s\"\n",
 			       PREFIX, op->op_name);
 			exit(1);
 		}
@@ -160,7 +162,7 @@ do_option(char *name)
 			if (value == NULL)
 				value = ns("1");
 			if (oldvalue != NULL && !eq(value, oldvalue))
-				printf(
+				fprintf(stderr,
 			    "%s: option \"%s\" redefined from %s to %s\n",
 				   PREFIX, op->op_name, oldvalue,
 				   value);
@@ -218,12 +220,14 @@ do_option(char *name)
 			if (eq(inw, ol->o_name))
 				break;
 		if (!eq(inw, name) && !ol) {
-			printf("WARNING: unknown option `%s' removed from %s\n",
-				inw, file);
+			fprintf(stderr,
+			    "WARNING: unknown option `%s' removed from %s\n",
+			    inw, file);
 			tidy++;
 		} else if (ol != NULL && !eq(basefile, ol->o_file)) {
-			printf("WARNING: option `%s' moved from %s to %s\n",
-				inw, basefile, ol->o_file);
+			fprintf(stderr,
+			    "WARNING: option `%s' moved from %s to %s\n",
+			    inw, basefile, ol->o_file);
 			tidy++;
 		} else {
 			op = (struct opt *) calloc(1, sizeof *op);
@@ -312,8 +316,8 @@ check_duplicate(const char *fname, const
 
 	SLIST_FOREACH(po, &otab, o_next) {
 		if (eq(po->o_name, this)) {
-			printf("%s: Duplicate option %s.\n",
-			       fname, this);
+			fprintf(stderr, "%s: Duplicate option %s.\n",
+			    fname, this);
 			exit(1);
 		}
 	}
@@ -347,7 +351,8 @@ update_option(const char *this, char *va
 			return;
 		}
 	}
-	printf("Compat option %s not listed in options file.\n", this);
+	fprintf(stderr, "Compat option %s not listed in options file.\n",
+	    this);
 	exit(1);
 }
 
@@ -375,8 +380,8 @@ read_option_file(const char *fname, int 
 			return (1);
 		if (val == 0) {
 			if (flags) {
-				printf("%s: compat file requires two words "
-				    "per line at %s\n", fname, this);
+				fprintf(stderr, "%s: compat file requires two"
+				    " words per line at %s\n", fname, this);
 				exit(1);
 			}
 			char *s = ns(this);


More information about the svn-src-all mailing list