X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=test.fcgi.c;h=097c55cfee70700ea48e6622686f2bacc445c36f;hb=af2ed61b280e1ec169aba2bcb9df30ac76b006d2;hp=d8edea73aa3007b9ff85bd7d872a33df71b2968c;hpb=c2cff27fa2112ee2097760a1670f9bfff33a7c21;p=collection4.git diff --git a/test.fcgi.c b/test.fcgi.c index d8edea7..097c55c 100644 --- a/test.fcgi.c +++ b/test.fcgi.c @@ -9,15 +9,18 @@ #include #include -#include -#include - #include "common.h" #include "graph_list.h" #include "utils_params.h" +#include "action_graph.h" #include "action_list_graphs.h" +/* Include this last, so the macro magic of doesn't interfere + * with our own header files. */ +#include +#include + struct action_s { const char *name; @@ -25,74 +28,16 @@ struct action_s }; typedef struct action_s action_t; -#if 0 -struct str_array_s -{ - char **ptr; - size_t size; -}; -typedef struct str_array_s str_array_t; -#endif - static int action_usage (void); static const action_t actions[] = { + { "graph", action_graph }, { "list_graphs", action_list_graphs }, { "usage", action_usage } }; static const size_t actions_num = sizeof (actions) / sizeof (actions[0]); -#if 0 -static str_array_t *array_alloc (void) /* {{{ */ -{ - str_array_t *a; - - a = malloc (sizeof (*a)); - if (a == NULL) - return (NULL); - - memset (a, 0, sizeof (*a)); - a->ptr = NULL; - a->size = 0; - - return (a); -} /* }}} str_array_t *array_alloc */ - -static void array_free (str_array_t *a) /* {{{ */ -{ - if (a == NULL) - return; - - free (a->ptr); - a->ptr = NULL; - a->size = 0; - - free (a); -} /* }}} void array_free */ - -static int array_add (const char *entry, void *user_data) /* {{{ */ -{ - str_array_t *a = user_data; - char **ptr; - - if ((entry == NULL) || (a == NULL)) - return (EINVAL); - - ptr = realloc (a->ptr, sizeof (*a->ptr) * (a->size + 1)); - if (ptr == NULL) - return (ENOMEM); - a->ptr = ptr; - ptr = a->ptr + a->size; - - *ptr = strdup (entry); - if (*ptr == NULL) - return (ENOMEM); - - a->size++; - return (0); -} /* }}} int array_add */ -#endif static int action_usage (void) /* {{{ */ {