mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-03 21:30:14 -05:00
Remove unnecessary prefix char in escaping
We can encode it at higher level.
This commit is contained in:
parent
256db0e595
commit
dd87022490
5 changed files with 14 additions and 22 deletions
|
|
@ -101,17 +101,17 @@ void test(int argc, char* argv[])
|
|||
for (i = 2; i < argc; ++i) {
|
||||
printf("argv[%d]\n", i);
|
||||
printf("\t#%s#\n", argv[i]);
|
||||
printf("\t#%s#\n", esc_shell(0, argv[i], buffer));
|
||||
printf("\t#%s#\n", esc_shell(argv[i], buffer));
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
assert(strcmp(esc_shell(0, " ", buffer), "\" \"") == 0);
|
||||
assert(strcmp(esc_shell(0, " \" ", buffer), "\" \"\\\"\" \"") == 0);
|
||||
assert(strcmp(esc_shell(0, "&|()<>^", buffer), "^&^|^(^)^<^>^^") == 0);
|
||||
assert(strcmp(esc_shell(0, "&|()<>^ ", buffer), "\"&|()<>^ \"") == 0);
|
||||
assert(strcmp(esc_shell(" ", buffer), "\" \"") == 0);
|
||||
assert(strcmp(esc_shell(" \" ", buffer), "\" \"\\\"\" \"") == 0);
|
||||
assert(strcmp(esc_shell("&|()<>^", buffer), "^&^|^(^)^<^>^^") == 0);
|
||||
assert(strcmp(esc_shell("&|()<>^ ", buffer), "\"&|()<>^ \"") == 0);
|
||||
#else
|
||||
assert(strcmp(esc_shell(0, ",._+:@%%/-", buffer), ",._+:@%%/-") == 0);
|
||||
assert(strcmp(esc_shell(0, " ", buffer), "\\ ") == 0);
|
||||
assert(strcmp(esc_shell(",._+:@%%/-", buffer), ",._+:@%%/-") == 0);
|
||||
assert(strcmp(esc_shell(" ", buffer), "\\ ") == 0);
|
||||
#endif
|
||||
|
||||
printf("Everything OK\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue