]> jfr.im git - irc/quakenet/newserv.git/blame - patriciasearch/ps-users.c
Merge chanserv-live into default.
[irc/quakenet/newserv.git] / patriciasearch / ps-users.c
CommitLineData
3128667f
P
1#include "patriciasearch.h"
2
3#include <stdio.h>
4#include <stdlib.h>
5
6void *ps_users_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
7void ps_users_free(searchCtx *ctx, struct searchNode *thenode);
8
9struct searchNode *ps_users_parse(searchCtx *ctx, int argc, char **argv) {
10 struct searchNode *thenode;
11
12 if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
13 parseError = "malloc: could not allocate memory for this search.";
14 return NULL;
15 }
16
17 thenode->returntype = RETURNTYPE_INT;
18 thenode->localdata = NULL;
19 thenode->exe = ps_users_exe;
20 thenode->free = ps_users_free;
21
22 return thenode;
23}
24
25void *ps_users_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
26 patricia_node_t *pn = (patricia_node_t *)theinput;
27
c651da74 28 return (void *)(long)(pn->usercount);
3128667f
P
29}
30
31void ps_users_free(searchCtx *ctx, struct searchNode *thenode) {
32 free(thenode);
33}