commit 5bf7a25e9fa6a4c41e743d00510b7c64ebd42a6d
parent 3ddd0e4133be191a882414fb5d54d9942aefb454
Author: Claudio Alessi <smoppy@gmail.com>
Date: Thu, 15 Aug 2024 23:29:14 +0200
Don't change the limit in -f and -t if -l has been specified (in any order).
Diffstat:
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/sw.c b/sw.c
@@ -387,19 +387,29 @@ int
main(int argc, char *argv[]) {
int delid = 0;
int from = 0, to = 0;
+ int lflag = 0;
char *txt = NULL;
ARGBEGIN {
case 'd': delid = atoi(EARGF(usage())); break;
case 'e': addfilter(F_TEXT, EARGF(usage())); break;
- case 'f': addfilter(F_DATEFROM, EARGF(usage())); limit = 0; break;
+ case 'f':
+ addfilter(F_DATEFROM, EARGF(usage()));
+ if(!lflag)
+ limit = 0;
+ break;
case 'i': snprintf(movsfilename, sizeof movsfilename, "%s", EARGF(usage())); break;
case 'l':
+ lflag = 1;
limit = strtoint(EARGF(usage()));
if(limit < 0)
die("%s: -l: invalid argument\n", argv0);
break;
- case 't': addfilter(F_DATETO, EARGF(usage())); limit = 0; break;
+ case 't':
+ addfilter(F_DATETO, EARGF(usage()));
+ if(!lflag)
+ limit = 0;
+ break;
case 'v': die("sw-"VERSION"\n");
case 'x': addfilter(F_NOTEXT, EARGF(usage())); break;
default: usage();