From 625662a5c1cbb71cf37653df1f31cd60c48b18ae Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 22 May 2024 12:16:41 -0400 Subject: Remove use of sysexits.h --- bin/title.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'bin/title.c') diff --git a/bin/title.c b/bin/title.c index 47ff720a..f40f5c87 100644 --- a/bin/title.c +++ b/bin/title.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -33,7 +32,7 @@ static regex_t regex(const char *pattern, int flags) { char buf[256]; regerror(error, ®ex, buf, sizeof(buf)); - errx(EX_SOFTWARE, "regcomp: %s: %s", buf, pattern); + errx(1, "regcomp: %s: %s", buf, pattern); } static const struct Entity { @@ -128,7 +127,7 @@ static CURLcode fetchTitle(const char *url) { char *dest; curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &dest); dest = strdup(dest); - if (!dest) err(EX_OSERR, "strdup"); + if (!dest) err(1, "strdup"); code = curl_easy_setopt(curl, CURLOPT_URL, dest); if (code) return code; @@ -149,10 +148,10 @@ int main(int argc, char *argv[]) { setlinebuf(stdout); CURLcode code = curl_global_init(CURL_GLOBAL_ALL); - if (code) errx(EX_OSERR, "curl_global_init: %s", curl_easy_strerror(code)); + if (code) errx(1, "curl_global_init: %s", curl_easy_strerror(code)); curl = curl_easy_init(); - if (!curl) errx(EX_SOFTWARE, "curl_easy_init"); + if (!curl) errx(1, "curl_easy_init"); static char error[CURL_ERROR_SIZE]; curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error); @@ -180,14 +179,14 @@ int main(int argc, char *argv[]) { excludeRegex = regex(optarg, REG_NOSUB); } break; case 'v': curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - break; default: return EX_USAGE; + break; default: return 1; } } if (optind < argc) { code = fetchTitle(argv[optind]); - if (!code) return EX_OK; - errx(EX_DATAERR, "curl_easy_perform: %s", error); + if (!code) return 0; + errx(1, "curl_easy_perform: %s", error); } char *buf = NULL; @@ -207,5 +206,5 @@ int main(int argc, char *argv[]) { ptr[match.rm_eo] = ' '; } } - if (ferror(stdin)) err(EX_IOERR, "getline"); + if (ferror(stdin)) err(1, "getline"); } -- cgit 1.4.1