make clean_ascii a util function

This commit is contained in:
James Chambers 2017-03-03 18:04:58 -05:00
parent 4bbf5ad17d
commit d172c17ca4
3 changed files with 14 additions and 7 deletions

View file

@ -8,6 +8,7 @@
// utilities
//-----------------------------------------------------------------------------
#include <ctype.h>
#include "util.h"
#define MAX_BIN_BREAK_LENGTH (3072+384+1)
@ -581,3 +582,12 @@ void rol(uint8_t *data, const size_t len){
}
data[len-1] = first;
}
// Replace unprintable characters with a dot in char buffer
void clean_ascii(unsigned char *buf, size_t len) {
for (size_t i = 0; i < len; i++) {
if (!isprint(buf[i]))
buf[i] = '.';
}
}