4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 #pragma ident "%Z%%M% %I% %E% SMI"
34 #include <sys/types.h>
43 #define ALLRW (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
49 errmsg(int severity
, int code
, char *format
, ...);
51 /* from chmod:common.c: */
54 newmode(char *modestr
, mode_t basemode
, mode_t umask
, char *file
, char *path
);
57 main(int argc
, char *argv
[])
64 mode_t umsk
= umask(0);
65 mode_t mode
= ALLRW
& (~umsk
);
67 (void) setlocale(LC_ALL
, "");
68 #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
69 #define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */
71 (void) textdomain(TEXT_DOMAIN
);
78 while ((c
= getopt(argc
, argv
, "m:")) != EOF
) {
82 mode
= newmode(optarg
, ALLRW
, umsk
, "", "");
91 if (argc
< optind
|| errflg
) {
96 for (i
= optind
; i
< argc
; i
++) {
98 if (mkfifo(path
, mode
) < 0) {
111 (void) fprintf(stderr
,
112 gettext("usage: mkfifo [-m mode] file ...\n"));
116 * errmsg - This is an interface required by the code common to mkfifo and
117 * chmod. The severity parameter is ignored here, but is meaningful
124 errmsg(int severity
, int code
, char *format
, ...)
128 va_start(ap
, format
);
130 (void) fprintf(stderr
, "mkfifo: ");
131 (void) vfprintf(stderr
, format
, ap
);