File:
[DVB] /
dietlibc /
libugly /
getmntent.c
Revision
1.4:
download - view:
text,
annotated -
select for diffs
Thu May 9 01:09:49 2002 UTC (22 years, 1 month ago) by
fefe
Branches:
MAIN
CVS tags:
finnland_test_200301,
branch_rc14_fieldtest_finnland,
branch_rc13_fieldtest_finnland,
branch_rc12_fieldtest_finnland,
branch_rc10_fieldtest_finnland,
RELEASE_finnland_200301_1,
RC12_FIELDTEST_FINNLAND,
RC10_FIELDTEST_FINNLAND,
HEAD
allow more \t in getmntent
#include <stdio.h>
#include <stdlib.h>
#include <mntent.h>
#include <string.h>
struct mntent *getmntent(FILE *filep) {
static struct mntent m;
static char buf[1024];
do {
char *tmp=buf;
int num;
if (!fgets(buf,1024,filep)) return 0;
/* "/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!=' ' && *tmp!='\t') continue; break;
case 5: m.mnt_passno=strtol(tmp,&tmp,0); if (*tmp=='\n') return &m; break;
}
while (*tmp && *tmp!=' ' && *tmp!='\n' && *tmp!='\t') ++tmp;
if (*tmp) {
if (num<4) *tmp++=0;
while (*tmp==' ' || *tmp=='\t') ++tmp;
} else
continue;
}
} while (1);
}
LinuxTV legacy CVS <linuxtv.org/cvs>