summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/libugly/getmntent.c
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-05-14 13:47:49 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-05-14 13:47:49 +0000
commitf15aa3a552022743398a652165d76bf912c715e5 (patch)
treeb58f8b4c47fc571fbb498d83a4bd4fca226ac6c4 /mdk-stage1/dietlibc/libugly/getmntent.c
parent189b01c358a1181ddc951adba97a0258d5fc2cf1 (diff)
downloaddrakx-backup-do-not-use-f15aa3a552022743398a652165d76bf912c715e5.tar
drakx-backup-do-not-use-f15aa3a552022743398a652165d76bf912c715e5.tar.gz
drakx-backup-do-not-use-f15aa3a552022743398a652165d76bf912c715e5.tar.bz2
drakx-backup-do-not-use-f15aa3a552022743398a652165d76bf912c715e5.tar.xz
drakx-backup-do-not-use-f15aa3a552022743398a652165d76bf912c715e5.zip
Initial revision
Diffstat (limited to 'mdk-stage1/dietlibc/libugly/getmntent.c')
-rw-r--r--mdk-stage1/dietlibc/libugly/getmntent.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/mdk-stage1/dietlibc/libugly/getmntent.c b/mdk-stage1/dietlibc/libugly/getmntent.c
new file mode 100644
index 000000000..250a77b7f
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/getmntent.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <mntent.h>
+#include <string.h>
+
+struct mntent *getmntent(FILE *filep) {
+ static struct mntent m;
+ char buf[1024];
+ do {
+ char *tmp=buf;
+ int num;
+ fgets(buf,1024,filep);
+/* "/dev/ide/host0/bus0/target0/lun0/part2 / reiserfs defaults 1 1" */
+ for (num=0; num<6; ++num) {
+ switch (num) {
+ case 0: m.mnt_fsname=tmp; break;
+ case 1: m.mnt_dir=tmp; break;
+ case 2: m.mnt_type=tmp; break;
+ case 3: m.mnt_opts=tmp; break;
+ case 4: m.mnt_freq=strtol(tmp,&tmp,0); if (*tmp!=' ') continue; break;
+ case 5: m.mnt_passno=strtol(tmp,&tmp,0); if (*tmp=='\n') return &m; break;
+ }
+ if ((tmp=strchr(tmp,' '))) {
+ if (num<4) *tmp++=0;
+ while (*tmp==' ') ++tmp;
+ } else
+ continue;
+ }
+ } while (1);
+}