astyle --formatted --mode=c --indent=spaces=2 --indent-switches --indent-preprocessor --keep-one-line-blocks --max-instatement-indent=60 --brackets=linux --pad-oper
This commit is contained in:
parent
67522bae65
commit
562205cc14
23 changed files with 196 additions and 196 deletions
|
|
@ -111,7 +111,7 @@ target_io( nfc_target *pnt, const uint8_t *pbtInput, const size_t szInput, uint8
|
|||
*pszOutput = pnt->nti.nai.szAtsLen + 1;
|
||||
pbtOutput[0] = pnt->nti.nai.szAtsLen + 1; // ISO14443-4 says that ATS contains ATS_Length as first byte
|
||||
if(pnt->nti.nai.szAtsLen) {
|
||||
memcpy(pbtOutput+1, pnt->nti.nai.abtAts, pnt->nti.nai.szAtsLen);
|
||||
memcpy(pbtOutput + 1, pnt->nti.nai.abtAts, pnt->nti.nai.szAtsLen);
|
||||
}
|
||||
break;
|
||||
case 0xc2: // S-block DESELECT
|
||||
|
|
|
|||
|
|
@ -148,9 +148,9 @@ int
|
|||
main (int argc, char *argv[])
|
||||
{
|
||||
int arg, i;
|
||||
bool format= false;
|
||||
bool format = false;
|
||||
unsigned int c;
|
||||
char tmp[3]= { 0x00, 0x00, 0x00 };
|
||||
char tmp[3] = { 0x00, 0x00, 0x00 };
|
||||
|
||||
|
||||
// Get commandline options
|
||||
|
|
@ -159,16 +159,16 @@ main (int argc, char *argv[])
|
|||
print_usage (argv);
|
||||
exit(EXIT_SUCCESS);
|
||||
} else if (0 == strcmp (argv[arg], "-f")) {
|
||||
format= true;
|
||||
format = true;
|
||||
} else if (0 == strcmp (argv[arg], "-q")) {
|
||||
quiet_output = true;
|
||||
} else if (strlen(argv[arg]) == 8) {
|
||||
for(i= 0 ; i < 4 ; ++i) {
|
||||
memcpy(tmp, argv[arg]+i*2, 2);
|
||||
for(i = 0 ; i < 4 ; ++i) {
|
||||
memcpy(tmp, argv[arg] + i * 2, 2);
|
||||
sscanf(tmp, "%02x", &c);
|
||||
abtData[i]= (char) c;
|
||||
abtData[i] = (char) c;
|
||||
}
|
||||
abtData[4]= abtData[0] ^ abtData[1] ^ abtData[2] ^ abtData[3];
|
||||
abtData[4] = abtData[0] ^ abtData[1] ^ abtData[2] ^ abtData[3];
|
||||
iso14443a_crc_append (abtData, 16);
|
||||
} else {
|
||||
ERR ("%s is not supported option.", argv[arg]);
|
||||
|
|
@ -334,21 +334,21 @@ main (int argc, char *argv[])
|
|||
// now reset UID
|
||||
iso14443a_crc_append(abtHalt, 2);
|
||||
transmit_bytes (abtHalt, 4);
|
||||
transmit_bits (abtUnlock1,7);
|
||||
transmit_bits (abtUnlock1, 7);
|
||||
if(format) {
|
||||
transmit_bytes (abtWipe,1);
|
||||
transmit_bytes (abtWipe, 1);
|
||||
transmit_bytes (abtHalt, 4);
|
||||
transmit_bits (abtUnlock1,7);
|
||||
transmit_bits (abtUnlock1, 7);
|
||||
}
|
||||
transmit_bytes (abtUnlock2,1);
|
||||
transmit_bytes (abtWrite,4);
|
||||
transmit_bytes (abtData,18);
|
||||
transmit_bytes (abtUnlock2, 1);
|
||||
transmit_bytes (abtWrite, 4);
|
||||
transmit_bytes (abtData, 18);
|
||||
if(format) {
|
||||
for(i = 3 ; i < 64 ; i += 4) {
|
||||
abtWrite[1]= (char) i;
|
||||
abtWrite[1] = (char) i;
|
||||
iso14443a_crc_append (abtWrite, 2);
|
||||
transmit_bytes (abtWrite,4);
|
||||
transmit_bytes (abtBlank,18);
|
||||
transmit_bytes (abtWrite, 4);
|
||||
transmit_bytes (abtBlank, 18);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ int main(int argc, const char* argv[])
|
|||
FILE* input = NULL;
|
||||
|
||||
if (argc >= 2) {
|
||||
if((input = fopen(argv[1], "r"))==NULL) {
|
||||
if((input = fopen(argv[1], "r")) == NULL) {
|
||||
ERR ("%s", "Cannot open file.");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ int main(int argc, const char* argv[])
|
|||
}
|
||||
sscanf(cmd + offset, "%d", &s);
|
||||
printf("Pause for %i msecs\n", s);
|
||||
if (s>0) {
|
||||
if (s > 0) {
|
||||
sleep(s * SUSP_TIME);
|
||||
}
|
||||
free(cmd);
|
||||
|
|
@ -160,13 +160,13 @@ int main(int argc, const char* argv[])
|
|||
while (isspace(cmd[offset])) {
|
||||
offset++;
|
||||
}
|
||||
size = sscanf(cmd+offset, "%2x", &byte);
|
||||
size = sscanf(cmd + offset, "%2x", &byte);
|
||||
if (size < 1 ) {
|
||||
break;
|
||||
}
|
||||
abtTx[i] = byte;
|
||||
szTx++;
|
||||
if (cmd[offset+1] == 0) { // if last hex was only 1 symbol
|
||||
if (cmd[offset + 1] == 0) { // if last hex was only 1 symbol
|
||||
break;
|
||||
}
|
||||
offset += 2;
|
||||
|
|
@ -177,7 +177,7 @@ int main(int argc, const char* argv[])
|
|||
continue;
|
||||
}
|
||||
printf("Tx: ");
|
||||
print_hex(abtTx,szTx);
|
||||
print_hex(abtTx, szTx);
|
||||
|
||||
szRx = sizeof(abtRx);
|
||||
int res = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue