Blame


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