summary refs log tree commit diff
path: root/bin/shotty.l
diff options
context:
space:
mode:
Diffstat (limited to 'bin/shotty.l')
-rw-r--r--bin/shotty.l15
1 files changed, 7 insertions, 8 deletions
diff --git a/bin/shotty.l b/bin/shotty.l
index ff78d241..b6d54eee 100644
--- a/bin/shotty.l
+++ b/bin/shotty.l
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019, 2021  C. McEnroe <june@causal.agency>
+/* Copyright (C) 2019, 2021  June McEnroe <june@causal.agency>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -26,7 +26,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ioctl.h>
-#include <sysexits.h>
 #include <unistd.h>
 #include <wchar.h>
 
@@ -181,13 +180,13 @@ ESC \x1B
 		| (wchar_t)(yytext[1] & 0x3F);
 	return Data;
 }
-[\xE0-\xEF][\x80-\xBF]{2} {
+[\xE0-\xEF]([\x80-\xBF]{2}) {
 	ch = (wchar_t)(yytext[0] & 0x0F) << 12
 		| (wchar_t)(yytext[1] & 0x3F) << 6
 		| (wchar_t)(yytext[2] & 0x3F);
 	return Data;
 }
-[\xF0-\xF7][\x80-\xBF]{3} {
+[\xF0-\xF7]([\x80-\xBF]{3}) {
 	ch = (wchar_t)(yytext[0] & 0x07) << 18
 		| (wchar_t)(yytext[1] & 0x3F) << 12
 		| (wchar_t)(yytext[2] & 0x3F) << 6
@@ -554,25 +553,25 @@ int main(int argc, char *argv[]) {
 			break; case 'n': hide = true;
 			break; case 's': size = true;
 			break; case 'w': cols = atoi(optarg);
-			break; default:  return EX_USAGE;
+			break; default:  return 1;
 		}
 	}
 	if (optind < argc) {
 		yyin = fopen(argv[optind], "r");
-		if (!yyin) err(EX_NOINPUT, "%s", argv[optind]);
+		if (!yyin) err(1, "%s", argv[optind]);
 	}
 
 	if (size) {
 		struct winsize win;
 		int error = ioctl(STDERR_FILENO, TIOCGWINSZ, &win);
-		if (error) err(EX_IOERR, "ioctl");
+		if (error) err(1, "ioctl");
 		cols = win.ws_col;
 		rows = win.ws_row;
 	}
 	scr.bot = rows;
 
 	cells = calloc(cols * rows, sizeof(*cells));
-	if (!cells) err(EX_OSERR, "calloc");
+	if (!cells) err(1, "calloc");
 	erase(cell(0, 0), cell(rows-1, cols));
 
 	bool mc = false;