commit f83933a7435cfb76504a14906ea546a4cd91ec3b
parent ecbf0677cc0f078b6f3ba23435aa60a8fce5c7f9
Author: phoebos <ben@bvnf.space>
Date: Tue, 12 Oct 2021 21:56:38 +0100
ls: don't allow contradictory flags (used final option specified)
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/ls.c b/ls.c
@@ -270,6 +270,7 @@ main(int argc, char **argv) {
break;
case 'c':
flags |= FLAG_c;
+ flags &= ~FLAG_u;
break;
case 'h':
printf("usage: %s [-1AFacilmpuq]\n", argv[0]);
@@ -279,15 +280,18 @@ main(int argc, char **argv) {
break;
case 'l':
flags |= FLAG_l | FLAG_1;
+ flags &= ~FLAG_m;
break;
case 'm':
flags |= FLAG_m;
+ flags &= ~(FLAG_1 | FLAG_l);
break;
case 'p':
flags |= FLAG_p;
break;
case 'u':
flags |= FLAG_u;
+ flags &= ~FLAG_c;
break;
case 'q':
flags |= FLAG_q;