2 * This file is part of DisOrder.
3 * Copyright (C) 2004, 2005, 2007, 2008 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_define(const char *name
,
73 void cgi_expand(const char *name
,
74 const struct cgi_expansion
*expansions
,
78 /* find @name@ and substitute for expansions */
80 void cgi_expand_string(const char *name
,
82 const struct cgi_expansion
*expansions
,
86 /* same but @template@ is text of template */
88 char *cgi_makeurl(const char *url
, ...);
91 const char *cgi_label(const char *key
);
92 /* look up the translated label @key@ */
94 int cgi_label_exists(const char *key
);
96 char **cgi_columns(const char *name
, int *nheadings
);
97 /* return the list of columns for @name@ */
99 const char *cgi_transform(const char *type
,
101 const char *context
);
102 /* transform a track or directory name for display */
104 void cgi_set_option(const char *name
, const char *value
);