]> dxcluster.org Git - spider.git/commitdiff
do better callsign checking
authordjk <djk>
Tue, 28 Mar 2000 22:23:15 +0000 (22:23 +0000)
committerdjk <djk>
Tue, 28 Mar 2000 22:23:15 +0000 (22:23 +0000)
src/client.c

index e22d84acf8cae4f752d3ee5ba114c73e50d39518..5258e39d8163860543b8c1d6a0fef5ae14e48da1 100644 (file)
@@ -91,10 +91,22 @@ int tabsize = 8;                            /* default tabsize for text messages */
 
 myregex_t iscallreg[] = {              /* regexes to determine whether this is a reasonable callsign */
        {
-               "^[A-Z]+[0-9]+[A-Z]+", 0
+               "^[A-Z]+[0-9]+[A-Z]+[1-9]?$", 0
        },
        {
-               "^[0-9]+[A-Z]+[0-9]+[A-Z]+", 0
+               "^[0-9]+[A-Z]+[0-9]+[A-Z]+[1-9]?$", 0
+       },
+       {
+               "^[A-Z]+[0-9]+[A-Z]+[1-9]?-[1-9]$", 0
+       },
+       {
+               "^[0-9]+[A-Z]+[0-9]+[A-Z]+[1-9]?-[1-9]$", 0
+       },
+       {
+               "^[A-Z]+[0-9]+[A-Z]+[1-9]?-1[0-5]$", 0
+       },
+       {
+               "^[0-9]+[A-Z]+[0-9]+[A-Z]+[1-9]?-1[0-5]$", 0
        },
        {
                0, 0
@@ -714,9 +726,11 @@ main(int argc, char *argv[])
                }
                buf[r] = 0;
                call = strupper(buf);
-               if (!iscallsign(call)) {
-                       die("Sorry, %s isn't a valid callsign", buf);
-               }
+       }
+
+       /* check the callsign */
+       if (!iscallsign(call)) {
+               die("Sorry, %s isn't a valid callsign", call);
        }
        
        /* connect up stdin */