1 /* Test case by Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
2 and Ulrich Drepper <drepper@cygnus.com>. */
9 main (int argc, char *argv[])
13 struct mntent *mnt = &mef;
16 mef.mnt_fsname = strdupa ("/dev/hda1");
17 mef.mnt_dir = strdupa ("/some dir");
18 mef.mnt_type = strdupa ("ext2");
19 mef.mnt_opts = strdupa ("defaults");
23 if (hasmntopt (mnt, "defaults"))
27 printf ("Didn't find it\n");
34 printf ("Cannot open temporary file: %m\n");
41 /* Write the name entry. */
44 /* Prepare for reading. */
47 /* First, read it raw. */
48 if (fgets (buf, sizeof (buf), fp) == NULL)
50 printf ("Cannot read temporary file: %m");
54 if (strcmp (buf, "/dev/hda1 /some\\040dir ext2 defaults 1 2\n") != 0)
56 puts ("Raw file data not correct");
60 /* Prepare for reading, part II. */
63 /* Now read it cooked. */
66 if (strcmp (mnt->mnt_fsname, "/dev/hda1") != 0
67 || strcmp (mnt->mnt_dir, "/some dir") != 0
68 || strcmp (mnt->mnt_type, "ext2") != 0
69 || strcmp (mnt->mnt_opts, "defaults") != 0
71 || mnt->mnt_passno != 2)
73 puts ("Error while reading written entry back in");