ccnd_main.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <signal.h>
00021 #include <stddef.h>
00022 #include <stdarg.h>
00023 #include <stdio.h>
00024 #include <stdlib.h>
00025
00026 #include "ccnd_private.h"
00027
00028 static int
00029 stdiologger(void *loggerdata, const char *format, va_list ap)
00030 {
00031 FILE *fp = (FILE *)loggerdata;
00032 return(vfprintf(fp, format, ap));
00033 }
00034
00035 int
00036 main(int argc, char **argv)
00037 {
00038 struct ccnd_handle *h;
00039
00040 if (argc > 1) {
00041 fprintf(stderr, "%s", ccnd_usage_message);
00042 exit(1);
00043 }
00044 signal(SIGPIPE, SIG_IGN);
00045 h = ccnd_create(argv[0], stdiologger, stderr);
00046 if (h == NULL)
00047 exit(1);
00048 ccnd_run(h);
00049 ccnd_msg(h, "exiting.");
00050 ccnd_destroy(&h);
00051 exit(0);
00052 }