aboutsummaryrefslogtreecommitdiff
path: root/misc/tst-mntent.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc/tst-mntent.c')
-rw-r--r--misc/tst-mntent.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/misc/tst-mntent.c b/misc/tst-mntent.c
index cd67c98..d6f3743 100644
--- a/misc/tst-mntent.c
+++ b/misc/tst-mntent.c
@@ -1,24 +1,30 @@
/* Test case by Horst von Brand <vonbrand@sleipnir.valparaiso.cl>. */
-#include <stdio.h>
-#include <mntent.h>
-
+#include <mntent.h>
+#include <stdio.h>
+#include <string.h>
+
+
int
-main (int argc, char *argv[])
-{
+main (int argc, char *argv[])
+{
int result = 0;
- struct mntent mef =
- {
- "/dev/hda1", "/", "ext2", "defaults", 1, 1
- };
- struct mntent *mnt = &mef;
-
- if (hasmntopt (mnt, "defaults"))
- printf("Found!\n");
- else
+ struct mntent mef;
+ struct mntent *mnt = &mef;
+
+ mef.mnt_fsname = strdupa ("/dev/hda1");
+ mef.mnt_dir = strdupa ("/");
+ mef.mnt_type = strdupa ("ext2");
+ mef.mnt_opts = strdupa ("defaults");
+ mef.mnt_freq = 1;
+ mef.mnt_passno = 1;
+
+ if (hasmntopt (mnt, "defaults"))
+ printf ("Found!\n");
+ else
{
- printf("Didn't find it\n");
+ printf ("Didn't find it\n");
result = 1;
}
-
- return result;
-}
+
+ return result;
+}