commit fe56e0343954e1c3993c7f44c170f56a52631dec
parent 7ec216473c7328af5a4959e52b6e9851f322dcb1
Author: aabacchus <ben@bvnf.space>
Date: Mon, 13 Sep 2021 15:05:10 +0100
ls: reorder getopts
Diffstat:
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/ls.c b/src/ls.c
@@ -41,15 +41,9 @@ 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, "lapFR1")) != -1) {
+ while((c = getopt(argc, argv, "1FRalp")) != -1) {
switch(c) {
- case 'a':
- all = 1;
- break;
- case 'p':
- show_slash = 1;
- break;
- case 'l':
+ case '1':
show_line = 1;
break;
case 'F':
@@ -59,9 +53,15 @@ main(int argc, char *argv[])
case 'R':
recursive = 1;
break;
- case '1':
+ case 'a':
+ all = 1;
+ break;
+ case 'l':
show_line = 1;
break;
+ case 'p':
+ show_slash = 1;
+ break;
}
}
char directory[256];