diff options
author | Henryk Plötz <henryk@ploetzli.ch> | 2014-10-03 19:58:52 +0200 |
---|---|---|
committer | Henryk Plötz <henryk@ploetzli.ch> | 2014-10-03 19:58:52 +0200 |
commit | 0e5b2871ca6456b01d4bf037a6e68badf1ff1a41 (patch) | |
tree | 97b95b74c9618d85da9aa9451a55a819cd7b1c2e /cachetest.c | |
download | tinydnssec-0e5b2871ca6456b01d4bf037a6e68badf1ff1a41.tar.gz tinydnssec-0e5b2871ca6456b01d4bf037a6e68badf1ff1a41.tar.bz2 |
Initial commit of djbdns-1.05.tar.gz
Source was http://cr.yp.to/djbdns/djbdns-1.05.tar.gz, SHA1 2efdb3a039d0c548f40936aa9cb30829e0ce8c3d
Diffstat (limited to 'cachetest.c')
-rw-r--r-- | cachetest.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/cachetest.c b/cachetest.c new file mode 100644 index 0000000..c689862 --- /dev/null +++ b/cachetest.c @@ -0,0 +1,32 @@ +#include "buffer.h" +#include "exit.h" +#include "cache.h" +#include "str.h" + +int main(int argc,char **argv) +{ + int i; + char *x; + char *y; + unsigned int u; + uint32 ttl; + + if (!cache_init(200)) _exit(111); + + if (*argv) ++argv; + + while (x = *argv++) { + i = str_chr(x,':'); + if (x[i]) + cache_set(x,i,x + i + 1,str_len(x) - i - 1,86400); + else { + y = cache_get(x,i,&u,&ttl); + if (y) + buffer_put(buffer_1,y,u); + buffer_puts(buffer_1,"\n"); + } + } + + buffer_flush(buffer_1); + _exit(0); +} |