Fixed removing escape symbols for command line arguments

This commit is contained in:
AlexeyAB
2018-06-21 02:42:39 +03:00
parent 76e258520e
commit 4a2a2250f9
3 changed files with 16 additions and 1 deletions

View File

@ -296,6 +296,20 @@ void strip(char *s)
s[len-offset] = '\0';
}
void strip_args(char *s)
{
size_t i;
size_t len = strlen(s);
size_t offset = 0;
for (i = 0; i < len; ++i) {
char c = s[i];
if (c == '\t' || c == '\n' || c == '\r' || c == 0x0d || c == 0x0a) ++offset;
else s[i - offset] = c;
}
s[len - offset] = '\0';
}
void strip_char(char *s, char bad)
{
size_t i;