Commit | Line | Data |
---|---|---|
dc0d77d7 CE |
1 | #include "buffer.h" |
2 | #include "exit.h" | |
3 | #include "cache.h" | |
4 | #include "str.h" | |
5 | ||
6 | int main(int argc,char **argv) | |
7 | { | |
8 | int i; | |
9 | char *x; | |
10 | char *y; | |
11 | unsigned int u; | |
12 | uint32 ttl; | |
13 | ||
14 | if (!cache_init(200)) _exit(111); | |
15 | ||
16 | if (*argv) ++argv; | |
17 | ||
18 | while (x = *argv++) { | |
19 | i = str_chr(x,':'); | |
20 | if (x[i]) | |
21 | cache_set(x,i,x + i + 1,str_len(x) - i - 1,86400); | |
22 | else { | |
23 | y = cache_get(x,i,&u,&ttl); | |
24 | if (y) | |
25 | buffer_put(buffer_1,y,u); | |
26 | buffer_puts(buffer_1,"\n"); | |
27 | } | |
28 | } | |
29 | ||
30 | buffer_flush(buffer_1); | |
31 | _exit(0); | |
32 | } |