shell-scape: Échappe des caractères spéciaux

This commit is contained in:
2022-12-01 08:10:56 +01:00
parent 27eafc7b9c
commit d1d8771348
7 changed files with 102 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
#include "escape.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
int main(void) {
assert(strcmp("aa", shellEscape("aa")) == 0);
assert(strcmp("'aa bb'", shellEscape("aa bb")) == 0);
assert(strcmp("'a(b)'", shellEscape("a(b)")) == 0);
assert(strcmp("'aa && bb'", shellEscape("aa && bb")) == 0);
assert(strcmp("'echo aa '\"'\"'s'\"'\"''", shellEscape("echo aa 's'")) == 0);
return 0;
}