commit 3802e80c2b084088b5f19ef2b532a13c042e3096
parent 3b4c0905fa752934866ea76a152842b0dbca4d75
Author: phoebos <ben@bvnf.space>
Date: Tue, 21 Sep 2021 01:10:36 +0100
ls: add -h help
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ls.c b/ls.c
@@ -96,7 +96,7 @@ main(int argc, char **argv) {
int c, flags, ret_val;
flags = ret_val = 0;
- while ((c = getopt(argc, argv, "1Falp")) != -1) {
+ while ((c = getopt(argc, argv, "1Fahlp")) != -1) {
switch (c) {
case '1':
flags |= FLAG_1;
@@ -107,6 +107,9 @@ main(int argc, char **argv) {
case 'a':
flags |= FLAG_a;
break;
+ case 'h':
+ printf("usage: %s [-1Falp]\n", argv[0]);
+ return 0;
case 'l':
flags |= FLAG_l | FLAG_1;
break;