]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-server.c
Port to git.
[irc/quakenet/newserv.git] / newsearch / ns-server.c
index 4683b4a8fad4356aaed1068442ce65681f2679f7..eb44078657c3f58139700a1ca2f5308cc984c012 100644 (file)
@@ -30,17 +30,28 @@ struct searchNode *server_parse(searchCtx *ctx, int argc, char **argv) {
   }
 
   if (argc>0) {
+    struct searchNode *servername;
+    char *p;
+    
+    if (!(servername=argtoconststr("server", ctx, argv[0], &p))) {
+      free(thenode);
+      return NULL;
+    }
+     
     numeric = -1;
     for(i=0;i<MAXSERVERS;i++) {
       sstring *n = serverlist[i].name;
-      if(n && !strcmp(n->content, argv[0])) {
+      if(n && !strcmp(n->content, p)) {
         numeric = i;
         break;
       }
     }
 
+    (servername->free)(ctx, servername);
+    
     if(numeric == -1) {
       parseError = "server: server not found.";
+      free(thenode);
       return NULL;
     }
 
@@ -75,7 +86,7 @@ void *server_exe_str(searchCtx *ctx, struct searchNode *thenode, void *theinput)
   sstring *n = serverlist[homeserver(np->numeric)].name;
 
   if(!n)
-    return NULL;
+    return "";
 
   return n->content;
 }