s4:rootdse LDB module - remove unused variable
[Samba/gebeck_regimport.git] / source3 / torture / t_push_ucs2.c
blob2bd91dafdee983629f503c6af700dad6ddb61ffe
1 /*
2 * Copyright (C) 2003 by Martin Pool
3 * Copyright (C) 2003 by Andrew Bartlett
5 * Test harness for push_ucs2
6 */
8 #include "includes.h"
10 static int check_push_ucs2(const char *orig)
12 smb_ucs2_t *dest = NULL;
13 char *orig2 = NULL;
14 int ret;
15 size_t converted_size;
17 push_ucs2_talloc(NULL, &dest, orig, &converted_size);
18 pull_ucs2_talloc(NULL, &orig2, dest, &converted_size);
19 ret = strcmp(orig, orig2);
20 if (ret) {
21 fprintf(stderr, "orig: %s\n", orig);
22 fprintf(stderr, "orig (UNIX -> UCS2 -> UNIX): %s\n", orig2);
25 TALLOC_FREE(dest);
26 TALLOC_FREE(orig2);
28 return ret;
31 int main(int argc, char *argv[])
33 int i, ret = 0;
34 int count = 1;
36 /* Needed to initialize character set */
37 lp_load("/dev/null", True, False, False, True);
39 if (argc < 2) {
40 fprintf(stderr, "usage: %s STRING1 [COUNT]\n"
41 "Checks that a string translated UNIX->UCS2->UNIX is unchanged\n"
42 "Should be always 0\n",
43 argv[0]);
44 return 2;
46 if (argc >= 3)
47 count = atoi(argv[2]);
49 for (i = 0; ((i < count) && (!ret)); i++)
50 ret = check_push_ucs2(argv[1]);
52 printf("%d\n", ret);
54 return 0;