Last change
on this file since 3745 was 3147, checked in by Bruno Cornec, 11 years ago |
- First pass on svn merge -r 2935:3146 ../3.0
|
-
Property svn:eol-style
set to
native
|
File size:
878 bytes
|
Line | |
---|
1 | /*
|
---|
2 | * $Id$
|
---|
3 | *
|
---|
4 | * Test program for mr_stresc
|
---|
5 | * Can be used on host system with valgrind easier than with mondorestore
|
---|
6 | */
|
---|
7 | #include <stdio.h>
|
---|
8 | #include <stdlib.h>
|
---|
9 | #include "mr_str.h"
|
---|
10 | #include "my-stuff.h"
|
---|
11 |
|
---|
12 | /* Whether we should fail immediately at first error */
|
---|
13 | bool g_fail_immediately = FALSE;
|
---|
14 |
|
---|
15 | void (*mr_cleanup)(void) = NULL;
|
---|
16 |
|
---|
17 | char *strl[] = {
|
---|
18 | "test with space",
|
---|
19 | "test with \ backslash",
|
---|
20 | "test with \" doublequote",
|
---|
21 | "test with ' simplequote",
|
---|
22 | "test with ~ tilde",
|
---|
23 | "test with ? questionmark",
|
---|
24 | "test with ! exclammark",
|
---|
25 | "test with & ampersand",
|
---|
26 | "test with * star",
|
---|
27 | "test with | pipe",
|
---|
28 | };
|
---|
29 | // Number of strings
|
---|
30 | const int MAX = 10;
|
---|
31 |
|
---|
32 | int main() {
|
---|
33 |
|
---|
34 | char *p;
|
---|
35 | int i;
|
---|
36 |
|
---|
37 | for (i = 1; i <= MAX ; i++) {
|
---|
38 | p = mr_stresc(strl[i], "`$\\\"(){}'[]&*?|!#~", '\\');
|
---|
39 | printf("Original chain is %s\n",strl[i]);
|
---|
40 | printf("Transformed chain is %s\n",p);
|
---|
41 | }
|
---|
42 | exit(0);
|
---|
43 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.