mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07: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 <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
|
@ -534,6 +535,9 @@ int flash_write(flash_file_t *ctx) {
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
PrintAndLogEx(SUCCESS, "Writing segments for file: %s", ctx->filename);
|
PrintAndLogEx(SUCCESS, "Writing segments for file: %s", ctx->filename);
|
||||||
|
|
||||||
|
bool filter_ansi = !session.supports_colors;
|
||||||
|
|
||||||
for (int i = 0; i < ctx->num_segs; i++) {
|
for (int i = 0; i < ctx->num_segs; i++) {
|
||||||
flash_seg_t *seg = &ctx->segments[i];
|
flash_seg_t *seg = &ctx->segments[i];
|
||||||
|
|
||||||
|
@ -561,11 +565,15 @@ int flash_write(flash_file_t *ctx) {
|
||||||
baddr += block_size;
|
baddr += block_size;
|
||||||
length -= block_size;
|
length -= block_size;
|
||||||
block++;
|
block++;
|
||||||
if ( len < strlen(ice) )
|
if ( len < strlen(ice) ) {
|
||||||
fprintf(stdout, "%c", ice[len++]);
|
if (filter_ansi && !isalpha(ice[len]) ) {
|
||||||
else
|
len++;
|
||||||
|
} else {
|
||||||
|
fprintf(stdout, "%c", ice[len++]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
fprintf(stdout, ".");
|
fprintf(stdout, ".");
|
||||||
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
PrintAndLogEx(NORMAL, " " _GREEN_("OK"));
|
PrintAndLogEx(NORMAL, " " _GREEN_("OK"));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue