Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/mfoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ int main(int argc, char *const argv[])
exit(EXIT_FAILURE);
}

void usage(FILE *stream, int errno)
void usage(FILE *stream, int exit_code)
{
fprintf(stream, "Usage: mfoc [-h] [-k key] [-f file] ... [-P probnum] [-T tolerance] [-O output]\n");
fprintf(stream, "\n");
Expand All @@ -776,7 +776,7 @@ void usage(FILE *stream, int errno)
fprintf(stream, "\n");
fprintf(stream, "This is mfoc version %s.\n", PACKAGE_VERSION);
fprintf(stream, "For more information, run: 'man mfoc'.\n");
exit(errno);
exit(exit_code);
}

void mf_init(mfreader *r)
Expand Down
2 changes: 1 addition & 1 deletion src/mfoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ typedef struct {
} countKeys;


void usage(FILE *stream, int errno);
void usage(FILE *stream, int exit_code);
void mf_init(mfreader *r);
void mf_configure(nfc_device *pdi);
void mf_select_tag(nfc_device *pdi, nfc_target *pnt);
Expand Down
1 change: 0 additions & 1 deletion src/nfc-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
* @brief Provide some examples shared functions like print, parity calculation, options parsing.
*/
#include <nfc/nfc.h>
#include <err.h>

#include "nfc-utils.h"

Expand Down
15 changes: 14 additions & 1 deletion src/nfc-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,20 @@

# include <stdlib.h>
# include <string.h>
# include <err.h>
# ifdef _WIN32
# include <stdio.h>
# include <stdarg.h>
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 <err.h>
# endif

/**
* @macro DBG
Expand Down