Blame


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