mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
Merge branch 'master' into experimental_varlen
* master: ltrim cmd before display hf mf eload: fix absence of filename detect wrong numOfBlocks / numOfSectors arguments safeFile*: accept when suffix is already provided loadFile*: accept when suffix is already provided textual, to reflect which repo. LoadEML: don't complain on the last \n
This commit is contained in:
commit
f1deb865db
16 changed files with 170 additions and 121 deletions
|
@ -822,10 +822,23 @@ void str_lower(char *s) {
|
|||
for (size_t i = 0; i < strlen(s); i++)
|
||||
s[i] = tolower(s[i]);
|
||||
}
|
||||
|
||||
// check for prefix in string
|
||||
bool str_startswith(const char *s, const char *pre) {
|
||||
return strncmp(pre, s, strlen(pre)) == 0;
|
||||
}
|
||||
|
||||
// check for suffix in string
|
||||
bool str_endswith(const char *s, const char *suffix) {
|
||||
size_t ls = strlen(s);
|
||||
size_t lsuffix = strlen(suffix);
|
||||
if (ls >= lsuffix)
|
||||
{
|
||||
return strncmp(suffix, s + (ls - lsuffix), lsuffix) == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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++) {
|
||||
|
@ -848,7 +861,7 @@ void strcreplace(char *buf, size_t len, char from, char to) {
|
|||
}
|
||||
}
|
||||
|
||||
char *strmcopy(char *buf) {
|
||||
char *strmcopy(const char *buf) {
|
||||
char *str = (char *) calloc(strlen(buf) + 1, sizeof(uint8_t));
|
||||
if (str != NULL) {
|
||||
memset(str, 0, strlen(buf) + 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue