4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
33 #include <sys/fstyp.h>
35 #include <sys/mntent.h>
36 #include <sys/mnttab.h>
37 #include <sys/mount.h>
38 #include <sys/signal.h>
47 static void usage(void);
49 static char optbuf
[MAX_MNTOPT_STR
] = { '\0', };
50 static int optsize
= 0;
52 static char fstype
[] = "objfs";
55 * usage: mount [-Ormq] [-o options] special mountp
57 * This mount program is exec'ed by /usr/sbin/mount if '-F objfs' is
61 main(int argc
, char *argv
[])
64 char *special
; /* Entity being mounted */
65 char *mountp
; /* Entity being mounted on */
75 (void) setlocale(LC_ALL
, "");
77 #if !defined(TEXT_DOMAIN)
78 #define TEXT_DOMAIN "SYS_TEST"
80 (void) textdomain(TEXT_DOMAIN
);
83 myname
= strrchr(argv
[0], '/');
84 myname
= myname
? myname
+ 1 : argv
[0];
86 len
= strlen(fstype
) + 1 + strlen(myname
);
87 typename
= malloc(len
+ 1);
89 (void) fprintf(stderr
, gettext("%s: out of memory\n"),
94 (void) snprintf(typename
, len
, "%s %s", fstype
, myname
);
97 while ((c
= getopt(argc
, argv
, "o:rmOq")) != EOF
) {
104 if (strlcpy(optbuf
, optarg
, sizeof (optbuf
)) >=
106 (void) fprintf(stderr
,
107 gettext("%s: Invalid argument: %s\n"),
112 optsize
= strlen(optbuf
);
122 flags
|= MS_NOMNTTAB
;
133 if ((argc
- optind
!= 2) || error_flag
) {
136 special
= argv
[argc
- 2];
137 mountp
= argv
[argc
- 1];
139 if ((savedoptbuf
= strdup(optbuf
)) == NULL
) {
140 (void) fprintf(stderr
, gettext("%s: out of memory\n"),
145 if (mount(special
, mountp
, flags
| MS_OPTIONSTR
, fstype
, NULL
, 0,
146 optbuf
, MAX_MNTOPT_STR
)) {
147 (void) fprintf(stderr
, "mount: ");
152 if (optsize
&& !q_flag
)
153 cmp_requested_to_actual_options(savedoptbuf
, optbuf
,
162 (void) fprintf(stderr
,
163 gettext("Usage: mount [-Ormq] [-o options] special mountpoint\n"));