mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -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;
|
||||
case PS_QUOTE:
|
||||
if (str[i] == '"') {
|
||||
// Now let's compact the argument by removing spaces
|
||||
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;
|
||||
*bufptr++ = 0x00;
|
||||
state = PS_FIRST;
|
||||
} else {
|
||||
if (isSpace(str[i]) && spaceptr == NULL) {
|
||||
// Store first encountered space for later
|
||||
spaceptr = bufptr;
|
||||
if (isSpace(str[i]) == false) {
|
||||
*bufptr++ = str[i];
|
||||
}
|
||||
*bufptr = str[i];
|
||||
}
|
||||
bufptr++;
|
||||
break;
|
||||
}
|
||||
if (bufptr > bufptrend) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue