source: MondoRescue/branches/3.2/mondo/test/test-mr_stresc.c

Last change on this file was 3374, checked in by Bruno Cornec, 9 years ago
  • Fix compilation warnings and errors
  • Property svn:eol-style set to native
File size: 1.2 KB
RevLine 
[3111]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>
[3116]8#include <stdlib.h>
[3111]9#include "mr_str.h"
[3171]10#include "mr_mem.h"
[3141]11#include "my-stuff.h"
[3111]12
[3141]13/* Whether we should fail immediately at first error */
14bool g_fail_immediately = FALSE;
15
[3374]16/* Reference to global bkpinfo */
17struct s_bkpinfo *bkpinfo;
18
[3116]19void (*mr_cleanup)(void) = NULL;
20
[3141]21char *strl[] = {
[3111]22 "test with space",
[3170]23 "test with \\ backslash",
[3111]24 "test with \" doublequote",
25 "test with ' simplequote",
26 "test with ~ tilde",
27 "test with ? questionmark",
28 "test with ! exclammark",
29 "test with & ampersand",
30 "test with * star",
31 "test with | pipe",
[3170]32 "test with \\' backslash quote",
33 "test with nothing SPECIAL 1234",
34 "test with rtmp:_ retrieval with rtmpdump and tcpdump « Pxnh's Blog_files",
35 NULL
[3111]36};
37
[3116]38int main() {
[3111]39
40 char *p;
41 int i;
42
[3294]43 for (i = 0; strl[i] != NULL ; i++) {
[3170]44 printf("Test %2d Original chain is %s\n",i,strl[i]);
[3171]45 p = mr_stresc(strl[i], "`$\\\"(){}'[]&*?|!#~", '\\', '"');
46 printf("Test %2d Transformed chain (with \") is %s\n",i,p);
47 mr_free(p);
48 p = mr_stresc(strl[i], "`$\\\"(){}'[]&*?|!#~", '\\', '\'');
49 printf("Test %2d Transformed chain (with ') is %s\n",i,p);
50 mr_free(p);
[3111]51 }
52exit(0);
53}
Note: See TracBrowser for help on using the repository browser.