1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * <mkslocal.h>, Solaris2 Version - local <mks.h> requirements
24*7c478bd9Sstevel@tonic-gate  *
25*7c478bd9Sstevel@tonic-gate  * Copyright 1995-1996 (c) Sun Microsystems Inc.
26*7c478bd9Sstevel@tonic-gate  * All rights reserved.
27*7c478bd9Sstevel@tonic-gate  *
28*7c478bd9Sstevel@tonic-gate  */
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #define	_ALL_SOURCE
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #include <stdlib.h>
35*7c478bd9Sstevel@tonic-gate #include <limits.h>
36*7c478bd9Sstevel@tonic-gate #include <wchar.h>
37*7c478bd9Sstevel@tonic-gate #include <widec.h>
38*7c478bd9Sstevel@tonic-gate #include <wctype.h>
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate typedef	unsigned char	uchar;
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate #define	SYSV	1		/* System V compatible */
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate #ifndef VERSION
45*7c478bd9Sstevel@tonic-gate /* Used for in sh, vi ... */
46*7c478bd9Sstevel@tonic-gate #define	VERSION		"MKS InterOpen IXCU 4.3 MB - SUN/SOLARIS2"
47*7c478bd9Sstevel@tonic-gate #endif
48*7c478bd9Sstevel@tonic-gate 
49*7c478bd9Sstevel@tonic-gate /*
50*7c478bd9Sstevel@tonic-gate  * Assume that rootname() is called to prepend the proper path prefix
51*7c478bd9Sstevel@tonic-gate  */
52*7c478bd9Sstevel@tonic-gate #define	M_CS_PATH	"/usr/xpg4/bin"		/* posix.2 utilities */
53*7c478bd9Sstevel@tonic-gate #define	M_CS_SHELL	"/usr/xpg4/bin/sh"	/* posix.2 sh */
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate #define	M_CS_BINDIR	"/usr/bin"
56*7c478bd9Sstevel@tonic-gate #define	M_CS_ETCDIR	"/etc"
57*7c478bd9Sstevel@tonic-gate #define	M_CS_LIBDIR	"/usr/lib"
58*7c478bd9Sstevel@tonic-gate #define	M_CS_SPOOLDIR   "/var/spool"
59*7c478bd9Sstevel@tonic-gate #define	M_CS_MANPATH    "/usr/man"
60*7c478bd9Sstevel@tonic-gate #define	M_CS_TMPDIR	"/tmp"
61*7c478bd9Sstevel@tonic-gate #define	M_CS_NLSDIR	"/usr/lib/locale"
62*7c478bd9Sstevel@tonic-gate 
63*7c478bd9Sstevel@tonic-gate #define	M_BINDIR(path)		M_CS_BINDIR"/" #path
64*7c478bd9Sstevel@tonic-gate #define	M_ETCDIR(path)		M_CS_ETCDIR"/" #path
65*7c478bd9Sstevel@tonic-gate #define	M_LIBDIR(path)		M_CS_LIBDIR"/" #path
66*7c478bd9Sstevel@tonic-gate #define	M_SPOOLDIR(path)	M_CS_SPOOLDIR"/" #path
67*7c478bd9Sstevel@tonic-gate #define	M_NLSDIR(path)		M_CS_NLSDIR"/" #path
68*7c478bd9Sstevel@tonic-gate 
69*7c478bd9Sstevel@tonic-gate /*
70*7c478bd9Sstevel@tonic-gate  * M_MANPATH - list of pathnames to be used by man utility
71*7c478bd9Sstevel@tonic-gate  * M_TMPDIR - pathname of temporary
72*7c478bd9Sstevel@tonic-gate  */
73*7c478bd9Sstevel@tonic-gate #define	M_MANPATH		M_CS_MANPATH"/"
74*7c478bd9Sstevel@tonic-gate #define	M_TMPDIR		M_CS_TMPDIR"/"
75*7c478bd9Sstevel@tonic-gate #define	M_SYSTEM_TMPDIR		"/tmp"
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate #define	M_NL_DOM		"mks"
78*7c478bd9Sstevel@tonic-gate #define	DEF_NLSPATH		"/usr/lib/locale/%L/LC_MESSAGES"
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate #define	M_RCS_NORCSLIB		1	/* don't use rcslib or its includes */
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate #define	M_MALLOC	1
83*7c478bd9Sstevel@tonic-gate #define	M_REALLOC	1
84*7c478bd9Sstevel@tonic-gate #ifdef M_REALLOC
85*7c478bd9Sstevel@tonic-gate #define	M_WANT_ANSI_REALLOC	1
86*7c478bd9Sstevel@tonic-gate #endif
87*7c478bd9Sstevel@tonic-gate 
88*7c478bd9Sstevel@tonic-gate #define	__LDATA__	1	/* Deprecated */
89*7c478bd9Sstevel@tonic-gate #define	M_LDATA		1
90*7c478bd9Sstevel@tonic-gate 
91*7c478bd9Sstevel@tonic-gate #define	halloc(n, s)	malloc((size_t)((n)*(s)))
92*7c478bd9Sstevel@tonic-gate #define	hfree(ptr)	free(ptr)
93*7c478bd9Sstevel@tonic-gate #define	M_FSDELIM(c)	((c) == '/')
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate /* On POSIX and UNIX there is nothing special to do */
96*7c478bd9Sstevel@tonic-gate #define	m_cp(src, dest, ssb, flags)	(M_CP_NOOP)
97*7c478bd9Sstevel@tonic-gate 
98*7c478bd9Sstevel@tonic-gate #define	__POSIX_JOB_CONTROL		/* POSIX.1 job control */
99*7c478bd9Sstevel@tonic-gate #define	__POSIX_WAIT_NOHANG		/* waitpid WNOHANG available */
100*7c478bd9Sstevel@tonic-gate #define	__POSIX_SAVED_IDS	_POSIX_SAVED_IDS
101*7c478bd9Sstevel@tonic-gate #define	__POSIX_NO_TRUNC	-1	/* automatic truncation */
102*7c478bd9Sstevel@tonic-gate #define	__POSIX_VDISABLE	0x00	/* Disable function in termios.h */
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate /*
105*7c478bd9Sstevel@tonic-gate  * added for optional facility configuration values
106*7c478bd9Sstevel@tonic-gate  */
107*7c478bd9Sstevel@tonic-gate #define	M_POSIX2_C_BIND		1
108*7c478bd9Sstevel@tonic-gate #define	M_POSIX2_C_DEV		1
109*7c478bd9Sstevel@tonic-gate #define	M_POSIX2_FORT_DEV	1
110*7c478bd9Sstevel@tonic-gate #undef	M_POSIX2_FORT_RUN
111*7c478bd9Sstevel@tonic-gate #define	M_POSIX2_LOCALEDEF	1
112*7c478bd9Sstevel@tonic-gate #define	M_POSIX2_SW_DEV		1
113*7c478bd9Sstevel@tonic-gate #define	M_POSIX2_UPE		1
114*7c478bd9Sstevel@tonic-gate #define	M_POSIX2_CHAR_TERM	1
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate #undef	M_FCLOSE_NOT_POSIX_1	/* Not POSIX.1 section 8.2 */
117*7c478bd9Sstevel@tonic-gate #undef	M_FFLUSH_NOT_POSIX_1	/* Not POSIX.1 section 8.2 */
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate #define	M_BSD_SPRINTF		0	/* sprintf on this system has BSD */
120*7c478bd9Sstevel@tonic-gate 					/* semantics, does not return length */
121*7c478bd9Sstevel@tonic-gate #define	M_ENDPWENT		1	/* set to 1 if system provides a */
122*7c478bd9Sstevel@tonic-gate 					/* getpwent() routine */
123*7c478bd9Sstevel@tonic-gate #define	M_MATHERR		1	/* math library supports matherr() */
124*7c478bd9Sstevel@tonic-gate 
125*7c478bd9Sstevel@tonic-gate #define	M_LOGGER_CONSOLE	"/dev/console"
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate #define	M_SVFS_INO	1
128*7c478bd9Sstevel@tonic-gate 
129*7c478bd9Sstevel@tonic-gate /*
130*7c478bd9Sstevel@tonic-gate  * Set I18N flags
131*7c478bd9Sstevel@tonic-gate  */
132*7c478bd9Sstevel@tonic-gate #define	M_I18N		1	/* turn on internationalizaion */
133*7c478bd9Sstevel@tonic-gate #define	I18N		1	/* OBSOLESCENT version of M_I18N */
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate #define	M_I18N_M_	1	/* Uses m_ on MKS i18n extension routines */
136*7c478bd9Sstevel@tonic-gate #define	M_I18N_MKS_XPG	1	/* Use NL info from XPG4 */
137*7c478bd9Sstevel@tonic-gate #define	M_I18N_MKS_FULL	0	/* Full mks extensions */
138*7c478bd9Sstevel@tonic-gate #define	M_I18N_MB	1	/* Enable multibyte compilation */
139*7c478bd9Sstevel@tonic-gate #undef	M_I18N_LOCKING_SHIFT	/* No locking-shift character sets. */
140*7c478bd9Sstevel@tonic-gate #undef	M_VARIANTS		/* Invariant characters are */
141*7c478bd9Sstevel@tonic-gate 
142*7c478bd9Sstevel@tonic-gate /*
143*7c478bd9Sstevel@tonic-gate  * Interopen Curses for Solaris2
144*7c478bd9Sstevel@tonic-gate  */
145*7c478bd9Sstevel@tonic-gate #undef	M_CURSES_MEMMAPPED
146*7c478bd9Sstevel@tonic-gate #define	M_TERM_NAME		"vt100"
147*7c478bd9Sstevel@tonic-gate #define	M_TERMINFO_DIR		"/usr/share/lib/terminfo"
148*7c478bd9Sstevel@tonic-gate #define	M_CURSES_VERSION	"MKS I/XCU 4.3 Curses"
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate #define	M_ULIMIT_AVAIL	1	/* <ulimit.h> file available */
151*7c478bd9Sstevel@tonic-gate #define	M_EXPR_POSIX	1	/* decimal only on the expr command line */
152*7c478bd9Sstevel@tonic-gate 
153*7c478bd9Sstevel@tonic-gate #define	M_PATH_MAX	PATH_MAX
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate /*
156*7c478bd9Sstevel@tonic-gate  * Solaris 2 does not use stateful encoding, so we will just convert these
157*7c478bd9Sstevel@tonic-gate  * to their stateless equivalent.
158*7c478bd9Sstevel@tonic-gate  */
159*7c478bd9Sstevel@tonic-gate #ifndef	_MBSTATE_T
160*7c478bd9Sstevel@tonic-gate #define	_MBSTATE_T
161*7c478bd9Sstevel@tonic-gate typedef int	mbstate_t;
162*7c478bd9Sstevel@tonic-gate #endif	/* ! _MBSTATE_T */
163*7c478bd9Sstevel@tonic-gate 
164*7c478bd9Sstevel@tonic-gate #define	mbrlen(c, n, ps)	mblen(c, n)
165*7c478bd9Sstevel@tonic-gate #define	wcrtomb(c, w, s)	wctomb(c, w)
166*7c478bd9Sstevel@tonic-gate #define	mbrtowc(p, w, n, s)	mbtowc(p, w, n)
167*7c478bd9Sstevel@tonic-gate 
168*7c478bd9Sstevel@tonic-gate #define	wcsrtombs(w, c, n, s)	wcstombs(w, c, n)
169*7c478bd9Sstevel@tonic-gate #define	mbsrtowcs(c, w, n, s)	mbstowcs(c, w, n)
170