mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
Fixed removing escape symbols for command line arguments
This commit is contained in:
@ -357,7 +357,7 @@ int main(int argc, char **argv)
|
||||
int i;
|
||||
for (i = 0; i < argc; ++i) {
|
||||
if (!argv[i]) continue;
|
||||
strip(argv[i]);
|
||||
strip_args(argv[i]);
|
||||
}
|
||||
|
||||
//test_resize("data/bad.jpg");
|
||||
|
14
src/utils.c
14
src/utils.c
@ -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;
|
||||
|
@ -45,6 +45,7 @@ void error(const char *s);
|
||||
void malloc_error();
|
||||
void file_error(char *s);
|
||||
void strip(char *s);
|
||||
void strip_args(char *s);
|
||||
void strip_char(char *s, char bad);
|
||||
void top_k(float *a, int n, int k, int *index);
|
||||
list *split_str(char *s, char delim);
|
||||
|
Reference in New Issue
Block a user