summary refs log tree commit diff
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/mntent.h8
-rw-r--r--misc/tst-mntent.c42
2 files changed, 28 insertions, 22 deletions
diff --git a/misc/mntent.h b/misc/mntent.h
index 1d079a3e52..ca45710f8e 100644
--- a/misc/mntent.h
+++ b/misc/mntent.h
@@ -53,10 +53,10 @@ __BEGIN_DECLS
 /* Structure describing a mount table entry.  */
 struct mntent
   {
-    const char *mnt_fsname;	/* Device or server for filesystem.  */
-    const char *mnt_dir;	/* Directory mounted on.  */
-    const char *mnt_type;	/* Type of filesystem: ufs, nfs, etc.  */
-    const char *mnt_opts;	/* Comma-separated options for fs.  */
+    char *mnt_fsname;		/* Device or server for filesystem.  */
+    char *mnt_dir;		/* Directory mounted on.  */
+    char *mnt_type;		/* Type of filesystem: ufs, nfs, etc.  */
+    char *mnt_opts;		/* Comma-separated options for fs.  */
     int mnt_freq;		/* Dump frequency (in days).  */
     int mnt_passno;		/* Pass number for `fsck'.  */
   };
diff --git a/misc/tst-mntent.c b/misc/tst-mntent.c
index cd67c98fe6..d6f374385f 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;
+}