*/
/** @file server/options.c
* @brief CGI options
+ *
+ * Options represent an additional configuration system private to the
+ * CGI program.
*/
-#include <config.h>
-#include "types.h"
-
-#include <stdio.h>
-#include <stddef.h>
-#include <errno.h>
-#include <string.h>
-
-#include "mem.h"
-#include "hash.h"
-#include "macros.h"
-#include "options.h"
-#include "split.h"
-#include "table.h"
-#include "log.h"
-#include "inputline.h"
-#include "printf.h"
+#include "disorder-cgi.h"
struct column {
int ncolumns;
char **vec, *buffer;
struct read_options_state cs;
- if(!(cs.name = mx_find(name)))
+ if(!(cs.name = mx_find(name, 1/*report*/)))
return;
if(!(fp = fopen(cs.name, "r")))
fatal(errno, "error opening %s", cs.name);
*/
const char *option_label(const char *key) {
const char *label;
+ char **lptr;
option__init();
- if(!(label = *(char **)hash_find(labels, key))) {
- /* No label found */
- if(!strncmp(key, "images.", 7)) {
- static const char *url_static;
- /* images.X defaults to <url.static>X.png */
-
- if(!url_static)
- url_static = option_label("url.static");
- byte_xasprintf((char **)&label, "%s%s.png", url_static, key + 7);
- } else if((label = strrchr(key, '.')))
- /* X.Y defaults to Y */
- ++label;
- else
- /* otherwise default to label name */
- label = key;
- }
+ lptr = hash_find(labels, key);
+ if(lptr)
+ return *lptr;
+ /* No label found */
+ if(!strncmp(key, "images.", 7)) {
+ static const char *url_static;
+ /* images.X defaults to <url.static>X.png */
+
+ if(!url_static)
+ url_static = option_label("url.static");
+ byte_xasprintf((char **)&label, "%s%s.png", url_static, key + 7);
+ } else if((label = strrchr(key, '.')))
+ /* X.Y defaults to Y */
+ ++label;
+ else
+ /* otherwise default to label name */
+ label = key;
return label;
}