# HG changeset patch # User David A. Holland # Date 1373734040 14400 # Node ID ed45f2d8d3bcce8ec7011687c8737aff8ce1a323 # Parent 26ee741196d178c5d22f49b3257f2a08d91f8839 Don't use the functions. There are still people out there using legacy systems that are missing them. diff -r 26ee741196d1 -r ed45f2d8d3bc CHANGES --- a/CHANGES Sat Jul 13 12:38:54 2013 -0400 +++ b/CHANGES Sat Jul 13 12:47:20 2013 -0400 @@ -2,6 +2,8 @@ - Fix stupid build problem introduced in 0.3.1. - Accept and ignore -m32. I thought this had already been done, but apparently not. + - Don't use the functions. There are still people out there + using legacy systems that are missing them. release 0.3.1 (20130709) - Don't leak memory and assert if a bad command-line option comes diff -r 26ee741196d1 -r ed45f2d8d3bc files.c --- a/files.c Sat Jul 13 12:38:54 2013 -0400 +++ b/files.c Sat Jul 13 12:47:20 2013 -0400 @@ -34,7 +34,6 @@ #include #include #include -#include #include "array.h" #include "mode.h" @@ -214,7 +213,8 @@ if (result == -1) { /* read error */ - warn("%s", name); + complain(NULL, "%s: %s", + name, strerror(errno)); complain_fail(); } else if (result == 0 && bufend == linestart) { /* eof */ @@ -332,7 +332,7 @@ fd = open(file, O_RDONLY); if (fd < 0) { if (errno != ENOENT && errno != ENOTDIR) { - warn("%s", file); + complain(NULL, "%s: %s", file, strerror(errno)); } return -1; } @@ -406,7 +406,7 @@ } else { fd = file_tryopen(name); if (fd < 0) { - warn("%s", name); + complain(NULL, "%s: %s", name, strerror(errno)); die(); } pf = place_addfile(place, name, false); diff -r 26ee741196d1 -r ed45f2d8d3bc main.c --- 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 #include #include -#include #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); diff -r 26ee741196d1 -r ed45f2d8d3bc output.c --- a/output.c Sat Jul 13 12:38:54 2013 -0400 +++ b/output.c Sat Jul 13 12:47:20 2013 -0400 @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include "utils.h" #include "mode.h" @@ -53,7 +53,8 @@ outputfd = open(mode.output_file, O_WRONLY|O_CREAT|O_TRUNC, 0664); if (outputfd < 0) { - warn("%s", mode.output_file); + complain(NULL, "%s: %s", + mode.output_file, strerror(errno)); die(); } } @@ -79,11 +80,13 @@ while (done < len) { result = write(outputfd, buf+done, len-done); if (result == -1) { - warn("%s: write", mode.output_file); + complain(NULL, "%s: write: %s", + mode.output_file, strerror(errno)); complain_failed(); write_errors++; if (write_errors > 5) { - warnx("%s: giving up", mode.output_file); + complain(NULL, "%s: giving up", + mode.output_file); die(); } /* XXX is this really a good idea? */ diff -r 26ee741196d1 -r ed45f2d8d3bc utils.c --- a/utils.c Sat Jul 13 12:38:54 2013 -0400 +++ b/utils.c Sat Jul 13 12:47:20 2013 -0400 @@ -30,7 +30,6 @@ #include #include #include -#include #include "utils.h" @@ -125,7 +124,7 @@ blocklen = adjustsize(len); ret = malloc(blocklen); if (ret == NULL) { - warnx("Out of memory"); + complain(NULL, "Out of memory"); die(); } @@ -144,7 +143,7 @@ ret = realloc(blockptr, newblocklen); if (ret == NULL) { - warnx("Out of memory"); + complain(NULL, "Out of memory"); die(); }