Major manpage overhaul.
[usmb.git] / utils.h
blob20898aa15576f0f99bc88a2dfac7583e0b373de6
1 /* usmb - mount SMB shares via FUSE and Samba
2 * Copyright (C) 2006-2009 Geoff Johnstone
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef UTILS_H
18 #define UTILS_H
20 #include <stdarg.h>
21 #include <stdbool.h>
22 #include <stddef.h>
24 #ifdef DEBUG
25 #undef DEBUG
26 #define DEBUG(x) (x)
27 #define DEBUGON
28 #else
29 #define DEBUG(x) ((void)0)
30 #endif
32 char * concat_strings (int num, ...) MUSTCHECK;
33 char * xstrdup (const char *in) MUSTCHECK;
34 void xfree (const void *ptr);
35 void clear_and_free (char *ptr);
36 void free_errno (const void *ptr);
37 void xfree_errno (const void *ptr);
38 bool bsnprintf (char *str, size_t size, const char *format, ...)
39 __attribute__ ((format (printf, 3, 4))) MUSTCHECK;
40 bool bvsnprintf (char *str, size_t size,
41 const char *format,
42 va_list ap) MUSTCHECK;
43 bool baprintf (char **out, const char *format, ...)
44 __attribute__ ((format (printf, 2, 3))) MUSTCHECK;
45 bool bvaprintf (char **out, const char *format, va_list ap) MUSTCHECK;
47 #endif