Mark some targets phony
[Samba.git] / source / torture / t_push_ucs2.c
blob8d327acfa563b7a1978dad0260885a35be3067f3
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;
16 push_ucs2_allocate(&dest, orig);
17 pull_ucs2_allocate(&orig2, dest);
18 ret = strcmp(orig, orig2);
19 if (ret) {
20 fprintf(stderr, "orig: %s\n", orig);
21 fprintf(stderr, "orig (UNIX -> UCS2 -> UNIX): %s\n", orig2);
24 SAFE_FREE(dest);
25 SAFE_FREE(orig2);
27 return ret;
30 int main(int argc, char *argv[])
32 int i, ret = 0;
33 int count = 1;
35 /* Needed to initialize character set */
36 lp_load("/dev/null", True, False, False, True);
38 if (argc < 2) {
39 fprintf(stderr, "usage: %s STRING1 [COUNT]\n"
40 "Checks that a string translated UNIX->UCS2->UNIX is unchanged\n"
41 "Should be always 0\n",
42 argv[0]);
43 return 2;
45 if (argc >= 3)
46 count = atoi(argv[2]);
48 for (i = 0; ((i < count) && (!ret)); i++)
49 ret = check_push_ucs2(argv[1]);
51 printf("%d\n", ret);
53 return 0;