repo: uritools
action: commit
revision: 
path_from: 
revision_from: eb65aa32f77aab0e788c3700f3a16978836416d8:
path_to: 
revision_to: 
git.thebackupbox.net
uritools
git clone git://git.thebackupbox.net/uritools
commit eb65aa32f77aab0e788c3700f3a16978836416d8
Author: epoch 
Date:   Sun Nov 14 04:31:18 2021 +0000

    urimatch got an extra check to bail for inappropriate match pattern

diff --git a/urimatch.c b/urimatch.c
index 91177f223d07cad2a72030e0f16f65060eaf6f17..
index ..641ed45dfecda69d61b9e2beb081848ec2146d6d 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;
 }
-

-----END OF PAGE-----