Last change
on this file since 3846 was 3298, checked in by Bruno Cornec, 10 years ago |
- Adds the C file for test of mr_str_substitute
|
-
Property svn:eol-style
set to
native
|
File size:
854 bytes
|
Line | |
---|
1 | /*
|
---|
2 | * $Id$
|
---|
3 | *
|
---|
4 | * Test program for mr_str_substitute
|
---|
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 "mr_mem.h"
|
---|
11 | #include "my-stuff.h"
|
---|
12 |
|
---|
13 | /* Whether we should fail immediately at first error */
|
---|
14 | bool g_fail_immediately = FALSE;
|
---|
15 |
|
---|
16 | void (*mr_cleanup)(void) = NULL;
|
---|
17 |
|
---|
18 | char *strl[] = {
|
---|
19 | "test with _ERR_",
|
---|
20 | "test with CDROM",
|
---|
21 | NULL
|
---|
22 | };
|
---|
23 |
|
---|
24 | char *strlorg[] = {
|
---|
25 | "_ERR_",
|
---|
26 | "CDROM",
|
---|
27 | NULL
|
---|
28 | };
|
---|
29 |
|
---|
30 | char *strlsub[] = {
|
---|
31 | "ERROR FOUND !",
|
---|
32 | "which cdrom device do you want to use",
|
---|
33 | NULL
|
---|
34 | };
|
---|
35 |
|
---|
36 | int main() {
|
---|
37 |
|
---|
38 | char *p;
|
---|
39 | int i;
|
---|
40 |
|
---|
41 | for (i = 0; strl[i] != NULL ; i++) {
|
---|
42 | printf("Test %2d Original chain is %s\n",i,strl[i]);
|
---|
43 | p = mr_str_substitute(strl[i], strlorg[i], strlsub[i]);
|
---|
44 | printf("Test %2d Transformed chain (with \") is %s\n",i,p);
|
---|
45 | mr_free(p);
|
---|
46 | }
|
---|
47 | exit(0);
|
---|
48 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.