dpkg 1.21.11
error.h
Go to the documentation of this file.
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 <stdbool.h>
25
26#include <dpkg/macros.h>
27
29
40};
41
42struct dpkg_error {
44
46 char *str;
47};
48
49#define DPKG_ERROR_INIT { DPKG_MSG_NONE, 0, NULL }
50
51#define DPKG_ERROR_OBJECT (struct dpkg_error)DPKG_ERROR_INIT
52
53bool dpkg_has_error(struct dpkg_error *err);
54
55int dpkg_put_warn(struct dpkg_error *err, const char *fmt, ...)
57int dpkg_put_error(struct dpkg_error *err, const char *fmt, ...)
59int dpkg_put_errno(struct dpkg_error *err, const char *fmt, ...)
61
62void dpkg_error_print(struct dpkg_error *err, const char *fmt, ...)
64
65void dpkg_error_move(struct dpkg_error *dst, struct dpkg_error *src);
66void dpkg_error_destroy(struct dpkg_error *err);
67
71
72#endif /* LIBDPKG_ERROR_H */
void dpkg_error_print(struct dpkg_error *err, const char *fmt,...) DPKG_ATTR_PRINTF(2)
Definition: error.c:94
bool dpkg_has_error(struct dpkg_error *err)
Definition: error.c:52
dpkg_msg_type
Definition: error.h:36
void dpkg_error_move(struct dpkg_error *dst, struct dpkg_error *src)
Definition: error.c:112
void dpkg_error_destroy(struct dpkg_error *err)
Definition: error.c:121
int dpkg_put_errno(struct dpkg_error *err, const char *fmt,...) DPKG_ATTR_PRINTF(2)
Definition: error.c:82
int dpkg_put_warn(struct dpkg_error *err, const char *fmt,...) DPKG_ATTR_PRINTF(2)
Definition: error.c:58
int dpkg_put_error(struct dpkg_error *err, const char *fmt,...) DPKG_ATTR_PRINTF(2)
Definition: error.c:70
@ DPKG_MSG_ERROR
Definition: error.h:39
@ DPKG_MSG_WARN
Definition: error.h:38
@ DPKG_MSG_NONE
Definition: error.h:37
#define DPKG_BEGIN_DECLS
Definition: macros.h:86
#define DPKG_ATTR_PRINTF(n)
Definition: macros.h:56
#define DPKG_END_DECLS
Definition: macros.h:87
Definition: error.h:42
char * str
Definition: error.h:46
int syserrno
Definition: error.h:45
enum dpkg_msg_type type
Definition: error.h:43