commit 40a9a703c3a59ed299f1f73328295a83cc309db9
parent fe56e0343954e1c3993c7f44c170f56a52631dec
Author: aabacchus <ben@bvnf.space>
Date: Mon, 13 Sep 2021 15:09:58 +0100
ls: add usage message (-h)
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/ls.c b/src/ls.c
@@ -41,7 +41,7 @@ main(int argc, char *argv[])
int all, show_slash, show_line, show_suffix, recursive;
all = show_slash = show_line = show_suffix = recursive = 0;
- while((c = getopt(argc, argv, "1FRalp")) != -1) {
+ while((c = getopt(argc, argv, "1FRahlp")) != -1) {
switch(c) {
case '1':
show_line = 1;
@@ -56,6 +56,9 @@ main(int argc, char *argv[])
case 'a':
all = 1;
break;
+ case 'h':
+ printf("usage: ls [-1FRalp] [file...]\n");
+ return 0;
case 'l':
show_line = 1;
break;