Fix minor warnings

This commit is contained in:
Romuald Conty 2010-10-07 12:59:12 +00:00
parent 814ccad1e3
commit 840ff89450
2 changed files with 15 additions and 15 deletions

View file

@ -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 );

View file

@ -21,19 +21,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "config.h"
#endif // HAVE_CONFIG_H
#include <stdio.h>
#if defined(HAVE_READLINE)
# include <stdio.h>
# include <readline/readline.h>
# include <readline/history.h>
#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 <stdio.h>
extern FILE* stdin;
#endif //HAVE_READLINE
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#if defined(HAVE_READLINE)
# include <readline/readline.h>
# include <readline/history.h>
#else
extern FILE* stdin;
#endif //HAVE_READLINE
#include <nfc/nfc.h>
#include <nfc/nfc-messages.h>
@ -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;
}