summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--number.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/number.c b/number.c
index 4c1f9b2..24bcc33 100644
--- a/number.c
+++ b/number.c
@@ -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);
}
}