11 struct mntent
*mnt
= &mef
;
14 mef
.mnt_fsname
= strdupa ("/dev/hda1");
15 mef
.mnt_dir
= strdupa ("/some dir");
16 mef
.mnt_type
= strdupa ("ext2");
17 mef
.mnt_opts
= strdupa ("defaults");
21 if (hasmntopt (mnt
, "defaults"))
25 printf ("Didn't find it\n");
32 printf ("Cannot open temporary file: %m\n");
39 /* Write the name entry. */
42 /* Prepare for reading. */
45 /* First, read it raw. */
46 if (fgets (buf
, sizeof (buf
), fp
) == NULL
)
48 printf ("Cannot read temporary file: %m");
52 if (strcmp (buf
, "/dev/hda1 /some\\040dir ext2 defaults 1 2\n") != 0)
54 puts ("Raw file data not correct");
58 /* Prepare for reading, part II. */
61 /* Now read it cooked. */
64 if (strcmp (mnt
->mnt_fsname
, "/dev/hda1") != 0
65 || strcmp (mnt
->mnt_dir
, "/some dir") != 0
66 || strcmp (mnt
->mnt_type
, "ext2") != 0
67 || strcmp (mnt
->mnt_opts
, "defaults") != 0
69 || mnt
->mnt_passno
!= 2)
71 puts ("Error while reading written entry back in");
79 #define TEST_FUNCTION do_test ()
80 #include "../test-skeleton.c"