2 * Copyright (c) 2012 - 2015 Tony Finch <dot@dotat.at>
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 /* Stop being stupid about POSIX functions */
27 #define _CRT_SECURE_NO_WARNINGS
28 #define _SCL_SECURE_NO_WARNINGS
29 #define _CRT_NONSTDC_NO_WARNINGS
39 /* Windows POSIX-flavoured headers */
52 /* used by err.c and getopt.c */
53 #define _getprogname() "unifdef"
56 * The snprintf() workaround is unnecessary in Visual Studio 2015 or later
57 * but dogma dictates that #if directives are not allowed inside unifdef.
59 #define snprintf c99_snprintf
62 int replace(const char *oldname, const char *newname);
63 FILE *mktempmode(char *tmp, int mode);
64 FILE *fbinmode(FILE *fp);
65 int c99_snprintf(char *buf, size_t buflen, const char *format, ...);
68 void err(int, const char *, ...);
69 void verr(int, const char *, va_list);
70 void errc(int, int, const char *, ...);
71 void verrc(int, int, const char *, va_list);
72 void errx(int, const char *, ...);
73 void verrx(int, const char *, va_list);
74 void warn(const char *, ...);
75 void vwarn(const char *, va_list);
76 void warnc(int, const char *, ...);
77 void vwarnc(int, const char *, va_list);
78 void warnx(const char *, ...);
79 void vwarnx(const char *, va_list);
82 int getopt(int nargc, char *nargv[], const char *ostr);
83 extern int opterr, optind, optopt, optreset;