mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-03-01 13:16:39 +00:00
quick_start_example1.c: avoid using warnx() to remove err.h dependency
err.h is not available under Windows and the goal of this example is not to learn how to get around that problem ;)
This commit is contained in:
@@ -6,12 +6,7 @@
|
||||
// To compile this simple example:
|
||||
// $ gcc -o quick_start_example1 quick_start_example1.c -lnfc
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <err.h>
|
||||
#include <nfc/nfc.h>
|
||||
|
||||
static void
|
||||
@@ -37,7 +32,7 @@ main(int argc, const char *argv[])
|
||||
// Initialize libnfc and set the nfc_context
|
||||
nfc_init(&context);
|
||||
if (context == NULL) {
|
||||
warnx("Unable to init libnfc (malloc)\n");
|
||||
printf("Unable to init libnfc (malloc)\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -53,7 +48,7 @@ main(int argc, const char *argv[])
|
||||
pnd = nfc_open(context, NULL);
|
||||
|
||||
if (pnd == NULL) {
|
||||
warnx("ERROR: %s", "Unable to open NFC device.");
|
||||
printf("ERROR: %s", "Unable to open NFC device.");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
// Set opened NFC device to initiator mode
|
||||
|
||||
Reference in New Issue
Block a user