mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-12-25 01:21:52 +08:00
chg: 'hf mf csave'
chg: 'mem save' chg: 'hf 15 dump' - no extra newline after last block in emlfile
This commit is contained in:
parent
53feba2bbe
commit
0e7d8faf59
3 changed files with 12 additions and 9 deletions
|
@ -2950,7 +2950,9 @@ int CmdHF14AMfCSave(const char *Cmd) {
|
|||
// eml
|
||||
for (j = 0; j < 16; j++)
|
||||
fprintf(feml, "%02x", buf[j]);
|
||||
fprintf(feml,"\n");
|
||||
|
||||
if (i != numBlocks -1)
|
||||
fprintf(feml,"\n");
|
||||
|
||||
// bin
|
||||
fwrite(buf, 1, sizeof(buf), fbin);
|
||||
|
|
|
@ -57,9 +57,7 @@ int fileExists(const char *filename) {
|
|||
|
||||
int saveFile(const char *preferredName, const char *suffix, const void* data, size_t datalen) {
|
||||
int size = sizeof(char) * (strlen(preferredName) + strlen(suffix) + 10);
|
||||
char * fileName = malloc(size);
|
||||
|
||||
memset(fileName, 0, size);
|
||||
char * fileName = calloc(size,sizeof(char));
|
||||
int num = 1;
|
||||
sprintf(fileName,"%s.%s", preferredName, suffix);
|
||||
while (fileExists(fileName)) {
|
||||
|
@ -91,11 +89,10 @@ int saveFileEML(const char *preferredName, const char *suffix, uint8_t* data, si
|
|||
|
||||
int retval = 0;
|
||||
int blocks = datalen/blocksize;
|
||||
uint16_t currblock = 1;
|
||||
int i,j;
|
||||
int size = sizeof(char) * (strlen(preferredName) + strlen(suffix) + 10);
|
||||
char * fileName = malloc(size);
|
||||
|
||||
memset(fileName, 0, size);
|
||||
char * fileName = calloc(size, sizeof(char));
|
||||
int num = 1;
|
||||
sprintf(fileName,"%s.%s", preferredName, suffix);
|
||||
while (fileExists(fileName)) {
|
||||
|
@ -115,8 +112,12 @@ int saveFileEML(const char *preferredName, const char *suffix, uint8_t* data, si
|
|||
|
||||
for (i = 0; i < datalen; i++) {
|
||||
fprintf(f, "%02X", data[i] );
|
||||
if ( (i+1) % blocksize == 0)
|
||||
|
||||
// no extra line in the end
|
||||
if ( (i+1) % blocksize == 0 && currblock != blocks ) {
|
||||
fprintf(f, "\n");
|
||||
currblock++;
|
||||
}
|
||||
}
|
||||
// left overs
|
||||
if ( datalen % blocksize != 0) {
|
||||
|
|
|
@ -620,7 +620,7 @@ int saveTraceCard(void) {
|
|||
|
||||
// no extra line in the end
|
||||
if ( i < 255 )
|
||||
fprintf(f,"\n");
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
fflush(f);
|
||||
fclose(f);
|
||||
|
|
Loading…
Reference in a new issue