Magellan Linux

Contents of /trunk/mkinitrd-magellan/klibc/usr/utils/umount.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (show annotations) (download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File MIME type: text/plain
File size: 713 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd

1 /*
2 * by rmk
3 */
4 #include <sys/mount.h>
5 #include <errno.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <unistd.h>
10
11 char *progname;
12
13 int main(int argc, char *argv[])
14 {
15 int c, flag = 0;
16
17 progname = argv[0];
18
19 do {
20 c = getopt(argc, argv, "fl");
21 if (c == EOF)
22 break;
23 switch (c) {
24 case 'f':
25 flag |= MNT_FORCE;
26 break;
27 case 'l':
28 flag |= MNT_DETACH;
29 break;
30 case '?':
31 fprintf(stderr, "%s: invalid option -%c\n",
32 progname, optopt);
33 exit(1);
34 }
35 } while (1);
36
37 if (optind + 1 != argc) {
38 fprintf(stderr, "Usage: %s [-f] [-l] mntpoint\n", progname);
39 return 1;
40 }
41
42 if (umount2(argv[optind], flag) == -1) {
43 perror("umount2");
44 return 255;
45 }
46
47 return 0;
48 }