Indent whole code using make indent. (Fixes issue 84).

This commit is contained in:
Romuald Conty
2010-09-07 17:51:03 +00:00
parent f93b4939f4
commit 18cc86a613
42 changed files with 2613 additions and 2479 deletions

View File

@@ -35,17 +35,18 @@
#define MAX_DEVICE_COUNT 16
int main(int argc, const char* argv[])
int
main (int argc, const char *argv[])
{
size_t szFound;
size_t i;
nfc_device_t* pnd;
size_t szFound;
size_t i;
nfc_device_t *pnd;
nfc_device_desc_t *pnddDevices;
const char* acLibnfcVersion;
bool result;
const char *acLibnfcVersion;
bool result;
byte_t abtRx[MAX_FRAME_LEN];
size_t szRxLen;
byte_t abtRx[MAX_FRAME_LEN];
size_t szRxLen;
const byte_t pncmd_diagnose_communication_line_test[] = { 0xD4, 0x00, 0x00, 0x06, 'l', 'i', 'b', 'n', 'f', 'c' };
const byte_t pncmd_diagnose_rom_test[] = { 0xD4, 0x00, 0x01 };
const byte_t pncmd_diagnose_ram_test[] = { 0xD4, 0x00, 0x02 };
@@ -53,10 +54,9 @@ int main(int argc, const char* argv[])
if (argc > 1) {
errx (1, "usage: %s", argv[0]);
}
// Display libnfc version
acLibnfcVersion = nfc_version();
printf("%s use libnfc %s\n", argv[0], acLibnfcVersion);
acLibnfcVersion = nfc_version ();
printf ("%s use libnfc %s\n", argv[0], acLibnfcVersion);
if (!(pnddDevices = malloc (MAX_DEVICE_COUNT * sizeof (*pnddDevices)))) {
fprintf (stderr, "malloc() failed\n");
@@ -66,38 +66,42 @@ int main(int argc, const char* argv[])
nfc_list_devices (pnddDevices, MAX_DEVICE_COUNT, &szFound);
if (szFound == 0) {
INFO("%s", "No device found.");
INFO ("%s", "No device found.");
}
for (i = 0; i < szFound; i++) {
pnd = nfc_connect(&(pnddDevices[i]));
pnd = nfc_connect (&(pnddDevices[i]));
if (pnd == NULL) {
ERR("%s", "Unable to connect to NFC device.");
ERR ("%s", "Unable to connect to NFC device.");
return EXIT_FAILURE;
}
printf("NFC device [%s] connected.\n",pnd->acName);
printf ("NFC device [%s] connected.\n", pnd->acName);
// FIXME: Direct call
result = pn53x_transceive(pnd,pncmd_diagnose_communication_line_test,sizeof(pncmd_diagnose_communication_line_test),abtRx,&szRxLen);
if ( result ) {
result = (memcmp(pncmd_diagnose_communication_line_test+2, abtRx, sizeof(pncmd_diagnose_communication_line_test)-2 ) == 0);
result =
pn53x_transceive (pnd, pncmd_diagnose_communication_line_test, sizeof (pncmd_diagnose_communication_line_test),
abtRx, &szRxLen);
if (result) {
result =
(memcmp (pncmd_diagnose_communication_line_test + 2, abtRx, sizeof (pncmd_diagnose_communication_line_test) - 2)
== 0);
}
printf(" Communication line test: %s\n", result ? "OK" : "Failed");
printf (" Communication line test: %s\n", result ? "OK" : "Failed");
// FIXME: Direct call
result = pn53x_transceive(pnd,pncmd_diagnose_rom_test,sizeof(pncmd_diagnose_rom_test),abtRx,&szRxLen);
if ( result ) {
result = pn53x_transceive (pnd, pncmd_diagnose_rom_test, sizeof (pncmd_diagnose_rom_test), abtRx, &szRxLen);
if (result) {
result = ((szRxLen == 1) && (abtRx[0] == 0x00));
}
printf(" ROM test: %s\n", result ? "OK" : "Failed");
printf (" ROM test: %s\n", result ? "OK" : "Failed");
// FIXME: Direct call
result = pn53x_transceive(pnd,pncmd_diagnose_ram_test,sizeof(pncmd_diagnose_ram_test),abtRx,&szRxLen);
if ( result ) {
result = pn53x_transceive (pnd, pncmd_diagnose_ram_test, sizeof (pncmd_diagnose_ram_test), abtRx, &szRxLen);
if (result) {
result = ((szRxLen == 1) && (abtRx[0] == 0x00));
}
printf(" RAM test: %s\n", result ? "OK" : "Failed");
printf (" RAM test: %s\n", result ? "OK" : "Failed");
}
}