]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-cidr.c
merge
[irc/quakenet/newserv.git] / newsearch / ns-cidr.c
index 9a9f9182dc443728a7eeeddff34eca435b230660..e57267a7a643ef7b3a9e104c9c5313c6bd51df5e 100644 (file)
@@ -20,16 +20,29 @@ void *cidr_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
 void cidr_free(searchCtx *ctx, struct searchNode *thenode);
 
 struct searchNode *cidr_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
+  struct searchNode *thenode, *convsn;
   struct cidr_localdata *c;
   unsigned char mask;
   struct irc_in_addr ip;
-
-  if((argc != 1) || !ipmask_parse(argv[0], &ip, &mask)) {
+  char *p;
+  int ret;
+  
+  if(argc != 1) {
     parseError = "usage: cidr ip/mask";
     return NULL;
   }
 
+  if (!(convsn=argtoconststr("cidr", ctx, argv[0], &p)))
+    return NULL;
+  
+  ret = ipmask_parse(p, &ip, &mask);
+  convsn->free(ctx, convsn);
+  
+  if(!ret) {
+    parseError = "usage: cidr ip/mask";
+    return NULL;
+  }
+  
   if(!irc_in_addr_is_ipv4(&ip)) {
     parseError = "cidr: sorry, no IPv6 yet";
     return NULL;