www-cgi: Install docs for mdw's env fetures
[userv-utils] / www-cgi / ucgi.h
1 /*
2 * Copyright 1996-2013 Ian Jackson <ijackson@chiark.greenend.org.uk>
3 * Copyright 1998 David Damerell <damerell@chiark.greenend.org.uk>
4 * Copyright 1999,2003
5 * Chancellor Masters and Scholars of the University of Cambridge
6 * Copyright 2010 Tony Finch <fanf@dotat.at>
7 *
8 * This is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with userv-utils; if not, see http://www.gnu.org/licenses/.
20 */
21
22 #ifndef UCGI_H
23 #define UCGI_H
24
25 #include <stdlib.h>
26
27 #ifdef DEBUG
28 # define D(x) x
29 #else
30 # define D(x)
31 #endif
32
33 #define MAX_ARGS 1024
34 #define MAX_USERNAME_LEN 1024
35 #define MAX_SCRIPTPATH_LEN 1024
36 #define MAX_ENVVAR_NAME 128
37 #define MAX_ENVVAR_VALUE (1024*1024)
38 #define MAX_ENVVARS 256
39
40 void syserror(const char *m);
41 void error(const char *m, int st);
42 void *xmalloc(size_t sz);
43 void xsetenv(const char *en, const char *ev, int overwrite);
44 void *xrealloc(void *ptr, size_t sz);
45
46 const char **load_filters(unsigned flags, const char *first, ...);
47 #define LOADF_MUST 1u
48 #define LF_END ((const char *)0)
49
50 void filter_environment(unsigned flags, const char *prefix_in,
51 const char *const *patv,
52 const char *const *defaults,
53 void (*foundone)(const char *fulln, const char *en,
54 const char *ev, void *p),
55 void *p);
56 #define FILTF_WILDCARD 1u
57
58 extern int debugmode;
59
60 #endif