2 * common.[ch] - C helpers common to the whole of chiark-utils
4 * Copyright 2007 Canonical Ltd
5 * Copyright 2016 Canonical Ltd
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.
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.
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
23 * Should be included early so that _GNU_SOURCE takes effect.
37 char *m_vasprintf(const char *fmt, va_list al);
38 char *m_asprintf(const char *fmt, ...);
40 /* to be provided by program: */
41 void common_die(const char *what);
42 void common_diee(const char *what); /* prints errno */
43 void nonblock(int fd);
45 void *xmalloc(size_t sz);
47 #define FILLZERO(object) (memset((&object),0,sizeof(object)))
49 extern char **environ; // no header file for this, srsly!