Browse code

Allow specifying max for limit

John Hawthorn authored on 17/09/2014 02:20:39
Showing 1 changed files

  • fzy.c index c97829d..d71c95c 100644
... ...
@@ -4,6 +4,7 @@
4 4
 #include <stdlib.h>
5 5
 #include <ctype.h>
6 6
 #include <getopt.h>
7
+#include <limits.h>
7 8
 
8 9
 #include "match.h"
9 10
 #include "tty.h"
... ...
@@ -222,7 +223,9 @@ int main(int argc, char *argv[]){
222 223
 			case 'l':
223 224
 				{
224 225
 					int l;
225
-					if(sscanf(optarg, "%d", &l) != 1 || l < 3){
226
+					if(!strcmp(optarg, "max")){
227
+						l = INT_MAX;
228
+					}else if(sscanf(optarg, "%d", &l) != 1 || l < 3){
226 229
 						fprintf(stderr, "Invalid format for --lines: %s\n", optarg);
227 230
 						fprintf(stderr, "Must be integer in range 3..\n");
228 231
 						usage(argv[0]);