]>
Commit | Line | Data |
---|---|---|
c86edd1d Q |
1 | /* |
2 | * IDENT functionality | |
3 | */ | |
4 | ||
5 | #include "newsearch.h" | |
6 | ||
7 | #include <stdio.h> | |
8 | #include <stdlib.h> | |
9 | ||
10 | #include "../nick/nick.h" | |
11 | ||
12 | void *ident_exe(struct searchNode *thenode, int type, void *theinput); | |
13 | void ident_free(struct searchNode *thenode); | |
14 | ||
15 | struct searchNode *ident_parse(int type, int argc, char **argv) { | |
16 | struct searchNode *thenode; | |
17 | ||
18 | if (type != SEARCHTYPE_NICK) { | |
19 | parseError = "ident: this function is only valid for nick searches."; | |
20 | return NULL; | |
21 | } | |
22 | ||
23 | thenode=(struct searchNode *)malloc(sizeof (struct searchNode)); | |
24 | ||
25 | thenode->returntype = RETURNTYPE_STRING; | |
26 | thenode->localdata = NULL; | |
27 | thenode->exe = ident_exe; | |
28 | thenode->free = ident_free; | |
29 | ||
30 | return thenode; | |
31 | } | |
32 | ||
33 | void *ident_exe(struct searchNode *thenode, int type, void *theinput) { | |
34 | nick *np = (nick *)theinput; | |
35 | ||
36 | if (type != RETURNTYPE_STRING) { | |
37 | return (void *)1; | |
38 | } | |
39 | ||
40 | return np->ident; | |
41 | } | |
42 | ||
43 | void ident_free(struct searchNode *thenode) { | |
44 | free(thenode); | |
45 | } | |
46 |