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:
parent
e70a3314bf
commit
ecc12d28aa
2 changed files with 3 additions and 7 deletions
|
@ -29,6 +29,7 @@ Improvements:
|
|||
- Windows: logging via OutputDebugString(), ease debugging
|
||||
- nfc-mfclassic: use smaller files for cards < 4k
|
||||
- nfc-mfclassic: by defaut don't authorise wrong keyfile, use "f" to force
|
||||
- quick_start_example1.c: remove err.h dependency, easier for Windowsians
|
||||
|
||||
Changes:
|
||||
- Upon malloc error, nfc_init() doesn't force exit() anymore
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue