summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--urimatch.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/urimatch.c b/urimatch.c
index 91177f2..641ed45 100644
--- a/urimatch.c
+++ b/urimatch.c
@@ -63,6 +63,13 @@ int main(int argc,char *argv[]) {
case 'r': j=1; rule=MATCH_REVERSE; break;
default: break;//handled by the next switch
}
+ if(rule != MATCH_UNEXIST) {
+ if(i+1 == argc) {
+ fprintf(stderr,"argument '%s' wants a value in the next argument and didn't get it. throwing a fit.\n",argv[i]);
+// fprintf(stderr,"previous: '%s' current: '%s' next: '%s'\n",argv[i-1],argv[i],argv[i+1]);
+ return 2;
+ }
+ }
switch(argv[i][j]) {
case 's': if(match(rule,u.scheme,argv[i+1])) { printf("%s\n",copy); ret=0;} break;
case 'u': if(match(rule,u.username,argv[i+1])) { printf("%s\n",copy); ret=0;} break;
@@ -83,4 +90,3 @@ int main(int argc,char *argv[]) {
}
return ret;
}
-