drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
test_fn.cc
1/* Copyright (C) 2000 MySQL AB
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
6
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
15
16#include "mysys/mysys_priv.h"
17
18const char *test_names[]=
19{
20 "/usr/my/include/srclib/myfunc/dbug/test",
21 "test",
22 "dbug/test",
23 "/usr/my/srclib/myfunc/dbug/test",
24 "/usr/monty/oldcopy/jazz/setupp.frm",
25 "~/monty.tst",
26 "~/dbug/monty.tst",
27 "./hejsan",
28 "./dbug/test",
29 "../dbug/test",
30 "../myfunc/test",
31 "../../monty/rutedit",
32 "/usr/monty//usr/monty/rutedit",
33 "/usr/./monty/rutedit",
34 "/usr/my/../monty/rutedit",
35 "/usr/my/~/rutedit",
36 "~/../my",
37 "~/../my/srclib/myfunc/test",
38 "~/../my/srclib/myfunc/./dbug/test",
39 "/../usr/my/srclib/dbug",
40 "c/../my",
41 "/c/../my",
42 NULL,
43};
44
45int main(int , char **argv)
46{
47 const char **pos;
48 char buff[FN_REFLEN],buff2[FN_REFLEN];
49 MY_INIT(argv[0]);
50
51 for (pos=test_names; *pos ; pos++)
52 {
53 printf("org : '%s'\n",*pos);
54 printf("pack: '%s'\n",fn_format(buff,*pos,"","",8));
55 printf("unpack: '%s'\n",fn_format(buff2,*pos,"","",4));
56 unpack_filename(buff,buff);
57 if (strcmp(buff,buff2) != 0)
58 {
59 printf("error on cmp: '%s' != '%s'\n",buff,buff2);
60 }
61 puts("");
62 }
63 return(0);
64}