summary refs log tree commit diff
path: root/bin/psf2png.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2024-05-22 12:16:41 -0400
committerJune McEnroe <june@causal.agency>2024-05-22 12:16:41 -0400
commit625662a5c1cbb71cf37653df1f31cd60c48b18ae (patch)
tree7a04a48f7007b30f086b353c0c03002c861383b9 /bin/psf2png.c
parentAdd photo descriptions from 05-03 and 05-06 (diff)
downloadsrc-625662a5c1cbb71cf37653df1f31cd60c48b18ae.tar.gz
src-625662a5c1cbb71cf37653df1f31cd60c48b18ae.zip
Remove use of sysexits.h
Diffstat (limited to '')
-rw-r--r--bin/psf2png.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/bin/psf2png.c b/bin/psf2png.c
index c36238a0..aeb975b3 100644
--- a/bin/psf2png.c
+++ b/bin/psf2png.c
@@ -19,7 +19,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sysexits.h>
 #include <unistd.h>
 
 #include "png.h"
@@ -37,17 +36,17 @@ int main(int argc, char *argv[]) {
 			break; case 'c': cols = strtoul(optarg, NULL, 0);
 			break; case 'f': fg = strtoul(optarg, NULL, 16);
 			break; case 's': str = optarg;
-			break; default:  return EX_USAGE;
+			break; default:  return 1;
 		}
 	}
 	if (!cols && str) cols = strlen(str);
-	if (!cols) return EX_USAGE;
+	if (!cols) return 1;
 
 	const char *path = NULL;
 	if (optind < argc) path = argv[optind];
 	
 	FILE *file = path ? fopen(path, "r") : stdin;
-	if (!file) err(EX_NOINPUT, "%s", path);
+	if (!file) err(1, "%s", path);
 	if (!path) path = "(stdin)";
 
 	struct {
@@ -63,15 +62,15 @@ int main(int argc, char *argv[]) {
 		} glyph;
 	} header;
 	size_t len = fread(&header, sizeof(header), 1, file);
-	if (ferror(file)) err(EX_IOERR, "%s", path);
-	if (len < 1) errx(EX_DATAERR, "%s: truncated header", path);
+	if (ferror(file)) err(1, "%s", path);
+	if (len < 1) errx(1, "%s: truncated header", path);
 
 	uint32_t widthBytes = (header.glyph.width + 7) / 8;
 	uint8_t glyphs[header.glyph.len][header.glyph.height][widthBytes];
 	len = fread(glyphs, header.glyph.size, header.glyph.len, file);
-	if (ferror(file)) err(EX_IOERR, "%s", path);
+	if (ferror(file)) err(1, "%s", path);
 	if (len < header.glyph.len) {
-		errx(EX_DATAERR, "%s: truncated glyphs", path);
+		errx(1, "%s: truncated glyphs", path);
 	}
 	fclose(file);