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