csv

Unnamed repository
Log | Files | Refs

commit 2f44c7e5c28a3e5b14c0367c95b0a33ffd6cc277
parent f4971227e173e33192e78981170dce5af59ae180
Author: aabacchus <ben@bvnf.space>
Date:   Sat,  2 Oct 2021 16:43:46 +0100

add -h message and make clean

Diffstat:
MMakefile | 5+++++
Mcsv.c | 5++++-
2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile @@ -3,3 +3,8 @@ XCFLAGS = $(CFLAGS) -Wall -Wextra -Wpedantic -Og -ggdb3 -D_XOPEN_SOURCE=600 csv: csv.c $(CC) $(XCFLAGS) -o $@ $< + +clean: + rm -f csv + +.PHONY: clean diff --git a/csv.c b/csv.c @@ -111,14 +111,17 @@ int main(int argc, char **argv) { int c; int flag_H = 0; - while ((c = getopt(argc, argv, "H")) != -1) { + while ((c = getopt(argc, argv, "Hh")) != -1) { switch (c) { case 'H': flag_H = 1; break; + case 'h': + goto usage; } } if (argc - optind > 1) { +usage: fprintf(stderr, "usage: %s [-H] [file]\n if no filename given, data is \ read from stdin\n"