mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
Simplify quote handling
This commit is contained in:
parent
238faaf226
commit
dbe0412311
1 changed files with 3 additions and 22 deletions
|
@ -222,32 +222,13 @@ int CLIParserParseStringEx(CLIParserContext *ctx, const char *str, void *vargtab
|
||||||
break;
|
break;
|
||||||
case PS_QUOTE:
|
case PS_QUOTE:
|
||||||
if (str[i] == '"') {
|
if (str[i] == '"') {
|
||||||
// Now let's compact the argument by removing spaces
|
*bufptr++ = 0x00;
|
||||||
if (spaceptr != NULL) {
|
|
||||||
// We've seen at least 1 space
|
|
||||||
char *cur_ptr = spaceptr;
|
|
||||||
while (spaceptr < bufptr) {
|
|
||||||
if (isSpace(*spaceptr) == false) {
|
|
||||||
*cur_ptr = *spaceptr;
|
|
||||||
cur_ptr++;
|
|
||||||
}
|
|
||||||
spaceptr++;
|
|
||||||
}
|
|
||||||
*cur_ptr = 0;
|
|
||||||
// Rollback bufptr
|
|
||||||
bufptr = cur_ptr;
|
|
||||||
spaceptr = NULL;
|
|
||||||
}
|
|
||||||
*bufptr = 0x00;
|
|
||||||
state = PS_FIRST;
|
state = PS_FIRST;
|
||||||
} else {
|
} else {
|
||||||
if (isSpace(str[i]) && spaceptr == NULL) {
|
if (isSpace(str[i]) == false) {
|
||||||
// Store first encountered space for later
|
*bufptr++ = str[i];
|
||||||
spaceptr = bufptr;
|
|
||||||
}
|
}
|
||||||
*bufptr = str[i];
|
|
||||||
}
|
}
|
||||||
bufptr++;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (bufptr > bufptrend) {
|
if (bufptr > bufptrend) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue