Annotation of /trunk/mkinitrd-magellan/klibc/usr/utils/umount.c
Parent Directory | Revision Log
Revision 1297 -
(hide annotations)
(download)
Fri May 27 15:12:11 2011 UTC (13 years ago) by niro
File MIME type: text/plain
File size: 780 byte(s)
Fri May 27 15:12:11 2011 UTC (13 years ago) by niro
File MIME type: text/plain
File size: 780 byte(s)
-updated to klibc-1.5.22 with mntproc definitions patch included
1 | niro | 532 | /* |
2 | * by rmk | ||
3 | */ | ||
4 | #include <sys/mount.h> | ||
5 | #include <stdio.h> | ||
6 | #include <stdlib.h> | ||
7 | #include <string.h> | ||
8 | #include <unistd.h> | ||
9 | |||
10 | char *progname; | ||
11 | |||
12 | int main(int argc, char *argv[]) | ||
13 | { | ||
14 | int c, flag = 0; | ||
15 | |||
16 | progname = argv[0]; | ||
17 | |||
18 | do { | ||
19 | niro | 815 | c = getopt(argc, argv, "fli"); |
20 | niro | 532 | if (c == EOF) |
21 | break; | ||
22 | switch (c) { | ||
23 | case 'f': | ||
24 | flag |= MNT_FORCE; | ||
25 | break; | ||
26 | case 'l': | ||
27 | flag |= MNT_DETACH; | ||
28 | break; | ||
29 | niro | 815 | case 'i': |
30 | /* ignore for now; no support for umount helpers */ | ||
31 | break; | ||
32 | niro | 532 | case '?': |
33 | fprintf(stderr, "%s: invalid option -%c\n", | ||
34 | progname, optopt); | ||
35 | exit(1); | ||
36 | } | ||
37 | } while (1); | ||
38 | |||
39 | if (optind + 1 != argc) { | ||
40 | niro | 815 | fprintf(stderr, "Usage: %s [-f] [-l] [-i] mntpoint\n", |
41 | progname); | ||
42 | niro | 532 | return 1; |
43 | } | ||
44 | |||
45 | if (umount2(argv[optind], flag) == -1) { | ||
46 | perror("umount2"); | ||
47 | return 255; | ||
48 | } | ||
49 | |||
50 | return 0; | ||
51 | } |