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