* reordered a little bit
[mascara-docs.git] / i86 / elks / elkscmd / sys_utils / mount.c
blob102337d1e7e249862c6f0de07b8fb13e9642bcc2
1 /*
2 * Copyright (c) 1993 by David I. Bell
3 * Permission is granted to use, distribute, or modify this source,
4 * provided that this copyright notice remains intact.
6 * Most simple built-in commands are here.
7 */
9 #include <sys/types.h>
10 #include <sys/stat.h>
11 #include <unistd.h>
12 #include <fcntl.h>
13 #include <signal.h>
14 #include <pwd.h>
15 #include <grp.h>
16 #include <utime.h>
17 #include <errno.h>
19 void
20 main(argc, argv)
21 char **argv;
23 char *str;
24 char *type;
26 argc--;
27 argv++;
28 type = "minix";
30 while ((argc > 0) && (**argv == '-')) {
31 argc--;
32 str = *argv++ ;
34 while (*++str) switch (*str) {
35 case 't':
36 if ((argc <= 0) || (**argv == '-')) {
37 write(STDERR_FILENO, "Missing file system type\n", 25);
38 exit(1);
41 type = *argv++;
42 argc--;
43 break;
45 default:
46 write(STDERR_FILENO, "Unknown option\n", 15);
47 exit(1);
51 if (argc != 2) {
52 write(STDERR_FILENO, "Wrong number of arguments for mount\n", 36);
53 exit(1);
56 if (mount(argv[0], argv[1], type, 0) < 0) {
57 perror("mount failed");
58 exit(1);
60 exit(0);