void host_free(searchCtx *ctx, struct searchNode *thenode);
struct searchNode *host_parse(searchCtx *ctx, int argc, char **argv) {
- struct searchNode *thenode;
-
- if (ctx->type != SEARCHTYPE_NICK) {
- parseError = "host: this function is only valid for nick searches.";
- return NULL;
- }
-
+ struct searchNode *thenode, *argsn;
+ char *p;
+
if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
parseError = "malloc: could not allocate memory for this search.";
return NULL;
thenode->exe = host_exe;
thenode->free = host_free;
+ if (!(argsn=argtoconststr("host", ctx, argv[0], &p))) {
+ free(thenode);
+ return NULL;
+ }
+
/* Allow "host real" to match realhost */
-
- if (argc>0 && !ircd_strcmp(argv[0],"real")) {
+ if (argc>0 && !ircd_strcmp(p,"real"))
thenode->exe = host_exe_real;
- }
+
+ argsn->free(ctx, argsn);
return thenode;
}