forked from quakenet/newserv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathns-ident.c
43 lines (31 loc) · 933 Bytes
/
ns-ident.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* IDENT functionality
*/
#include "newsearch.h"
#include <stdio.h>
#include <stdlib.h>
void *ident_exe(struct searchNode *thenode, void *theinput);
void ident_free(struct searchNode *thenode);
struct searchNode *ident_parse(int type, int argc, char **argv) {
struct searchNode *thenode;
if (type != SEARCHTYPE_NICK) {
parseError = "ident: this function is only valid for nick searches.";
return NULL;
}
if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
parseError = "malloc: could not allocate memory for this search.";
return NULL;
}
thenode->returntype = RETURNTYPE_STRING;
thenode->localdata = NULL;
thenode->exe = ident_exe;
thenode->free = ident_free;
return thenode;
}
void *ident_exe(struct searchNode *thenode, void *theinput) {
nick *np = (nick *)theinput;
return np->ident;
}
void ident_free(struct searchNode *thenode) {
free(thenode);
}