From 9bbfa7d2cd5b46f07052dfb2212d792cb6f2641d Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Tue, 3 Dec 2024 00:04:40 +0000 Subject: Some general reworking, error handling --- main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index bef8d3c..c8e16ea 100644 --- a/main.c +++ b/main.c @@ -74,14 +74,19 @@ void interpret(machine_t *cpu, node_t *ast, size_t num) #endif } +void usage(const char *name, FILE *fp) +{ + fprintf(fp, + "Usage: %s [FILE]...\n\tExecutes FILES sequentially on the " + "same machine\n", + name); +} + int main(int argc, char *argv[]) { if (argc == 1) { - fprintf( - stderr, - "Usage: %s [FILE]...\nReads FILES sequentially on the same machine\n", - argv[0]); + usage(argv[0], stderr); return 1; } -- cgit v1.2.3-13-gbd6f