mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
CHG: syntax sugar
This commit is contained in:
parent
197c8f3f42
commit
ceb34a3c1b
1 changed files with 13 additions and 7 deletions
|
@ -924,7 +924,8 @@ int CmdLegicDump(const char *Cmd){
|
||||||
else
|
else
|
||||||
sprintf(fnameptr + fileNlen,".bin");
|
sprintf(fnameptr + fileNlen,".bin");
|
||||||
|
|
||||||
if ((f = fopen(filename,"wb")) == NULL) {
|
f = fopen(filename,"wb");
|
||||||
|
if (!f) {
|
||||||
PrintAndLog("Could not create file name %s", filename);
|
PrintAndLog("Could not create file name %s", filename);
|
||||||
if (data)
|
if (data)
|
||||||
free(data);
|
free(data);
|
||||||
|
@ -1000,7 +1001,8 @@ int CmdLegicRestore(const char *Cmd){
|
||||||
fnameptr += fileNlen;
|
fnameptr += fileNlen;
|
||||||
sprintf(fnameptr, ".bin");
|
sprintf(fnameptr, ".bin");
|
||||||
|
|
||||||
if ((f = fopen(filename,"rb")) == NULL) {
|
f = fopen(filename,"rb");
|
||||||
|
if (!f) {
|
||||||
PrintAndLog("File %s not found or locked", filename);
|
PrintAndLog("File %s not found or locked", filename);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
@ -1019,13 +1021,13 @@ int CmdLegicRestore(const char *Cmd){
|
||||||
|
|
||||||
// load file
|
// load file
|
||||||
size_t bytes_read = fread(data, 1, numofbytes, f);
|
size_t bytes_read = fread(data, 1, numofbytes, f);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
if ( bytes_read == 0){
|
if ( bytes_read == 0){
|
||||||
PrintAndLog("File reading error");
|
PrintAndLog("File reading error");
|
||||||
free(data);
|
free(data);
|
||||||
fclose(f);
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
PrintAndLog("Restoring to card");
|
PrintAndLog("Restoring to card");
|
||||||
|
|
||||||
|
@ -1096,7 +1098,8 @@ int CmdLegicELoad(const char *Cmd) {
|
||||||
sprintf(fnameptr, ".bin");
|
sprintf(fnameptr, ".bin");
|
||||||
|
|
||||||
// open file
|
// open file
|
||||||
if ((f = fopen(filename,"rb")) == NULL) {
|
f = fopen(filename,"rb");
|
||||||
|
if (!f) {
|
||||||
PrintAndLog("File %s not found or locked", filename);
|
PrintAndLog("File %s not found or locked", filename);
|
||||||
free(data);
|
free(data);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1108,9 +1111,11 @@ int CmdLegicELoad(const char *Cmd) {
|
||||||
PrintAndLog("File reading error");
|
PrintAndLog("File reading error");
|
||||||
free(data);
|
free(data);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
f = NULL;
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
f = NULL;
|
||||||
|
|
||||||
// transfer to device
|
// transfer to device
|
||||||
legic_seteml(data, 0, numofbytes);
|
legic_seteml(data, 0, numofbytes);
|
||||||
|
@ -1170,7 +1175,8 @@ int CmdLegicESave(const char *Cmd) {
|
||||||
sprintf(fnameptr + fileNlen,".bin");
|
sprintf(fnameptr + fileNlen,".bin");
|
||||||
|
|
||||||
// open file
|
// open file
|
||||||
if ((f = fopen(filename,"wb")) == NULL) {
|
f = fopen(filename,"wb");
|
||||||
|
if (!f) {
|
||||||
PrintAndLog("Could not create file name %s", filename);
|
PrintAndLog("Could not create file name %s", filename);
|
||||||
free(data);
|
free(data);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue