Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 815 - (hide annotations) (download)
Fri Apr 24 18:32:46 2009 UTC (15 years, 1 month ago) by niro
File MIME type: text/plain
File size: 799 byte(s)
-updated to klibc-1.5.15
1 niro 532 /*
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 niro 815 c = getopt(argc, argv, "fli");
21 niro 532 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 niro 815 case 'i':
31     /* ignore for now; no support for umount helpers */
32     break;
33 niro 532 case '?':
34     fprintf(stderr, "%s: invalid option -%c\n",
35     progname, optopt);
36     exit(1);
37     }
38     } while (1);
39    
40     if (optind + 1 != argc) {
41 niro 815 fprintf(stderr, "Usage: %s [-f] [-l] [-i] mntpoint\n",
42     progname);
43 niro 532 return 1;
44     }
45    
46     if (umount2(argv[optind], flag) == -1) {
47     perror("umount2");
48     return 255;
49     }
50    
51     return 0;
52     }