Fix memory handling in strxfrm_l [BZ #16009]
[glibc.git] / misc / tst-mntent2.c
blobba1ee0ae19a42313f87f5d380edebc0f3de14fdc
1 #include <mntent.h>
2 #include <stdio.h>
3 #include <string.h>
6 static int
7 do_test (void)
9 int result = 0;
10 struct mntent mef;
12 mef.mnt_fsname = strdupa ("/dev/sdf6");
13 mef.mnt_dir = strdupa ("/some dir");
14 mef.mnt_type = strdupa ("ext3");
15 mef.mnt_opts = strdupa ("opt1,opt2,noopt=6,rw,norw,brw");
16 mef.mnt_freq = 1;
17 mef.mnt_passno = 2;
19 #define TEST(opt, found) \
20 if ((!!hasmntopt (&mef, (opt))) != (found)) \
21 { \
22 printf ("Option %s was %sfound\n", (opt), (found) ? "not " : ""); \
23 result = 1; \
26 TEST ("opt1", 1)
27 TEST ("opt2", 1)
28 TEST ("noopt", 1)
29 TEST ("rw", 1)
30 TEST ("norw", 1)
31 TEST ("brw", 1)
32 TEST ("opt", 0)
33 TEST ("oopt", 0)
34 TEST ("w", 0)
35 TEST ("r", 0)
36 TEST ("br", 0)
37 TEST ("nor", 0)
38 TEST ("or", 0)
40 return result;
43 #define TEST_FUNCTION do_test ()
44 #include "../test-skeleton.c"