Reindent after last commit.
Also reindent a forgotten switch/case while here.
This commit is contained in:
parent
93f28ed83e
commit
782e276a7a
1 changed files with 41 additions and 41 deletions
|
@ -55,16 +55,16 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
while ((ch = getopt (argc, argv, "hy")) != -1) {
|
while ((ch = getopt (argc, argv, "hy")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
break;
|
break;
|
||||||
case 'y':
|
case 'y':
|
||||||
configure_options.interactive = false;
|
configure_options.interactive = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
|
@ -105,41 +105,41 @@ main(int argc, char *argv[])
|
||||||
size_t tag_uid_len = strlen (tag_uid) / 2;
|
size_t tag_uid_len = strlen (tag_uid) / 2;
|
||||||
switch (tag_uid_len) {
|
switch (tag_uid_len) {
|
||||||
case 7: // Regular UID
|
case 7: // Regular UID
|
||||||
if (configure_options.interactive) {
|
if (configure_options.interactive) {
|
||||||
printf ("Configure random UID (this cannot be undone) [yN] ");
|
printf ("Configure random UID (this cannot be undone) [yN] ");
|
||||||
fgets (buffer, BUFSIZ, stdin);
|
fgets (buffer, BUFSIZ, stdin);
|
||||||
do_it = ((buffer[0] == 'y') || (buffer[0] == 'Y'));
|
do_it = ((buffer[0] == 'y') || (buffer[0] == 'Y'));
|
||||||
} else {
|
} else {
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
}
|
|
||||||
|
|
||||||
if (do_it) {
|
|
||||||
|
|
||||||
res = mifare_desfire_connect (tags[i]);
|
|
||||||
if (res < 0) {
|
|
||||||
warnx ("Can't connect to Mifare DESFire target.");
|
|
||||||
error = EXIT_FAILURE;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MifareDESFireKey default_key = mifare_desfire_des_key_new_with_version (null_key_data);
|
if (do_it) {
|
||||||
res = mifare_desfire_authenticate (tags[i], 0, default_key);
|
|
||||||
if (res < 0) {
|
|
||||||
freefare_perror (tags[i], "mifare_desfire_authenticate");
|
|
||||||
error = EXIT_FAILURE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
mifare_desfire_key_free (default_key);
|
|
||||||
|
|
||||||
res = mifare_desfire_set_configuration (tags[i], false, true);
|
res = mifare_desfire_connect (tags[i]);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
freefare_perror (tags[i], "mifare_desfire_set_configuration");
|
warnx ("Can't connect to Mifare DESFire target.");
|
||||||
error = EXIT_FAILURE;
|
error = EXIT_FAILURE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mifare_desfire_disconnect (tags[i]);
|
MifareDESFireKey default_key = mifare_desfire_des_key_new_with_version (null_key_data);
|
||||||
}
|
res = mifare_desfire_authenticate (tags[i], 0, default_key);
|
||||||
|
if (res < 0) {
|
||||||
|
freefare_perror (tags[i], "mifare_desfire_authenticate");
|
||||||
|
error = EXIT_FAILURE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
mifare_desfire_key_free (default_key);
|
||||||
|
|
||||||
|
res = mifare_desfire_set_configuration (tags[i], false, true);
|
||||||
|
if (res < 0) {
|
||||||
|
freefare_perror (tags[i], "mifare_desfire_set_configuration");
|
||||||
|
error = EXIT_FAILURE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
mifare_desfire_disconnect (tags[i]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4: // Random UID
|
case 4: // Random UID
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue