diff --git a/src/nfc-utils.c b/src/nfc-utils.c index 5c0a264..f5b13b1 100644 --- a/src/nfc-utils.c +++ b/src/nfc-utils.c @@ -37,7 +37,6 @@ * @brief Provide some examples shared functions like print, parity calculation, options parsing. */ #include -#include #include "nfc-utils.h" diff --git a/src/nfc-utils.h b/src/nfc-utils.h index a0a599e..b46b019 100644 --- a/src/nfc-utils.h +++ b/src/nfc-utils.h @@ -43,7 +43,20 @@ # include # include -# include +# ifdef _WIN32 +# include +# include +static inline void warnx(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); +} +# else +# include +# endif # include /** diff --git a/src/stdlib.c b/src/stdlib.c index 9a0a512..0dfa02f 100644 --- a/src/stdlib.c +++ b/src/stdlib.c @@ -40,19 +40,19 @@ int setenv(const char *name, const char *value, int overwrite) { char *env = getenv(name); if ((env && overwrite) || (!env)) { - char *str[32]; - strcpy(*str, name); - strcat(*str, "="); - strcat(*str, value); - return _putenv(*str); + char str[32]; + strcpy(str, name); + strcat(str, "="); + strcat(str, value); + return _putenv(str); } return -1; } void unsetenv(const char *name) { - char *str[32]; - strcpy(*str, name); - strcat(*str, "="); - _putenv(*str); + char str[32]; + strcpy(str, name); + strcat(str, "="); + _putenv(str); } diff --git a/src/windows.h b/src/windows.h index 2a9e722..134ca99 100644 --- a/src/windows.h +++ b/src/windows.h @@ -35,7 +35,6 @@ # include # include -# include # if defined (__MINGW32__) /* * Cheating here on the snprintf to incorporate the format argument