diff --git a/examples/nfc-emulate-tag.c b/examples/nfc-emulate-tag.c index 6c3773d..d991c44 100644 --- a/examples/nfc-emulate-tag.c +++ b/examples/nfc-emulate-tag.c @@ -153,7 +153,6 @@ main (int argc, char *argv[]) printf ("Connected to NFC device: %s\n", pnd->acName); -/* // Example of a Mifare Classic Mini // Note that crypto1 is not implemented in this example nfc_target_t nt = { @@ -164,7 +163,7 @@ main (int argc, char *argv[]) .nti.nai.szUidLen = 4, .nti.nai.szAtsLen = 0, }; -*/ +/* // Example of a ISO14443-4 (DESfire) nfc_target_t nt = { .ntt = NTT_MIFARE, @@ -175,6 +174,7 @@ main (int argc, char *argv[]) .nti.nai.abtAts = { 0x75, 0x77, 0x81, 0x02, 0x80 }, .nti.nai.szAtsLen = 5, }; +*/ printf ("%s will emulate this ISO14443-A tag:\n", argv[0]); print_nfc_iso14443a_info( nt.nti.nai ); diff --git a/examples/pn53x-tamashell.c b/examples/pn53x-tamashell.c index c7572d7..6f79250 100644 --- a/examples/pn53x-tamashell.c +++ b/examples/pn53x-tamashell.c @@ -21,19 +21,22 @@ along with this program. If not, see . # include "config.h" #endif // HAVE_CONFIG_H -#include +#if defined(HAVE_READLINE) +# include +# include +# include +#else +# define _GNU_SOURCE // for getline on system with glibc < 2.10 +# define _POSIX_C_SOURCE 200809L // for getline on system with glibc >= 2.10 +# include + extern FILE* stdin; +#endif //HAVE_READLINE + #include #include #include #include -#if defined(HAVE_READLINE) -# include -# include -#else - extern FILE* stdin; -#endif //HAVE_READLINE - #include #include @@ -51,7 +54,6 @@ int main(int argc, const char* argv[]) size_t szRxLen; size_t szTxLen; - nfc_device_desc_t device_desc; // Try to open the NFC reader pnd = nfc_connect(NULL); @@ -67,7 +69,6 @@ int main(int argc, const char* argv[]) char * cmd; char * prompt="> "; while(1) { - bool result; int offset=0; #if defined(HAVE_READLINE) cmd=readline(prompt); @@ -83,14 +84,13 @@ int main(int argc, const char* argv[]) fflush(0); size_t n; extern FILE* stdin; - //FIXME: getline not in stdio.h ??? int s = getline(&cmd, &n, stdin); if (s <= 0) { printf("Bye!\n"); free(cmd); break; } - //FIXME: print only if read from redirected stdin (i.e. script) + // FIXME print only if read from redirected stdin (i.e. script) printf("%s", cmd); #endif //HAVE_READLINE if (cmd[0]=='q') { @@ -105,7 +105,7 @@ int main(int argc, const char* argv[]) while (isspace(cmd[offset])) { offset++; } - size = sscanf(cmd+offset, "%2x", &byte); + size = sscanf(cmd+offset, "%2x", (unsigned int*)&byte); if (size<1) { break; }