dpkg (1.18.25) stretch; urgency=medium
[dpkg] / lib / dpkg / error.h
CommitLineData
1479465f
GJ
1/*
2 * libdpkg - Debian packaging suite library routines
3 * error.h - error message reporting
4 *
5 * Copyright © 2011-2015 Guillem Jover <guillem@debian.org>
6 *
7 * This is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef LIBDPKG_ERROR_H
22#define LIBDPKG_ERROR_H
23
24#include <dpkg/macros.h>
25
26DPKG_BEGIN_DECLS
27
28/**
29 * @defgroup dpkg_error Error message reporting
30 * @ingroup dpkg-public
31 * @{
32 */
33
34enum dpkg_msg_type {
35 DPKG_MSG_NONE,
36 DPKG_MSG_WARN,
37 DPKG_MSG_ERROR,
38};
39
40struct dpkg_error {
41 enum dpkg_msg_type type;
42
43 char *str;
44};
45
46#define DPKG_ERROR_INIT { DPKG_MSG_NONE, NULL }
47
48int dpkg_put_warn(struct dpkg_error *err, const char *fmt, ...)
49 DPKG_ATTR_PRINTF(2);
50int dpkg_put_error(struct dpkg_error *err, const char *fmt, ...)
51 DPKG_ATTR_PRINTF(2);
52int dpkg_put_errno(struct dpkg_error *err, const char *fmt, ...)
53 DPKG_ATTR_PRINTF(2);
54
55void dpkg_error_print(struct dpkg_error *err, const char *fmt, ...)
56 DPKG_ATTR_PRINTF(2);
57
58void dpkg_error_destroy(struct dpkg_error *err);
59
60/** @} */
61
62DPKG_END_DECLS
63
64#endif /* LIBDPKG_ERROR_H */