mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-12-31 04:39:49 +08:00
filter ansi
This commit is contained in:
parent
189523b190
commit
3e3dc83789
1 changed files with 12 additions and 4 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ui.h"
|
||||
#include "elf.h"
|
||||
|
@ -534,6 +535,9 @@ int flash_write(flash_file_t *ctx) {
|
|||
int len = 0;
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Writing segments for file: %s", ctx->filename);
|
||||
|
||||
bool filter_ansi = !session.supports_colors;
|
||||
|
||||
for (int i = 0; i < ctx->num_segs; i++) {
|
||||
flash_seg_t *seg = &ctx->segments[i];
|
||||
|
||||
|
@ -561,11 +565,15 @@ int flash_write(flash_file_t *ctx) {
|
|||
baddr += block_size;
|
||||
length -= block_size;
|
||||
block++;
|
||||
if ( len < strlen(ice) )
|
||||
fprintf(stdout, "%c", ice[len++]);
|
||||
else
|
||||
if ( len < strlen(ice) ) {
|
||||
if (filter_ansi && !isalpha(ice[len]) ) {
|
||||
len++;
|
||||
} else {
|
||||
fprintf(stdout, "%c", ice[len++]);
|
||||
}
|
||||
} else {
|
||||
fprintf(stdout, ".");
|
||||
|
||||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
PrintAndLogEx(NORMAL, " " _GREEN_("OK"));
|
||||
|
|
Loading…
Reference in a new issue