commit cd140950d7d4f0f22ed9d9dbeddac89ed423bbdf (patch)
parent 3105b8c311e51cd27dbfec6185cab57c18775d52
Author: Alex Karle <alex@alexkarle.com>
Date: Sat, 18 Dec 2021 13:24:01 -0500
Add error if any arguments are given
This should help avoid confusion when run as `blag file` and apparently
hanging...
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/blag.c b/blag.c
@@ -5,7 +5,7 @@
* "because markdown isn't in base!"
*/
#include <stdio.h>
-#include <err.h>
+#include <stdlib.h>
#include <unistd.h>
enum Block {
@@ -375,7 +375,11 @@ int parse() {
return 0;
}
-int main(void) {
+int main(int argc, char *argv[]) {
+ if (argc > 1) {
+ fprintf(stderr, "error: %s takes no arguments\n", argv[0]);
+ exit(1);
+ }
#ifdef __OpenBSD__
pledge("stdio", "stdio");
#endif