chiark / gitweb /
nntpid: Chiark::NNTP: spot if cat /etc/nntpserver fails
[chiark-utils.git] / cprogs / common.h
1 /*
2  * common.[ch] - C helpers common to the whole of chiark-utils
3  *
4  * Copyright 2007 Canonical Ltd
5  * Copyright 2016 Canonical Ltd
6  *
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public
19  * License along with this file; if not, consult the Free Software
20  * Foundation's website at www.fsf.org, or the GNU Project website at
21  * www.gnu.org.
22  *
23  * Should be included early so that _GNU_SOURCE takes effect.
24  */
25
26 #ifndef COMMON_H
27 #define COMMON_H
28
29 #define _GNU_SOURCE
30
31 #include <stdarg.h>
32 #include <stdio.h>
33 #include <stdlib.h>
34
35 char *m_vasprintf(const char *fmt, va_list al);
36 char *m_asprintf(const char *fmt, ...);
37
38 /* to be provided by program: */
39 void common_die(const char *what);
40 void common_diee(const char *what); /* prints errno */
41
42 void *xmalloc(size_t sz);
43
44 #endif /*COMMON_H*/