diff main.c @ 143:ed45f2d8d3bc

Don't use the <err.h> functions. There are still people out there using legacy systems that are missing them.
author David A. Holland
date Sat, 13 Jul 2013 12:47:20 -0400
parents 26ee741196d1
children 1a7de2c68290
line wrap: on
line diff
--- a/main.c	Sat Jul 13 12:38:54 2013 -0400
+++ b/main.c	Sat Jul 13 12:47:20 2013 -0400
@@ -33,7 +33,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-#include <err.h>
 
 #include "version.h"
 #include "config.h"
@@ -143,7 +142,7 @@
 	char *val;
 
 	if (*str == '\0') {
-		warnx("-D: macro name expected");
+		complain(NULL, "-D: macro name expected");
 		die();
 	}
 
@@ -167,7 +166,7 @@
 commandline_undef(const struct place *p, char *str)
 {
 	if (*str == '\0') {
-		warnx("-D: macro name expected");
+		complain(NULL, "-D: macro name expected");
 		die();
 	}
 	commandline_macro_add(p, str, p, NULL);
@@ -374,7 +373,7 @@
 commandline_addincpath(struct stringarray *arr, char *s)
 {
 	if (*s == '\0') {
-		warnx("Empty include path");
+		complain(NULL, "Empty include directory");
 		die();
 	}
 	stringarray_add(arr, s, NULL);
@@ -491,7 +490,7 @@
 	char *s;
 
 	if (commandline_prefix == NULL) {
-		warnx("-iprefix needed");
+		complain(NULL, "-iprefix needed");
 		die();
 	}
 	s = dostrdup3(commandline_prefix, "/", dir);
@@ -506,7 +505,7 @@
 	char *s;
 
 	if (commandline_prefix == NULL) {
-		warnx("-iprefix needed");
+		complain(NULL, "-iprefix needed");
 		die();
 	}
 	s = dostrdup3(commandline_prefix, "/", dir);
@@ -523,7 +522,7 @@
 	if (!strcmp(std, "krc")) {
 		return;
 	}
-	warnx("Standard %s not supported by this preprocessor", std);
+	complain(NULL, "Standard %s not supported by this preprocessor", std);
 	die();
 }
 
@@ -536,7 +535,7 @@
 	if (!strcmp(lang, "c") || !strcmp(lang, "assembler-with-cpp")) {
 		return;
 	}
-	warnx("Language %s not supported by this preprocessor", lang);
+	complain(NULL, "Language %s not supported by this preprocessor", lang);
 	die();
 }
 
@@ -550,7 +549,7 @@
 	(void)p;
 	/* XXX */
 	(void)str;
-	warnx("-iremap not supported");
+	complain(NULL, "-iremap not supported");
 	die();
 }
 
@@ -566,18 +565,18 @@
 	t = strchr(s, '=');
 	if (t == NULL) {
 		/* should not happen */
-		warnx("Invalid tabstop");
+		complain(NULL, "Invalid tabstop");
 		die();
 	}
 	t++;
 	errno = 0;
 	val = strtoul(t, &t, 10);
 	if (errno || *t != '\0') {
-		warnx("Invalid tabstop");
+		complain(NULL, "Invalid tabstop");
 		die();
 	}
 	if (val > 64) {
-		warnx("Preposterously large tabstop");
+		complain(NULL, "Preposterously large tabstop");
 		die();
 	}
 	mode.input_tabstop = val;
@@ -920,7 +919,9 @@
 		r = strcmp(opt, arg_options[i].string);
 		if (r == 0) {
 			if (arg == NULL) {
-				warnx("Option -%s requires an argument", opt);
+				complain(NULL,
+					 "Option -%s requires an argument",
+					 opt);
 				die();
 			}
 			arg_options[i].func(argplace, arg);