NetSurf
output.c
Go to the documentation of this file.
1/*
2 * Copyright 2018 Vincent Sanders <vince@nexturf-browser.org>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <stdio.h>
20#include <stdarg.h>
21
22#include "monkey/output.h"
23
24/**
25 * output type prefixes
26 */
27static const char *type_text[]={
28 "DIE",
29 "ERROR",
30 "WARN",
31 "GENERIC",
32 "WINDOW",
33 "LOGIN",
34 "DOWNLOAD",
35 "PLOT",
36};
37
38/* exported interface documented in monkey/output.h */
39int moutf(enum monkey_output_type mout_type, const char *fmt, ...)
40{
41 va_list ap;
42 int res;
43
44 res = fprintf(stdout, "%s ", type_text[mout_type]);
45
46 va_start(ap, fmt);
47 res += vfprintf(stdout, fmt, ap);
48 va_end(ap);
49
50 fputc('\n', stdout);
51
52 return res + 1;
53}
int moutf(enum monkey_output_type mout_type, const char *fmt,...)
Definition: output.c:39
static const char * type_text[]
output type prefixes
Definition: output.c:27
monkey_output_type
Definition: output.h:22