git.samba.org
/
tridge
/
junkcode.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
fixes for Power64
[tridge/junkcode.git]
/
getmntent.c
1
#include <stdio.h>
2
#include <mntent.h>
3
#include <sys/types.h>
4
#include <sys/stat.h>
5
#include <unistd.h>
6
7
int main(void)
8
{
9
FILE *f = setmntent("/etc/mtab", "r");
10
struct mntent *m;
11
12
while ((m = getmntent(f))) {
13
struct stat st;
14
dev_t dev = 0;
15
if (stat(m->mnt_dir, &st) == 0) {
16
dev = st.st_dev;
17
}
18
printf("%s %s %s 0x%llx\n",
19
m->mnt_fsname, m->mnt_dir, m->mnt_type, (unsigned long long)dev);
20
}
21
22
endmntent(f);
23
return 0;
24
}
25