2 * This file is part of DisOrder.
3 * Copyright (C) 2004, 2005 Richard Kettlewell
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 extern struct kvp *cgi_args;
34 const char *cgi_get(const char *name);
37 void cgi_header(struct sink *output, const char *name, const char *value);
38 /* output a header. @name@ and @value@ are ASCII. */
40 void cgi_body(struct sink *output);
41 /* indicate the start of the body */
43 void cgi_output(cgi_sink *output, const char *fmt, ...)
44 attribute((format (printf, 2, 3)));
45 /* SGML-quote formatted UTF-8 data and write it. Checks errors. */
47 char *cgi_sgmlquote(const char *s, int raw);
48 /* SGML-quote multibyte string @s@ */
50 void cgi_attr(struct sink *output, const char *name, const char *value);
51 /* write an attribute */
53 void cgi_opentag(struct sink *output, const char *name, ...);
54 /* write an open tag, including attribute name-value pairs terminate
57 void cgi_closetag(struct sink *output, const char *name);
58 /* write a close tag */
60 struct cgi_expansion {
64 #define EXP_MAGIC 0x0001
65 void (*handler)(int nargs, char **args, cgi_sink *output, void *u);
68 void cgi_expand(const char *name,
69 const struct cgi_expansion *expansions,
73 /* find @name@ and substitute for expansions */
75 void cgi_expand_string(const char *name,
77 const struct cgi_expansion *expansions,
81 /* same but @template@ is text of template */
83 char *cgi_makeurl(const char *url, ...);
86 const char *cgi_label(const char *key);
87 /* look up the translated label @key@ */
89 char **cgi_columns(const char *name, int *nheadings);
90 /* return the list of columns for @name@ */
92 const char *cgi_transform(const char *type,
95 /* transform a track or directory name for display */
97 void cgi_set_option(const char *name, const char *value);