Blame


1 2c02675e 2022-12-14 op /*
2 b2b17923 2022-12-17 op * Copyright (c) 2022 Omar Polo <op@openbsd.org>
3 2c02675e 2022-12-14 op *
4 2c02675e 2022-12-14 op * Permission to use, copy, modify, and distribute this software for any
5 2c02675e 2022-12-14 op * purpose with or without fee is hereby granted, provided that the above
6 2c02675e 2022-12-14 op * copyright notice and this permission notice appear in all copies.
7 2c02675e 2022-12-14 op *
8 2c02675e 2022-12-14 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 2c02675e 2022-12-14 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 2c02675e 2022-12-14 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 2c02675e 2022-12-14 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 2c02675e 2022-12-14 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 2c02675e 2022-12-14 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 2c02675e 2022-12-14 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 2c02675e 2022-12-14 op */
16 2c02675e 2022-12-14 op
17 2c02675e 2022-12-14 op #ifndef TMPL_H
18 2c02675e 2022-12-14 op #define TMPL_H
19 2c02675e 2022-12-14 op
20 2c02675e 2022-12-14 op struct template;
21 2c02675e 2022-12-14 op
22 2c02675e 2022-12-14 op typedef int (*tmpl_puts)(struct template *, const char *);
23 2c02675e 2022-12-14 op typedef int (*tmpl_putc)(struct template *, int);
24 2c02675e 2022-12-14 op
25 2c02675e 2022-12-14 op struct template {
26 2c02675e 2022-12-14 op void *tp_arg;
27 2c02675e 2022-12-14 op char *tp_tmp;
28 2c02675e 2022-12-14 op tmpl_puts tp_escape;
29 2c02675e 2022-12-14 op tmpl_puts tp_puts;
30 2c02675e 2022-12-14 op tmpl_putc tp_putc;
31 2c02675e 2022-12-14 op };
32 2c02675e 2022-12-14 op
33 2c02675e 2022-12-14 op int tp_urlescape(struct template *, const char *);
34 2c02675e 2022-12-14 op int tp_htmlescape(struct template *, const char *);
35 2c02675e 2022-12-14 op
36 2c02675e 2022-12-14 op struct template *template(void *, tmpl_puts, tmpl_putc);
37 2c02675e 2022-12-14 op void template_free(struct template *);
38 2c02675e 2022-12-14 op
39 2c02675e 2022-12-14 op #endif