diff options
| author | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2024-06-01 02:42:18 +0900 | 
|---|---|---|
| committer | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2024-06-01 02:42:18 +0900 | 
| commit | 9ef6eb9b5f6190069ccde20c38232b98b48f55c7 (patch) | |
| tree | f7335af537162f063b7dcfa873cd6d8ab9371a2a | |
| parent | 1cacc7bf2fbb30538b4b3fb57ea79451ae6a80d3 (diff) | |
Add option for setting max and min
| -rw-r--r-- | src/calculer.c | 12 | 
1 files changed, 11 insertions, 1 deletions
| diff --git a/src/calculer.c b/src/calculer.c index 0e442de..6b279ec 100644 --- a/src/calculer.c +++ b/src/calculer.c @@ -84,6 +84,10 @@ print_usage(FILE *stream)  	print_opt_noarg("V", "Print version and exit.");  	print_opt_noarg("h", "Print help and exit.");  	print_opt_arg("l", "LOGFILE", "Use LOGFILE as log file.\n"); +	print_opt_arg("m", "MIN", +		      "Set MIN as the minimum value numbers can take.\n"); +	print_opt_arg("M", "MAX", +		      "Set MAX as the maximum value numbers can take.\n");  }  void @@ -113,7 +117,7 @@ main(int argc, char *argv[])  	assert(bytes_written);  	int opt; -	while ((opt = getopt(argc, argv, ":Vhl:")) != -1) +	while ((opt = getopt(argc, argv, ":Vhl:m:M:")) != -1)  	{  		switch (opt)  		{ @@ -126,6 +130,12 @@ main(int argc, char *argv[])  		case 'l':  			logpath = optarg;  			break; +		case 'm': +			lower = atoi(optarg); +			break; +		case 'M': +			upper = atoi(optarg); +			break;  		case ':':  			fprintf(stderr,  				"calculer: option %d requires an argument\n", | 
