Remove extra whitespaces/tabs before EOL.

find . -name '*.[ch]' | xargs perl -pi -e 's/\t+$//; s/ +$//'

Thanks to Ludovic.
This commit is contained in:
Romuald Conty 2012-05-29 00:33:22 +00:00
parent 167238c60d
commit 26865bbc19
66 changed files with 483 additions and 483 deletions

View file

@ -1,13 +1,13 @@
/*-
* Public platform independent Near Field Communication (NFC) library examples
*
*
* Copyright (C) 2009, Roel Verdult
* Copyright (C) 2010, Romuald Conty, Romain Tartière
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
* 2 )Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@ -23,7 +23,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* Note that this license only applies on the examples, NFC library itself is under LGPL
*
*/
@ -45,9 +45,9 @@
* The specified MIFARE command will be executed on the tag. There are different commands possible, they all require the destination block number.
* @note There are three different types of information (Authenticate, Data and Value).
*
* First an authentication must take place using Key A or B. It requires a 48 bit Key (6 bytes) and the UID.
* First an authentication must take place using Key A or B. It requires a 48 bit Key (6 bytes) and the UID.
* They are both used to initialize the internal cipher-state of the PN53X chip (http://libnfc.org/hardware/pn53x-chip).
* After a successful authentication it will be possible to execute other commands (e.g. Read/Write).
* After a successful authentication it will be possible to execute other commands (e.g. Read/Write).
* The MIFARE Classic Specification (http://www.nxp.com/acrobat/other/identification/M001053_MF1ICS50_rev5_3.pdf) explains more about this process.
*/
bool

View file

@ -1,13 +1,13 @@
/*-
* Public platform independent Near Field Communication (NFC) library examples
*
*
* Copyright (C) 2009, Roel Verdult
* Copyright (C) 2010, Romuald Conty, Romain Tartière
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
* 2 )Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@ -23,7 +23,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* Note that this license only applies on the examples, NFC library itself is under LGPL
*
*/

View file

@ -1,13 +1,13 @@
/*-
* Public platform independent Near Field Communication (NFC) library examples
*
*
* Copyright (C) 2010, Roel Verdult, Romuald Conty
* Copyright (C) 2011, Romain Tartière, Romuald Conty
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
* 2 )Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@ -23,7 +23,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* Note that this license only applies on the examples, NFC library itself is under LGPL
*
*/
@ -91,7 +91,7 @@ uint8_t nfcforum_capability_container[] = {
0x00, 0x0F, /* CCLEN 15 bytes */
0x20, /* Mapping version 2.0, use option -1 to force v1.0 */
0x00, 0x54, /* MLe Maximum R-ADPU data size */
// Notes:
// Notes:
// - I (Romuald) don't know why Nokia 6212 Classic refuses the NDEF message if MLe is more than 0xFD (any suggests are welcome);
// - ARYGON devices doesn't support extended frame sending, consequently these devices can't sent more than 0xFE bytes as APDU, so 0xFB APDU data bytes.
// - I (Romuald) don't know why ARYGON device doesn't ACK when MLe > 0x54 (ARYGON frame length = 0xC2 (192 bytes))
@ -364,7 +364,7 @@ main (int argc, char *argv[])
err (EXIT_FAILURE, "Can't load NDEF file '%s'", argv[1 + options]);
}
}
nfc_init (NULL);
// Try to open the NFC reader
@ -391,7 +391,7 @@ main (int argc, char *argv[])
err (EXIT_FAILURE, "Can't save NDEF file '%s'", argv[2 + options]);
}
}
nfc_exit (NULL);
exit (EXIT_SUCCESS);
}

View file

@ -1,13 +1,13 @@
/*-
* Public platform independent Near Field Communication (NFC) library examples
*
*
* Copyright (C) 2009, Roel Verdult
* Copyright (C) 2010, Romuald Conty, Romain Tartière
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
* 2 )Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@ -23,7 +23,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* Note that this license only applies on the examples, NFC library itself is under LGPL
*
*/
@ -75,7 +75,7 @@ main (int argc, const char *argv[])
int res = 0;
nfc_init (NULL);
// Display libnfc version
acLibnfcVersion = nfc_version ();
printf ("%s uses libnfc %s\n", argv[0], acLibnfcVersion);
@ -132,7 +132,7 @@ main (int argc, const char *argv[])
}
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
exit (EXIT_FAILURE);
}
printf ("NFC device: %s opened\n", nfc_device_get_name (pnd));

View file

@ -1,14 +1,14 @@
/*-
* Public platform independent Near Field Communication (NFC) library examples
*
*
* Copyright (C) 2009, Roel Verdult
* Copyright (C) 2010, Romuald Conty, Romain Tartière
* Copyright (C) 2011, Adam Laurie
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
* 2 )Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@ -24,7 +24,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* Note that this license only applies on the examples, NFC library itself is under LGPL
*
*/
@ -508,7 +508,7 @@ main (int argc, const char *argv[])
// printf("Successfully opened required files\n");
nfc_init (NULL);
// Try to open the NFC reader
pnd = nfc_open (NULL, NULL);
if (pnd == NULL) {
@ -518,7 +518,7 @@ main (int argc, const char *argv[])
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
exit (EXIT_FAILURE);
};
// Let the reader only try once to find a tag
@ -594,7 +594,7 @@ main (int argc, const char *argv[])
nfc_close (pnd);
break;
};
nfc_exit (NULL);
exit (EXIT_SUCCESS);
}

View file

@ -1,13 +1,13 @@
/*-
* Public platform independent Near Field Communication (NFC) library examples
*
*
* Copyright (C) 2009, Roel Verdult
* Copyright (C) 2010, Romuald Conty
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
* 2 )Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@ -23,7 +23,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* Note that this license only applies on the examples, NFC library itself is under LGPL
*
*/
@ -149,7 +149,7 @@ write_card (void)
bFailure = false;
}
// For the Mifare Ultralight, this write command can be used
// in compatibility mode, which only actually writes the first
// in compatibility mode, which only actually writes the first
// page (4 bytes). The Ultralight-specific Write command only
// writes one page at a time.
uiBlock = page / 4;
@ -205,7 +205,7 @@ main (int argc, const char *argv[])
DBG ("Successfully opened the dump file\n");
nfc_init (NULL);
// Try to open the NFC device
pnd = nfc_open (NULL, NULL);
if (pnd == NULL) {
@ -215,7 +215,7 @@ main (int argc, const char *argv[])
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
exit (EXIT_FAILURE);
}
// Let the device only try once to find a tag

View file

@ -1,14 +1,14 @@
/*-
* Public platform independent Near Field Communication (NFC) library examples
*
*
* Copyright (C) 2009, Roel Verdult
* Copyright (C) 2010, Romuald Conty, Romain Tartière
* Copyright (C) 2011-2012, Romuald Conty
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
* 2 )Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@ -24,7 +24,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* Note that this license only applies on the examples, NFC library itself is under LGPL
*
*/
@ -75,7 +75,7 @@ main (int argc, const char *argv[])
bool verbose = false;
nfc_init (NULL);
// Display libnfc version
acLibnfcVersion = nfc_version ();
printf ("%s uses libnfc %s\n", argv[0], acLibnfcVersion);

View file

@ -1,12 +1,12 @@
/*-
* Public platform independent Near Field Communication (NFC) library examples
*
*
* Copyright (C) 2011, Romuald Conty
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
* 2 )Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@ -22,7 +22,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* Note that this license only applies on the examples, NFC library itself is under LGPL
*
*/
@ -85,7 +85,7 @@ build_felica_frame(const nfc_felica_info nfi, const uint8_t command, const uint8
}
#define CHECK 0x06
static int
static int
nfc_forum_tag_type3_check (nfc_device *dev, const nfc_target nt, const uint16_t block, const uint8_t block_count, uint8_t *data, size_t *data_len)
{
uint8_t payload[1024] = {
@ -94,7 +94,7 @@ nfc_forum_tag_type3_check (nfc_device *dev, const nfc_target nt, const uint16_t
block_count,
0x80, block, // block 0
};
size_t payload_len = 1 + 2 + 1;
for (uint8_t b = 0; b < block_count; b++) {
if (block < 0x100) {
@ -104,7 +104,7 @@ nfc_forum_tag_type3_check (nfc_device *dev, const nfc_target nt, const uint16_t
payload[payload_len++] = 0x00;
payload[payload_len++] = (block + b) >> 8;
payload[payload_len++] = (block + b) & 0xff;
}
}
}
uint8_t frame[1024];
@ -117,7 +117,7 @@ nfc_forum_tag_type3_check (nfc_device *dev, const nfc_target nt, const uint16_t
return res;
}
const int res_overhead = 1 + 1 + 8 + 2; // 1+1+8+2: LEN + CMD + NFCID2 + STATUS
if (res < res_overhead) {
if (res < res_overhead) {
// Not enough data
return -1;
}
@ -154,44 +154,44 @@ main(int argc, char *argv[])
(void)argv;
int ch;
char *ndef_output = NULL;
while ((ch = getopt (argc, argv, "ho:")) != -1) {
switch (ch) {
case 'h':
print_usage(argv[0]);
exit (EXIT_SUCCESS);
break;
case 'o':
ndef_output = optarg;
break;
case '?':
if (optopt == 'o')
fprintf (stderr, "Option -%c requires an argument.\n", optopt);
default:
print_usage (argv[0]);
exit (EXIT_FAILURE);
}
}
if (ndef_output == NULL) {
print_usage (argv[0]);
exit (EXIT_FAILURE);
}
FILE* message_stream = NULL;
FILE* ndef_stream = NULL;
if ((strlen (ndef_output) == 1) && (ndef_output[0] == '-')) {
message_stream = stderr;
ndef_stream = stdout;
} else {
message_stream = stdout;
ndef_stream = fopen(ndef_output, "wb");
if (!ndef_stream) {
fprintf (stderr, "Could not open file %s.\n", ndef_output);
exit (EXIT_FAILURE);
}
char *ndef_output = NULL;
while ((ch = getopt (argc, argv, "ho:")) != -1) {
switch (ch) {
case 'h':
print_usage(argv[0]);
exit (EXIT_SUCCESS);
break;
case 'o':
ndef_output = optarg;
break;
case '?':
if (optopt == 'o')
fprintf (stderr, "Option -%c requires an argument.\n", optopt);
default:
print_usage (argv[0]);
exit (EXIT_FAILURE);
}
}
if (ndef_output == NULL) {
print_usage (argv[0]);
exit (EXIT_FAILURE);
}
FILE* message_stream = NULL;
FILE* ndef_stream = NULL;
if ((strlen (ndef_output) == 1) && (ndef_output[0] == '-')) {
message_stream = stderr;
ndef_stream = stdout;
} else {
message_stream = stdout;
ndef_stream = fopen(ndef_output, "wb");
if (!ndef_stream) {
fprintf (stderr, "Could not open file %s.\n", ndef_output);
exit (EXIT_FAILURE);
}
}
nfc_init (NULL);
pnd = nfc_open (NULL, NULL);
@ -214,7 +214,7 @@ main(int argc, char *argv[])
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
exit (EXIT_FAILURE);
}
fprintf (message_stream, "Place your NFC Forum Tag Type 3 in the field...\n");
@ -227,7 +227,7 @@ main(int argc, char *argv[])
goto error;
}
// Check if System Code equals 0x12fc
// Check if System Code equals 0x12fc
const uint8_t abtNfcForumSysCode[] = { 0x12, 0xfc };
if (0 != memcmp (nt.nti.nfi.abtSysCode, abtNfcForumSysCode, 2)) {
// Retry with special polling
@ -237,7 +237,7 @@ main(int argc, char *argv[])
error = EXIT_FAILURE;
goto error;
}
// Check again if System Code equals 0x12fc
// Check again if System Code equals 0x12fc
if (0 != memcmp (nt.nti.nfi.abtSysCode, abtNfcForumSysCode, 2)) {
fprintf (stderr, "Tag is not NFC Forum Tag Type 3 compliant.\n");
error = EXIT_FAILURE;

View file

@ -1,12 +1,12 @@
/*-
* Public platform independent Near Field Communication (NFC) library examples
*
*
* Copyright (C) 2010, Romuald Conty
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
* 2 )Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@ -22,7 +22,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* Note that this license only applies on the examples, NFC library itself is under LGPL
*
*/
@ -192,7 +192,7 @@ main (int argc, char *argv[])
#endif
nfc_init (NULL);
nfc_connstring connstrings[MAX_DEVICE_COUNT];
// List available devices
size_t szFound = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
@ -277,7 +277,7 @@ main (int argc, char *argv[])
nfc_exit (NULL);
exit(EXIT_FAILURE);
}
}
}
}
if (initiator_only_mode) {
printf ("Hint: tag <---> *INITIATOR* (relay) <-FD3/FD4-> target (relay) <---> original reader\n\n");
@ -352,7 +352,7 @@ main (int argc, char *argv[])
printf("We will emulate:\n");
print_nfc_iso14443a_info (ntEmulatedTarget.nti.nai, false);
// Try to open the NFC emulator device
pndTarget = nfc_open (NULL, connstrings[0]);
if (pndTarget == NULL) {

View file

@ -1,13 +1,13 @@
/*-
* Public platform independent Near Field Communication (NFC) library examples
*
*
* Copyright (C) 2009, Roel Verdult
* Copyright (C) 2010, Romuald Conty, Romain Tartière
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
* 2 )Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@ -23,7 +23,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* Note that this license only applies on the examples, NFC library itself is under LGPL
*
*/

View file

@ -1,13 +1,13 @@
/*-
* Public platform independent Near Field Communication (NFC) library examples
*
*
* Copyright (C) 2009, Roel Verdult
* Copyright (C) 2010, Romuald Conty, Romain Tartière
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
* 2 )Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@ -23,7 +23,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* Note that this license only applies on the examples, NFC library itself is under LGPL
*
*/