diff options
-rw-r--r-- | number.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -3,6 +3,7 @@ #include <stdlib.h> #include <string.h> #include <stdbool.h> +#include <ctype.h> #include <inttypes.h> __attribute__((noreturn)) void usage(int argc,char **argv){ @@ -145,6 +146,14 @@ int main(int argc,char **argv){ usage(argc,argv); } if(argv[i][0]=='-'){ + if(isdigit(argv[i][1])){ + if(numstr==NULL)numstr=argv[i]; + else { + fprintf(stderr,"Unexpected second number '%s'\n",argv[i]); + usage(argc,argv); + } + continue; + } for(int j=1;argv[i][j];j++){ switch(argv[i][j]){ case 'c': capfirst=true; break; @@ -157,7 +166,7 @@ int main(int argc,char **argv){ } else { if(numstr==NULL)numstr=argv[i]; else { - fprintf(stderr,"Unexpected second bare argument '%s'\n",argv[i]); + fprintf(stderr,"Unexpected second number '%s'\n",argv[i]); usage(argc,argv); } } |