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  * Copyright 1996-2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * <mkslocal.h>, POSIX Version - local <mks.h> requirements
29  *
30  * This generic POSIX version should be used as a template for creation of
31  * any new <mkslocal.h> file.
32  *
33  * Copyright 1985, 1993 by Mortice Kern Systems Inc.  All rights reserved.
34  *
35  * $Header: /rd/h/posix/rcs/mkslocal.h 1.168 1995/06/21 20:33:29 jeffhe Exp mark $
36  */
37 
38 #if 0	/* not required for POSIX systems; here for documentation only */
39 
40 #include <sys/types.h>
41 
42 #ifndef VERSION
43 #define VERSION "MKS InterOpen I/XCU 4.3 SB"     /* Used for version# */
44 #endif
45 
46 
47 #define name-of-system 1	/* for identifying system (i.e. BSD, SYSV,
48 				 * DOS, etc)
49 				 */
50 
51 #ifndef __STDC__
52 /* For non-ANSI C compilers, we need to define
53  * the character encoding for some special control characters
54  * If these are NOT defined here, then <mks.h> will use
55  * the ASCII encodings as the default values.
56  *
57  * For ANSI C compilers, there are special C character constants supported
58  * by the compiler.  <mks.h> will properly handle this.
59  *
60  */
61 #define     M_ALERT '\7'            /* ASCII encoding for \a */
62 #define     M_VTAB  '\13'           /* ASCII encoding for <VT> */
63 #endif /* __STDC__ */
64 
65 
66 /* M_ESCAPE - the system default character encoding for the <ESC> character
67  * If this is not defined here, then <mks.h> will
68  * default to use the ASCII encodings.
69  */
70 #define     M_ESCAPE '\033'         /* ASCII default code for <ESC> */
71 
72 #define	SETVBUF(fp,bp,f,s) setvbuf(fp,f,bp,s)	/* for some SysV and Xenix
73 						 * systems, which have unusual
74 						 * calling sequences
75 						 */
76 
77 #define	M_DEFAULT_PATH	"/bin:/usr/bin"
78 				/* Default PATH. Not used yet.
79 				 */
80 
81 
82 #define M_CS_PATH	"/bin:/usr/bin"
83 				/* This string is a list of directories where
84 				 * all the POSIX.2 utilities can be found.
85 				 * Returned by constr(_CS_PATH, buf, len).
86 				 * The shell uses this search path in
87 				 *	command -p util ...
88 				 * The list plus "." is used by login
89 				 * and sh as the default $PATH.
90 				 */
91 
92 #define M_CS_SHELL	"/bin/sh"
93 				/* The pathname of the shell utility.
94 				 * Returned by confstr(_CS_SHELL, buf, len).
95 				 * This string defines the path to the
96 				 * the POSIX.2 command language interpreter,
97 				 * so we do not have to search M_CS_PATH.
98 				 */
99 
100 #define M_CS_BINDIR     "/bin"
101 #define M_CS_LIBDIR     "/lib"
102 #define M_CS_TMPDIR     "/tmp"
103 #define M_CS_ETCDIR     "/etc"
104 #define M_CS_SPOOLDIR   "/spool"
105 #define M_CS_NLSDIR     "/lib/nls"
106 #define M_CS_MANPATH    "/man"
107 				/* the M_CS_* strings are used by MKS's version
108 				 * of the POSIX.2 confstr() API.
109 				 * The M_CS_*DIR strings point to system
110 				 * default directories.
111 				 * The M_CS_*PATH strings may be a list of
112 				 * colon seperated system directories
113 				 */
114 
115 
116 #define	M_BINDIR(path)	"/bin/" # path
117 				/* M_BINDIR - directory where the POSIX.2
118 				 * utilities live. (e.g ed, ...)
119 				 */
120 
121 #define	M_LIBDIR(path)	M_CS_LIBDIR # path
122 				/* Define to convert a pathname relative to the
123 				 * library directory to an absolute pathname.
124 				 * Traditional systems would use "/usr/lib/"
125 				 * <mks.h> should always be overridden.
126 				 *
127 				 * Used by bc, cron
128 				 */
129 
130 #define	M_ETCDIR(path)	M_CS_ETCDIR # path
131 				/* Define to convert a pathname relative to the
132 				 * etcetera directory to an absolute pathname.
133 				 * Traditional systems would use "/etc/"
134 				 * <mks.h> should always be overridden.
135 				 * Used by file, vi, sh, ccg, lex, awk
136 				 */
137 
138 #define	M_SPOOLDIR(path) M_CS_SPOOLDIR # path
139 				/* Define to convert a pathname relative to the
140 				 * spool directory to an absolute pathname.
141 				 * Traditional systems would use "/usr/spool/"
142 				 * <mks.h> should always be overridden.
143 				 */
144 
145 #define	M_NLSDIR(path)	"M_CS_NLSDIR # path
146 				/* Directory name used by the locale program
147 				 * to locate specific compiled locales.
148 				 * Should always be set, if using the mks
149 				 * supplied i18n package.  Possible location
150 				 * might be /usr/lib/nls.
151 				 */
152 #define	M_TMPDIR	M_CS_TMPDIR	/* Temporary file storage directory.
153 				 * Used for P_tmpdir in case its not defined
154 				 * in <stdio.h>
155 				 */
156 
157 #define	M_MANPATH	M_CS_MANPATH
158 				/* a list of colon seperated pathnames
159 				 * which the man utility uses
160 				 * as the default search path
161 				 * (e.g when MANPATH environment variable
162 				 * not initialized.
163 				 */
164 
165 
166 
167 #define M_SYSTEM_HELP "help.cmd"/* help command only: If the help command
168 				 * doesn't know about a given request for help
169 				 * then pass the help request on to another
170 				 * help program.  Note that if the name for
171 				 * the other is also help, there must be
172 				 * some form of name qualification.  No attempt
173 				 * will be made if this is not defined.
174 				 * <mks.h> will default to undefined
175 				 */
176 
177 #define DEF_NLSPATH     "/lib/nls/locale/%L/%N.cat"
178 				/* define the default path that should be used
179 				 * by MKS's implementation of catopen() when
180 				 * trying to open the message cataloges
181 				 * If you are not using MKS's implementation
182 				 * of catopen(), then this definition
183 				 * is not required.
184 				 */
185 
186 #define M_ENDPWENT	1	/* set to 1 if system provides a endpwent()
187 				 * routine.
188 				 * Normally, systems provide this routine
189 				 * only if getpw*() routines allocate
190 				 * some resources which a user may want
191 				 * to deallocate when finished accessing the
192 				 * user getpw*() routines
193 				 * This is the case for conventional
194 				 * UNIX systems
195 				 */
196 
197 #undef M_SHBLTIN_ANYCMD 	/* set to 1 if you want ability to create an
198 				 * executable with any name, using shbltin.c.
199 				 * [ shbltin.c was created to satisfy
200 				 *   POSIX.2-1992 Section 2.3 "regular built-in
201 				 *   utilities". ]
202 				 * If this is undefined, then the only valid
203 				 * command names are those listed in an
204 				 * internal table in shbltin.c which are
205 				 * are checked at run-time against
206 				 * basename(argv[0]).
207 				 * If the command name is not listed in the
208 				 * table, then program will exit
209 				 * with an error message.
210 				 *
211 				 * Normally, this is undefined, since
212 				 * it becomes too easy to get into an infinite
213 				 * loop if you name this executable to a
214 				 * non-bltin command.
215 				 */
216 
217 /* shbltin:
218  *   shbltin.c is configurable but its configuration is done
219  *   in mkslocal.mk.
220  *   See M_SHBLTIN_ULIMIT
221  *   See M_SHBLTIN_HASH
222  *   See M_SHBLTIN_TYPE
223  *   See M_SHBLTIN_XPG4
224  */
225 
226 #undef	M_FNMATCH_DUALCASE	/* fnmatch(): If this #define is set, then
227 				 * fnmatch will ignore case in file name
228 				 * matches *unless* the environment variable
229 				 * at runtime has DUALCASE set.
230 				 * For a conforming system, this should *not*
231 				 * be defined. <mks.h> will default to
232 				 * undefined.
233 				 */
234 
235 #undef	M_SMALLSTACK		/* Define this to 1 on systems that have
236 				 * a fixed size stack compiled into programs,
237 				 * and a small (probably 64k) data segment.
238 				 */
239 
240 #undef M_NULL			/* define this if you want to change the
241 				 * system default defintion of NULL.
242 				 * (e.g #define M_NULL  ((void*)0)
243 				 */
244 #define M_MALLOC	1	/* Define M_MALLOC if your system has either
245 				 * of the following two problems:
246 				 * 1) ANSI does not specify returning a valid
247 				 *    errno if malloc() returns NULL.
248 				 *    But, MKS code assumes a valid errno
249 				 *    as is returned in most UNIX systems.
250 				 * 2) ANSI says it is implementation defined
251 				 *    whether or not malloc(0) returns a valid
252 				 *    pointer.
253 				 *    MKS code assumes that a valid pointer
254 				 *    is returned.
255 				 *
256 				 * Defining M_MALLOC requires an m_malloc()
257 				 * function, which MKS provides.
258 				 * Undefining M_MALLOC causes m_malloc() to be
259 				 * renamed to malloc().  (See mks.h)
260 				 */
261 
262 #define M_REALLOC	1	/* Defining M_REALLOC will cause
263 				 * m_realloc() to be used in place of the
264 				 * systems realloc().
265 				 * This is necessary:
266 				 *  a) if you do not have an ANSI realloc()
267 				 *  b) if the system realloc()
268 				 *     has the following problem:
269 				 *     - ANSI does not specify returning a valid
270 				 *       errno if malloc() returns NULL.
271 				 *       But, MKS code assumes a valid errno
272 				 *       as is returned in most UNIX systems.
273 				 *
274 				 * Defining M_REALLOC requires an m_realloc()
275 				 * function, which MKS provides.
276 				 * Undefining M_MALLOC causes m_malloc() to be
277 				 * renamed to malloc().  (See mks.h)
278 				 */
279 #ifdef M_REALLOC
280 #define M_WANT_ANSI_REALLOC  1	/* Use #undef M_WANT_ANSI_REALLOC
281 				 * if your system has an ANSI realloc() function
282 				 *
283 				 * Defining M_WANT_ANSI_REALLOC can only be
284 				 * done if M_REALLOC is also defined.
285 				 * Use M_WANT_ANSI_REALLOC if your system
286 				 * does not support either of the following
287 				 * 2 features:
288 				 *
289 				 * 1) ANSI says that if the ptr passed to
290 				 *    realloc is NULL, then it will act like
291 				 *    a malloc()
292 				 * 2) ANSI says that if the ptr passed is
293 				 *    not NULL and the size is 0, then the
294 				 *    object that ptr points to is freed.
295 				 *
296 				 * Defining M_REALLOC requires an m_realloc()
297 				 * function, which MKS provides.
298 				 * Undefining M_MALLOC causes m_realloc() to be
299 				 * renamed to realloc().  (See mks.h)
300 				 */
301 #endif /* M_REALLOC */
302 
303 
304 #define	M_MAXMALLOC	64	/* Define the maximum number of kilobytes (K)
305 				 * that can be requested from malloc().
306 				 * This is intended for segmented systems
307 				 * where max allocation by malloc() is smaller
308 				 * than the total mallocable memory;
309 				 * some programs will assume they can do
310 				 * multiple mallocs of this # of K to allocate
311 				 * a large data structure.
312 				 * By default, this is not defined; malloc can
313 				 * allocate up to MAX_INT bytes.
314 				 */
315 
316 #define	__LDATA__	1	/* DEPRECATED */
317 #define	M_LDATA		1	/* For most modern systems this will be set.
318 				 * Some systems (e.g DOS) have a large and
319 				 * small program model.
320 				 * Thus, various programs have two buffer sizes
321 				 * built into them -- large and small.  The
322 				 * small buffer size is normally sub-optimal,
323 				 * but permits the data to fit in the small
324 				 * buffer (say 64k)
325 				 */
326 
327 #ifndef PATH_MAX
328 #define	M_PATH_MAX	2048	/* For systems where pathconf(file,_PC_PATH_MAX)
329 				 * can return -1 and NOT set errno
330 				 * (which means that PATH_MAX for 'file'
331 				 *  is unlimited),
332 				 * we provide a suitable LARGE value
333 				 * that can be returned by m_pathmax().
334 				 * This number should be sufficiently large
335 				 * to handle most (if not all) reasonable
336 				 * pathnames for a particular system.
337 				 * m_pathmax() is usually used to determine
338 				 * how large a buffer must be allocated to store
339 				 * pathnames.
340 				 */
341 #endif /* PATH_MAX */
342 
343 #define	M_EXPTIME	1	/* For systems whose files maintain an
344 				 * additional time field, generally expiry time.
345 				 * The stat structure must have a member
346 				 * st_etime and the utimbuf a member exptime.
347 				 * <mks.h> will default to undefined.
348 				 */
349 
350 #undef ROOTGID
351 #undef ROOTUID			/* Some systems may use a different user id
352 				 * to indicate the superuser.
353 				 * If it is not defined here, then <mks.h>
354 				 * will define it to be 0 which is the
355 				 * value used in conventional UNIX.
356 				 */
357 
358 #define	M_AUDIT		1	/* For systems which maintain file auditing
359 				 * information.  M_AUDITW1 and M_AUDITW2 must
360 				 * be defined, and return one or two audit
361 				 * words from the stat structure.  m_audmode
362 				 * must be defined in the local libraries
363 				 * to convert from these two words, to ls style
364 				 * letter information.  <mks.h> will default to
365 				 * undefined.
366 				 */
367 #define	M_AUDITW1(sbp)	?	/* Fetch first audit word from stat pointer,
368 				 * if M_AUDIT defined.
369 				 */
370 #define	M_AUDITW2(sbp)	?	/* Fetch second audit word from stat pointer,
371 				 * if M_AUDIT defined.  Define as `0' if no
372 				 * second audit word.
373 				 */
374 
375 #undef M_DEVIO			/* use #define	M_DEVIO	1  on systems that
376 				 * requires special interfaces
377 				 * to perform I/O on devices.
378 				 * (e.g cannot use the standard open,read,write
379 				 *      interface)
380 				 * See <devio.h> for details on this
381 				 * special interface.
382 				 * Default is undefined; no special device i/o
383 				 * interface is used.
384 				 */
385 
386 #undef	M_DEVBIN		/* Use #define M_DEVBIN 1
387 				 * on systems that have devices that do not
388 				 * allow raw I/O be written directly
389 				 * to the device.
390 				 * These systems tend to process the data
391 				 * before actually writing the data to the
392 				 * device.
393 				 * (e.g DOS disk devices do some character
394 				 *      translations. This routine is intended
395 				 *      to disable this behaviour.)
396 				 * The definition of m_devbin() and m_devstd()
397 				 * is done in <mks.h>.
398 				 * If this is defined, then <mks.h> defines
399 				 * the prototypes m_devbin() and m_devstd()
400 				 * Otherwise it undefines m_devstd()
401 				 * and set m_devbin to return a dummy value of 0
402 				 *
403 				 * MKS has selected some utilities
404 				 * to recognize this fact and to handle
405 				 * these I/O cases specially.
406 				 * Such utilities include cp, mv, and pax
407 				 */
408 
409 #define	M_SETENV	1	/* Some systems require special preparation */
410 char	**m_setenv ANSI((void));/* for use of the environment variables via
411 				 * environ; m_setenv call makes sure that
412 				 * environ is set up.  <mks.h> will default to
413 				 * m_setenv returning environ.  M_SETENV
414 				 * must be set to indicate to mks.h that a C
415 				 * function has been defined.
416 				 */
417 
418 #define	m_setbinary(fp)		/* On systems supporting text and binary files,
419 				 * (i.e. "rb" and "wb" to fopen work different
420 				 * from "r" and "w"), there is a requirement
421 				 * to be able to set stdin/stdout to binary
422 				 * mode.  m_setbinary on such systems should
423 				 * perform this action.  On other systems, this
424 				 * macro should define itself out of existence.
425 				 * Normally this macro would be defined in
426 				 * <stdio.h>.  <mks.h> defaults to defining
427 				 * it out of existence, if not defined.
428 				 */
429 
430 #define	M_TFGETC	0	/* Do we have POSIX.1-deficient termios?
431 				 * On POSIX.1 or SVID compliant systems,
432 				 * define it as 0 and mks.h will
433 				 * map m_tfgetc(fp,tp) to fgetc(fp).
434 				 * On deficient systems (e.g. BSD),
435 				 * define it as 1 and ensure a m_tfgetc()
436 				 * routine is provided.
437 				 */
438 
439 #define M_STTY_CC       1       /* The stty command control-character setting
440 				 * is very system specific.  The default code
441 				 * in stty.c works only for the ascii character
442 				 * set.  <mks.h> will default to M_STTY_CC
443 				 * being undefined, resulting using the default
444 				 * code. arg is the string passed to stty; *cp
445 				 * should have the resulting value stored in it.
446 				 * A 0 return value indicates success; other-
447 				 * wise an error message will be printed.
448 				 */
449 
450 #define	M_LOGIN_GETTY	1	/* Use #define M_LOGIN_GETTY 1
451 				 * on systems that do not provide a
452 				 * getty utility.
453 				 * This is for use in the login utility to
454 				 * display a banner that would conventionally
455 				 * be displayed by the UNIX getty utility
456 				 * that would have run before login.
457 				 * If M_LOGIN_GETTY is not defined here,
458 				 * then login will not print this banner info.
459 				 */
460 
461 #define M_MANPAGER	"more -A -s"
462 				/* default command that is executed
463 				 * by the man utility to display a man page
464 				 * when the user's PAGER environment
465 				 * variable is not set.
466 				 */
467 
468 #define M_TTYGROUP	"tty"	/* Name of the group that owns tty's.
469 				 * If this isn't defined, then <mks.h>
470 				 * will leave it undefined.
471 				 * This is related to the MKS default
472 				 * access enforcment policy for use
473 				 * by m_wallow(), mesg, talk, and write.
474 				 * If undefined, it is assumed that no security
475 				 * is available on tty's.
476 				 */
477 
478 #undef M_CONSOLE		/* This is defined to indicate that a pc
479 				 * style console is used instead of a tty.
480 				 * This allows for the elimination of
481 				 * unnecessary calls to m_wallow() from
482 				 * pc compiles.
483 				 * Default is undef; m_wallow calls are made.
484 				 */
485 
486 #define M_LKSUFFIX	".lock"	/* Suffix for lock file used by mailx and
487 				 * tsmail (name of mailbox to be locked
488 				 * is the prefix).  ".lock" is typically
489 				 * used by UNIX sendmail.  This should be
490 				 * set to the same suffix as used by other
491 				 * mail agents on the machine.
492 				 */
493 
494 #define	M_LS_OPT_D	1	/* ls command: Support -D (list only dirs)
495 				 * This option is non-standard on any unix
496 				 * system, so is only an option.
497 				 * Default is not defined, so ls doesn't support
498 				 * this option.
499 				 */
500 
501 #define	M_LOGGER_OPTIONS	(log_pid|log_user)
502 				/* Set up default options for the logger utility
503 				 * The logger utility allows the log lines to
504 				 * be prefixed by pid, ppid, a timestamp,
505 				 * and/or the login username.
506 				 * If an implementation wishes to
507 				 * force some of these prefixes then it
508 				 * should OR together one or more of the
509 				 * appropriate constants:
510 				 *   log_pid
511 				 *   log_ppid
512 				 *   log_timestamp
513 				 *   log_user
514 				 * If M_LOGGER_OPTIONS is not defined here then
515 				 * logger.c uses the default:
516 				 *   (log_pid|log_user).
517 				 */
518 
519 #define	M_LOGGER_CONSOLE "/dev/console"
520 				/* logger command: If you wish to use the
521 				 * default, trivial, logging routines, then
522 				 * define M_LOGGER_CONSOLE to the name of
523 				 * a device or file, to which logger may
524 				 * append the log messages.
525 				 * If this variable is *not* defined, then
526 				 * the local system must have m_logger, and
527 				 * m_logger_close defined and retrieve
528 				 * either by the make process, or in the
529 				 * libraries.  See the documentation for
530 				 * the calling sequence of these routines.
531 				 */
532 
533 #undef M_COMPRESSION_AVAIL	/*
534 				 * Not defining M_COMPRESSION_AVAIL indicates
535 				 * that the compression libary code is not
536 				 * available.
537 				 * Changing the #undef to #define should only
538 				 * be done if the code in libc/mks/m_comp.c
539 				 * is implemented.
540 				 *
541 				 * Because UNiSYS holds the patent on the
542 				 * adaptive Lempel-Ziv compression algorithm,
543 				 * MKS may not provide the compression
544 				 * source code (see libc/mks/m_comp.c)
545 				 * in which case the -z option in pax/tar/cpio
546 				 * must be disabled.
547 				 * If the compression algorithm is implemented
548 				 * in m_comp.c, then this macro can be defined.
549 				 */
550 
551 #define	M_TAR_TAPENAME	"/dev/mt/%c%c"
552 				/* Set up default file name that the pax/tar
553 				 * utilities will use (e.g when 'f' option
554 				 * not specified)
555 				 * This file name is usually a tape device name
556 				 * Two %c's field specifiers can be included
557 				 * in the file name;
558 				 * the first is replaced with tapenumber,
559 				 * the 2nd with tape density
560 				 *    (l, m, or h, for low, medium or high).
561 				 * If you either don't have multiple
562 				 * tapes, or densities, you can leave off extra
563 				 * %c's.
564 				 *
565 				 * If this is not defined then pax/tar.h
566 				 * will use "/dev/mt/%c%c"
567 				 */
568 
569 #undef M_GUNZIP			/* When defined, m_dc_open() will test for
570 				 * gzip-compressed files, and call the
571 				 * appropriate routines to uncompress them,
572 				 * in addition the normal operation of testing
573 				 * for compress-compressed files.
574 				 */
575 
576 #undef M_VI_NO_RECOVER		/* vi command: when defined will not include the
577 				 * :preserve and :recover commands.
578 				 */
579 
580 #define	M_VI_COPYRIGHT	1	/* vi command: When sold as a separate product,
581 				 * vi prints a copyright notice.  This flag
582 				 * causes the notice to be printed. Default is
583 				 * not defined, which causes vi to NOT print
584 				 * the copyright notice.
585 				 */
586 
587 #define M_MAKEOS	"OS:=POSIX"	/*for $(OS) in "make" */
588 				/* make command: builtin rule which defines the
589 				 * $(OS) variable expansion.
590 				 * Default is not defined, which is an error.
591 				 */
592 
593 #undef M_MAKE_EXIT_DIRECT	/* If this is defined, make will call exit()
594 				 * directly when it receives a signal, rather
595 				 * than clearing the handler and re-sending
596 				 * itself the signal. For 1003.2 conformance,
597 				 * this must not be defined.
598 				 */
599 
600 #define M_MAKEFILES     ".MAKEFILES:makefile Makefile"
601 				/* rule that make uses when trying to locate
602 				 * the default makefile to run
603 				 */
604 
605 #define M_MAKEDIRSEPSTR "/"	/* Default string of characters that make
606 				 * will look at and use when manipulating
607 				 * path names.
608 				 */
609 #define M_GETSWITCHAR   '-'	/* Default character used to indicate an
610 				 * option to a command. Note - on some
611 				 * systems, this may actually be a system-call
612 				 * instead of a constant. As a consequence
613 				 * this define should not be used as a
614 				 * global initializer.
615 				 */
616 #define M_MAKE_BUFFER_SIZE 8192 /* max line length handled by make parser */
617 #define M_MAKE_STRING_SIZE 8192	/* make macro expansion max string size */
618 #define M_MAKE_PATSUB_SIZE 1024	/* make pattern/substitution max string size */
619 
620 #define	M_FLDSEP	':'	/* The field separator character used in
621 				 * the PATH environment variable (for sh),
622 				 * and for the entries in the group database
623 				 * (e.g /etc/group) and the user database
624 				 * (e.g /etc/passwd) files.
625 				 * If this is not defined here, then <mks.h>
626 			 	 * will default to ':'.
627 				 */
628 
629 #undef M_TEXT_CR		/* Some systems use <cr><lf> pairs rather than
630 				 * simple <lf>s to delimit text lines.  On
631 				 * these systems, this should be defined.
632 				 * Default is undefined.
633 				 */
634 
635 #define	M_FPPSLOW 1		/* This should be defined for systems whose
636 				 * floating point operations
637 				 * are slower than integral operations.
638 				 * If this in undefined, the assumption will
639 				 * be fast floating point.
640 				 */
641 
642 #define __CLK_TCK 100		/* units for times() */
643 
644 #undef	M_NOOWNER		/* for systems which don't have user/group
645 				 * owners on files.
646 				 * <mks.h> will default to undefined.
647 				 * Used by pax
648 				 */
649 
650 #define	M_FSDELIM(ch) ((ch)=='/') /* for systems who have special characters to
651 				 * delimit file systems, this returns true if
652 				 * the given character is a file system
653 				 * delimiter; <mks.h> will default to '/'.
654 				 * ispathdelim() is a deprecated form.
655 				 */
656 
657 #define	M_DRDELIM(ch)	(0)	/* for systems whose names parse with a leading
658 				 * drive separated by a drive delimiter char,
659 				 * (e.g. ':' on dos systems); posix systems
660 				 * simply return false, i.e. no, character
661 				 * is not a drive delimiter.
662 				 * <mks.h> will default to (0).
663 				 */
664 
665 #define	M_DIRSTAT(pathname, dirp, statbuf)	stat((pathname), (statbuf))
666 				/* prototype definition:
667 				 * int M_DIRSTAT(char*	pathname,
668 				 *               DIR*  	dirp,
669 				 *               struct stat*	statbuf);
670 				 * On POSIX and conventional UNIX systems
671 				 * this macro is defined as:
672 				 *    stat((pathname), (statbuf))
673 				/* On systems where the file information is
674 				 * maintained in the directory (not the inode)
675 				 * the DIR structure may contain this info,
676 				 * in which case the information can be returned
677 				 * without doing a stat(). This may be a
678 				 * performance enhancement.
679 				 * dirp is the DIR * pointer returned by opendir
680 				 */
681 
682 #define	M_HIDDEN(dirp, dp)	((dp)->d_name[0] == '.')
683 				/* prototype definition:
684 				 *  int M_HIDDEN(DIR* dirp, struct* dirent)
685 				 *
686 				 * Some utilities (e.g ls) recognize certain
687 				 * filenames as being "hidden" files.
688 				 * In conventional UNIX systems this has been
689 				 * the '.' prefix.
690 				 * On other systems, with other conventions
691 				 * the M_HIDDEN macro should be suitably
692 				 * modified
693 				 *
694 				 * If this is not defined, then
695 				 * <mks.h> defaults to traditional unix, a
696 				 * leading `.'.
697 				 */
698 
699 #undef M_NO_FORK		/* Define for non-POSIX systems that do not
700 				 * have a true fork(), and must use some sort
701 				 * of spawn call (for example, DOS).
702 				 * By default undefined; there is a fork.
703 				 */
704 
705 #undef	M_SYNC_FORK		/* fork() is synchronous (DOS). (sh)
706 				 * Default is undefined; posix.1 fork provided.
707 				 */
708 
709 #undef	M_FEXEC			/* Use fexec[ve] when possible.
710 				 * Only define if fexec is faster than fork/exec
711 				 * (sh, ...)
712 				 * By default undefined; fork is reasonable
713 				 * performance.
714 				 */
715 
716 #undef	M_EXEC_FILETYPE		/* File name types for executables.
717 				 * For example, .exe and .ksh.
718 				 * For the shell, you need to define shexecve()
719 				 * and testpath() in sh$(ORG).c.
720 				 * By default undefined; no file name types.
721 				 */
722 
723 #undef	M_NO_IDS		/* POSIX uids and gids.
724 				 * (sh: set -p; umask; test -[rwx])
725 				 */
726 
727 #undef	M_NO_ST_INO		/* stat's st_ino is meaningless. (pax; test -ef)
728 				 */
729 
730 #undef M_SVFS_INO		/* statvfs() provides valid f_ffree and
731 				 * f_files fields which describe the number
732 				 * of free file slots and the total number
733 				 * of file slots in a filesystem.  Used
734 				 * by df.
735 				 */
736 
737 #undef	M_NO_PIPE		/* no pipe(), use temp files. (sh, popen)
738 				 * Default is undefined; posix.1 pipes provided.
739 				 */
740 
741 #undef	M_LOCKING_OPEN		/* Open'd files are locked, (DOS, OS2)
742 				 * and cannot be unlink'd or rename'd.
743 				 */
744 
745 #undef	M_USE_SIGNAL		/* Has no sigaction, use signal (SVR3).
746 				 * (sh, ...)
747 				 */
748 
749 #undef	M_NO_IO_EINTR		/* Tty I/O does not return EINTR
750 				 * when SIGINT signal handler returns.
751 				 * (sh, ?)
752 				 */
753 
754 #undef	M_TTY_ICANON		/* Tty is always in ICANON mode.
755 				 * (sh,ex,mailx)
756 				 */
757 
758 #define	M_TTYNAME "/dev/tty"	/* Device to open to access the controlling
759 				 * tty; posix.2 does require this to be /dev/tty
760 				 * but dos for example calls it /dev/con.
761 				 * <mks.h> will default to /dev/tty.
762 				 */
763 
764 #define	M_NULLNAME "/dev/null"	/* Device to open for the null device as defined
765 				 * by posix.2.  It is required to be named
766 				 * /dev/null, but dos for example calls it
767 				 * /dev/nul.  <mks.h> will default to /dev/null.
768 				 */
769 
770 #define	M_FCLOSE_NOT_POSIX_1 1	/* fclose() does not conform to posix.1 section
771 				 * 8.2. An explicit lseek must be done on the
772 				 * stream prior to an fclose for the seek
773 				 * pointer to be correct. <mks.h> will default
774 				 * to undefined.
775 				 */
776 
777 #define	M_FFLUSH_NOT_POSIX_1 1	/* fflush() does not conform to posix.1 section
778 				 * 8.2.  <mks.h> will default to undefined.
779 				 * If undefined, then mks.h will turn m_fflush
780 				 * into fflush.  If defined, then mks.h will
781 				 * leave m_fflush alone, and a stdio-specific
782 				 * routine m_fflush() must be provided which
783 				 * actually conforms to the standard.
784 				 */
785 
786 
787 #define	M_NL_DOM	"mks"	/* String used as default name (domain name)
788 				 * to get mks utility messages via the xpg
789 				 * catopen/catgets message translation functions
790 				 * For example, in XPG:
791 				 *     catopen (M_NL_DOM, ...)
792 				 */
793 
794 
795 #define	M_L_CUSERID	16	/* Length of longest user id returned by
796 				 * cuserid() routine.
797 				 * Used for L_cuserid in case its not
798 				 * defined in <stdio.h>
799 				 */
800 
801 #define	M_FSMOUNT	"/etc/mtab"
802 				/* This pathname is passed as the 1st argument
803 				 * to setmntent() routine.
804 				 * On conventional UNIX systems, this
805 				 * pathname identifies a file that contains
806 				 * a list of all the actively mounted systems.
807 				 * The mount utility is normally responsible
808 				 * for adding entries to this file
809 				 * and umount utility deletes the entries.
810 				 */
811 #define	M_FSALL		"/etc/fstab"
812 				/* this pathname identifies a file that
813 				 * is similar to M_FSMOUNT, but instead of
814 				 * the actively mounted file systems, it
815 				 * has a list of ALL possible filesystems
816 				 * that could be mounted.
817 				 * This file normally used by the mount
818 				 * command to find all the file systems
819 				 * to mount by default.
820 				 */
821 
822 #define	M_NLSCHARMAP	"/usr/lib/nls/charmap/ISO_8859-1"
823 				/* Name of default charmap file to use in
824 				 * localedef if -f charmap option isn't
825 				 * used.
826 				 */
827 
828 #define	M_ISEOV(error)	(error == EINVAL)
829 				/* This macro is used after an unsuccessful
830 				 * read() or m_devread() to determine
831 				 * if end-of-volume has been encountered.
832 				 * This macro should be invoked using the
833 				 * errno returned by the read().
834 				 * The macro should evaluate to 1 (true)
835 				 * if it can determine the EOV condition
836 				 * from this errno.
837 				 * Otherwise, should evaluate to 0 (false)
838 				 * <mks.h> defaults to 0, i.e. never EOV
839 				 */
840 
841 #define	M_COMPRESS_DEFBITS	16
842 				/* Default # of bits to compress in compress.
843 				 * If not defined, compress defaults to 16.
844 				 * Probably only useful on systems with limited
845 				 * memory capacity.
846 				 */
847 
848 #define M_CURSES_VERSION	"MKS Interopen Curses"
849 				/* Curses product version string.  This
850 				 * string will be imbedded in the excutable
851 				 * for an application.  This string should
852 				 * be set to the vendor's product code used
853 				 * for Curses.
854 				 */
855 
856 #undef	M_CURSES_MEMMAPPED	/* Define this symbol to compile up curses
857 				 * for a memory mapped display, such as the PC.
858 				 * Rather than allocating memory for the main
859 				 * screen window, this is compiled to point
860 				 * directly at the mapped memory.  This will
861 				 * require some custom code.
862 				 */
863 
864 #define M_TERM_NAME		"dumb"
865 				/* Default terminal name used if TERM is
866 				 * not set in the environment.
867 				 */
868 
869 #define M_TERMINFO_DIR		"/usr/lib/terminfo"
870 				/* Default location for the terminfo database
871 				 * if TERMINFO is not set in the environment.
872 				 *
873 				 * NOTE: Only define this macro if curses
874 				 *	 is available on this system since
875 				 *	 this macro is also used to
876 				 *       determine if "curses" is available
877 				 */
878 
879 #define M_BSD_SPRINTF	1	/* Defined if sprintf on this system has BSD
880 				 * semantics ie. if sprintf() returns a pointer
881 				 * to the string rather than the number of
882 				 * characters printed.
883 				 */
884 
885 #define	M_IS_NATIVE_LOCALE(s)	(strcmp(s, "POSIX") == 0 || strcmp(s, "C") == 0)
886 				/* Change this definition to define the locale
887 				 * that the machine level comparison function
888 				 * strcmp conforms to.  On all ascii machines,
889 				 * strcmp will order the same as the POSIX
890 				 * locale.  <mks.h> defaults to the def'n given
891 				 * here.
892 				 */
893 
894 #undef	M_NOT_646		/* Define this symbol if the local invariant
895 				 * character set does not conform to ISO646.
896 				 * Normally, this would only be set for
897 				 * EBCDIC systems.
898 				 * Several utilities (e.g pax/tar/cpio)
899 				 * are explicitly required to use 646,
900 				 * so if this flag is defined, then there
901 				 * is special code  which will be
902 				 * compiled in to do the appropriate
903 				 * character set translation.
904 				 */
905 
906 #define	M_FILENAME_CODESET	"IS8859"
907 				/* If M_NOT_646 is defined, then you must
908 				 * define the codeset that filenames are
909 				 * stored in.  This must be a string value,
910 				 * that can be passed into iconv.
911 				 * Theoretically, this could be a call to
912 				 * setlocale, to some extention that would
913 				 * return the name of the charmap.
914 				 */
915 
916 #define	M_STKCHK expression	/* Define this macro on systems that have a
917 				 * fixed size stack.
918 				 * This macro should define an expression
919 				 * that can be used to check if the current
920 				 * C function stack is within some distance
921 				 * from the end of available stack size.
922 				 * Return 0 if it is -- i.e. unsafe to
923 				 * recurse further.
924 				 * <mks.h> defaults to undefined;
925 				 * i.e. no stack bounds checking.
926 				 * This is only called from a few programs
927 				 * which allow the user to perform recursion.
928 				 */
929 
930 #define M_ST_RDEV(sb)	((sb).st_rdev)
931 #define M_DEVMAJOR(statp)	((uint)major((statp)->st_rdev))
932 				/* Prototype: uint M_DEVMAJOR(struct stat *);
933 				 *
934 				 * Return the major device number given
935 				 * a "struct stat *".
936 				 * Assumes the stat structure pointer
937 				 * represents a special device file.
938 				 * MKS recommends all systems define
939 				 * some method of extracting this information
940 				 * from this structure
941 				 * (eg. define a st_rdev or st_major member
942 				 *       in the struct stat.)
943 				 * This macro must be defined to return some
944 				 * unsigned integer value.
945 				 */
946 
947 #define M_DEVMINOR(statp)	((uint)minor((statp)->st_rdev))
948 				/* Prototype: uint M_DEVMINOR(struct stat *);
949 				 *
950 				 * Return the minor device number given
951 				 * a "struct stat *".
952 				 * Same recommendations as M_DEVMAJOR above.
953 				 */
954 
955 #define	M_DEVMAKE(mjr, mnr)	(makedev((mjr), (mnr)))
956 				/* Build a dev_t from a major and minor #
957 				 * M_DEVMAKE(M_DEVMAJOR(sbp), M_DEVMINOR(sbp))
958 				 * just returns the dev_t from the stat buf
959 				 */
960 
961 #define M_INODIRENT(name, dirbuf)	((ino_t)((dirbuf)->d_ino))
962 				/* Prototype:
963 				 *  ino_t M_INODIRENT(char *, struct dirent *);
964 				 *
965 				 * Return the inode belonging to the directory
966 				 * entry corresponding to dirbuf.  The name
967 				 * parameter is the path name given to a
968 				 * previous call to opendir().
969 				 */
970 
971 #define	M_ST_BLOCKS(sbp)  ((sbp)->st_blocks)
972 #define	M_ST_BLKSIZE(sbp) ((sbp)->st_blksize)
973 				/* If the implementation supports, in the stat
974 				 * structure, the actual disk space allocation
975 				 * to a given file, then M_ST_BLOCKS should
976 				 * be defined to return that member from the
977 				 * passed stat structure pointer.
978 				 * M_ST_BLKSIZE should be the number of bytes
979 				 * in a M_ST_BLOCKS unit; normally a
980 				 * different member of the stat structure.
981 				 *
982 				 * These macros are not required.
983 				 * Programs that use these macros
984 				 * will fall back on computing these
985 				 * values from the st_size field.
986 				 */
987 
988 #define M_MATHERR	0	/* If the math library supports matherr(),
989 				 * define with a non-zero value.
990 				 * MKS recommends that all ANSI-C libraries
991 				 * support this.
992 				 * By default, not defined.
993 				 */
994 
995 #define M_AWK_SUBSEP	"\034"	/* Default SUBSEP value in awk. This value
996 				 * is appropriate for ASCII based character
997 				 * sets.
998 				 */
999 
1000 #define M_FSCLOSE(fp)	fclose(fp)
1001 				/* define M_FSCLOSE(fp) to be the function
1002 				 * that cleans up the resources allocated
1003 				 * by m_fsopen().
1004 				 * Since m_fsopen() implementation is system
1005 				 * specific, so is M_FSCLOSE().
1006 				 */
1007 
1008 #define M_LEX_8BIT	1	/* If this is defined, lex will produce
1009 				 * 8-bit tables by default (the normal
1010 				 * default is 7-bit tables).
1011 				 */
1012 
1013 #define M_NUMSIZE	30	/* M_NUMSIZE should be defined to the length
1014 				 * in character positions, of the longest
1015 				 * number that can be sprintf()'d into a string
1016 				 * (longest of any type of number,
1017 				 *   eg. float, long, double ...)
1018 				 * For example, if your system prints
1019 				 * 30 characters for sprintf(str, "%le", float)
1020 				 * then M_NUMSIZE should be set to at least 30.
1021 				 *
1022 				 * This is used in awk to guess at the size
1023 				 * that each element of an sprintf() will be
1024 				 * so that it can internally allocate enough
1025 				 * storage.
1026 				 *
1027 				 * If this is not defined, then a default
1028 				 * value is used from <mks.h>
1029 				 */
1030 
1031 /*
1032  * File System (Naming) Attributes.
1033  * M_ONE_DOT, M_NO_LEADING_DOT, and M_SHORT_EXT are deprecated, in favour
1034  * of the m_fstype() function.  However, until all code has been converted
1035  * they must be set appropriately.  The obsolescent versions do not permit
1036  * supporting a system with multiple filesystem types: they are all statically
1037  * tested via pre-processor directives.  The new version permits mixing for
1038  * example of a posix file system, with say a dos floppy file system, such
1039  * as is available on many unix systems today.
1040  * If your system is posix conformant, do not set any of these variables
1041  * or functions; <mks.h> will default to a #define for m_fstype to
1042  * a POSIX style naming convention.
1043  */
1044 #undef	M_FSTYPE		/* If m_fstype is defined in mkslocal.h,
1045 				 * either as a #define, or a function decl.
1046 				 * then define M_FSTYPE, so <mks.h> won't
1047 				 * define m_fstype into M_FSTYPE_POSIX.
1048 				 */
1049 
1050 #undef	m_fstype(path)		/* Either #define, or function returning a
1051 				 * combination of file naming attributes,
1052 				 * and the file system type.  On a system
1053 				 * with only one file system type, this would
1054 				 * be a #define; on a system with multiple a
1055 				 * function which would decide based on the
1056 				 * path arg given.  Either M_FSTYPE_POSIX or
1057 				 * M_FSTYPE_FAT, should be or'ed with any of
1058 				 * M_FSATTR_ONE_DOT, M_FSATTR_SHORT_EXT and
1059 				 * M_FSATTR_NO_LEADING_DOT.  These three
1060 				 * M_FSATTR_ bit flags conform to the three
1061 				 * following obsolete defines.
1062 				 */
1063 
1064 #undef	M_ONE_DOT		/* Use	#define M_ONE_DOT 1
1065 				 * for non-posix files systems which
1066 				 * permit only one dot in a filename.
1067 				 * Thus, for example, y.tab.c, will become
1068 				 * ytab.c, based on this #define.
1069 				 * <mks.h> will default to undefined.
1070 				 */
1071 
1072 #undef	M_NO_LEADING_DOT	/* Use	#define M_NO_LEADING_DOT 1 for
1073 				 * non-posix file systems which do not
1074 				 * permit a leading dot in a filename.
1075 				 * Thus, for example, .profile will become
1076 				 * profile.ksh based on this #define.
1077 				 * <mks.h> will default to undefined.
1078 				 */
1079 
1080 #undef M_SHORT_EXT		/* Use	#define M_SHORT_EXT 1
1081 				 * for non-posix file systems which
1082 				 * permit only a limited number of characters
1083 				 * after a dot in a filename.
1084 				 * Defining M_SHORT_EXT will limit filenames
1085 				 * to 3 characters after the dot.
1086 				 * For example, y.output will become y.out
1087 				 * <mks.h> will default to undefined.
1088 				 */
1089 
1090 /*
1091  * customizations for ps field specifiers and widths
1092  * This will vary from system to system depending on the max size
1093  * of the values in the different fields
1094  * The following are UNIX (e.g SYSV and BSD) std defaults
1095  */
1096 #define M_PS_FFMT	{ m_textstr(4865, "ruser=UID", "I"),\
1097 			 m_textstr(4866, "pid,ppid,pcpu=C", "I"),\
1098 			 m_textstr(4861, "stime,tty=TTY", "I"), "atime,args",\
1099 			 NULL };
1100 #define M_PS_JFMT	{ m_textstr(4867, "pid,sid,pgid=PGRP", "I"),\
1101 			  m_textstr(4862, "tty=TTY", "I"), "atime,args", NULL };
1102 #define M_PS_LFMT	{ m_textstr(4868, "flags,state,ruid=UID", "I"),\
1103 			 m_textstr(4866, "pid,ppid,pcpu=C", "I"),\
1104 			 m_textstr(4869, "pri,nice,addr,vsz=SZ", "I"),\
1105 			 m_textstr(4870, "wchan,tty=TTY", "I"),\
1106 			 m_textstr(4863, "atime,comm=COMD", "I"), NULL };
1107 #define M_PS_DEFFMT	{ m_textstr(4864, "pid,tty=TTY", "I"), "atime,comm",\
1108 			 NULL };
1109 #define M_PS_PID_WIDTH  5
1110 #define M_PS_XPID_WIDTH 8
1111 #define M_PS_GID_WIDTH  5
1112 #define M_PS_UID_WIDTH  5
1113 #define M_PS_TTY_WIDTH  7
1114 /*
1115  * The syntax for specifying and displaying terminal names in ps and who
1116  * is required to be the same.
1117  * Since who gets the names from the utmp file, the ps utility
1118  * (and the m_psread() function) needs to know what format these terminal
1119  * names are presented in the utmp file.
1120  * It would appear that all systems have devices in the /dev/ file system
1121  * and that terminal names are displayed as the name rooted from "/dev".
1122  * Since ttyname() returns a full pathname, we can just strip
1123  * off the "/dev/" prefix and we will get the correct name.
1124  *
1125  * The ps utility uses ttyname() to get the name of the controlling terminal.
1126  * M_PS_TTY_PREFIX_TOSTRIP is a prefix string that must be removed from
1127  * the name that ttyname() returns in order to match the name returned
1128  * by m_psread().
1129  * If no prefix is to be removed, then a zero length string ("") should be used
1130  */
1131 #define M_PS_TTY_PREFIX_TOSTRIP "/dev/"
1132 
1133 
1134 #define M_LOCALE_NLS_DIR        "/usr/lib"
1135 			/* Define this if you have a system that
1136 			 * implements the MKS rootname() function
1137 			 * (e.g not a no-op)
1138 			 * and you want to specify the absolute
1139 			 * pathname to the NLS directory
1140 			 * which is independent of semantics of rootname().
1141 			 * Depending on the implementation of rootname(),
1142 			 * it may prefix the path with $ROOTDIR environment
1143 			 * variable or it may return a path relative to
1144 			 * the know location of where the product has
1145 			 * been installed (or maybe something else!)
1146 			 *
1147 			 * If this is not defined, then locale will
1148 			 * call confstr(_CS_NLSDIR), which in turn calls
1149 			 * rootname(M_NLSDIR), and you get this resultant
1150 			 * pathname.
1151 			 *
1152 			 * Thus, if you want locale to look in the system native
1153 			 * nls directory, then define this.
1154 			 * Otherwise, it will probably look in a user
1155 			 * specified directory, or the product installation
1156 			 * directory.
1157 			 */
1158 
1159 
1160 /* Cron configuration options:
1161  * M_CRON_USESFIFO	define this (to 1) if your cron is implemented
1162  *			using a FIFO (normally found in /usr/lib/cron/FIFO)
1163  *			to accept communication from the at/batch/crontab
1164  *			utilities when notifying cron of changes to the
1165  *			at/batch queues or the user crontabs.
1166  *			If this is not defined, then cron will expect
1167  *			a signal (SIGUSR) from at/batch/crontab to indicate
1168  *			a change in the at/batch queues or the crontabs
1169  *
1170  * M_CRONVARS_DEFINED	define this if you define the pathnames below.
1171  *		        If you don't define this, then the pathnames that cron
1172  *                      uses is defined in src/cron/cronvars.c.
1173  *			(e.g it uses the rootname() and the M_SPOOLDIR,
1174  *                           M_LIBDIR macros )
1175  *
1176  *			This can be used to override cronvars.c definitions
1177  *			This is useful on systems that you don't want to
1178  *			use MKS's cron daemon and thus, you have to define
1179  *			the directories/files where the system cron expects
1180  *			things.
1181  */
1182 #undef M_CRON_USESFIFO
1183 
1184 #undef M_CRONVARS_DEFINED
1185 
1186 /* the following M_CRON_* macros necessary only
1187  * if M_CRONVARS_DEFINED is defined above
1188  */
1189 #undef M_CRON_SPOOLDIR		/* usually /usr/spool/cron */
1190 #undef M_CRON_LIBDIR		/* usually /usr/lib/cron */
1191 #undef M_CRON_CRONTABSDIR	/* usually /usr/spool/cron/crontabs */
1192 #undef M_CRON_ATJOBSDIR		/* usually /usr/spool/cron/atjobs */
1193 #undef M_CRON_LOGFILE		/* usually /usr/lib/cron/log */
1194 #undef M_CRON_PIDFILE		/* usually /usr/lib/cron/pid */
1195 #undef M_CRON_QUEUEDEFSFILE	/* usually /usr/lib/cron/queuedefs */
1196 #undef M_CRON_FIFOFILE		/* usually /usr/lib/cron/FIFO */
1197 				/* FIFOFILE only necessary if M_CRON_USESFIFO
1198 				 * is defined
1199 				 */
1200 /*
1201  * M_CRON_MAILER:
1202  *     This is a string that specifies a utility names
1203  *     or a shell filter (e.g pipeline) that gets executed by the
1204  *     cron daemon to deliver mail messages.
1205  *     If this is NOT defined here, the the default case is used (see <mks.h>)
1206  *
1207  * Default case:
1208  *     #define M_CRON_MAILER   "sed -e s/^~/~~/ | mailx "
1209  *
1210  * Assumes only POSIX.2 mailx is available.
1211  * Must be careful when cron sends output to mailx.
1212  * We must ensure that lines with leading '~' are escaped
1213  * so mailx doesn't interpret these lines
1214  * This string MUST include a trailing space character.
1215  */
1216 #define M_CRON_MAILER   "sed -e s/^~/~~/ | mailx "
1217 
1218 
1219 /*
1220  * Defining M_SYSTEM_TMPDIR indicates that a system global
1221  * temporary directory should be used on this system.
1222  * This will override M_TMPDIR, and any calls to rootname(M_TMPDIR)
1223  * which is relative to the product installation directory
1224  */
1225 #define M_SYSTEM_TMPDIR  "/tmp"
1226 
1227 /*
1228  * ex/vi's recover command (and the program of the same name)
1229  * requires a directory in which to store any preserved tmp files.
1230  * Normally these are stored in rootname(M_ETCDIR(recover))
1231  * which is becomes a directory name relative to ROOTDIR env variable (on DOS)
1232  * or relative to the product installation directory.
1233  * Defining M_PRESERVEDIR will ensure that this directory is used
1234  * and calls to rootname() are bypassed.
1235  * (e.g the absolute directory name defined by M_PRESERVEDIR will be used)
1236  */
1237 #define M_PRESERVEDIR    "/var/recover"
1238 
1239 /*
1240  * Defining M_SYSTEM_MAILDIR will cause mailx to use this
1241  * absolute directory name - e.g bypass the call to rootname() so
1242  * it doesn't become relative to product installation directory.
1243  */
1244 #define M_SYSTEM_MAILDIR       "/usr/mail"
1245 
1246 
1247 #undef M_ULIMIT_AVAIL	/* define this if your system provides the SystemV
1248 			 * ulimit() API and the <ulimit.h> header file
1249 			 *
1250 			 * This information is used by 'at' utility
1251 			 */
1252 
1253 /*
1254  * Shell configuration options.
1255  * NOTE: If not defined here, then there may be
1256  * a default defined in src/sh/sh.h; NOT <mks.h>.
1257  *
1258  * You must configure built-in utilities in sh/sh.mk.
1259  * Currently, test and printf can be built-in.
1260  * If you just compile the shell without -D's,
1261  * you do not get these built-in utilities.
1262  */
1263 #define	M_SH_ULIMIT	0	/* Shell SVR4 ulimit built-in.
1264 				 * Uses getrlimit/setrlimit(2).
1265 				 *
1266 				 * NOTE: This may be defined in mkslocal.mk
1267 				 * along with the build configuration required
1268 				 * for shbltin.c.
1269 				 */
1270 /* M_SH_GETCWD removed, no longer used. default for physical cd/pwd */
1271 #define	M_SH_BGNICE	0	/* Set -o bgnice for interactive shell.
1272 				 */
1273 #define	M_SH_BUILTIN_SEARCH 1	/* Do path search for utility built-ins.
1274 				 * See POSIX.2/D12, section 3.9.1.1.
1275 				 * Currently they are:
1276 				 * [, echo, test, time, printf, pwd.
1277 				 */
1278 #define	M_SH_RSH	0	/* rsh is installed as a link to sh.
1279 				 * Vendor option, not required by any standard.
1280 				 * Not recommended on UNIX.
1281 				 */
1282 #define	M_SH_USER_FDS	10	/* Number of user file descriptors.
1283 				 * The value for [n] in redirection
1284 				 * can be between 0 and M_SH_USER_FDS-1.
1285 				 * Must be >= 10, should be <= OPEN_MAX/2.
1286 				 */
1287 #define	M_SH_LINE_MAX	LINE_MAX /* Shell input line buffer size.
1288 				  */
1289 #undef	M_JOB_CONTROL_OFF	/* Disable job control,
1290 				 * were _POSIX_JOB_CONTROL is defined.
1291 				 */
1292 #undef	M_COPYRIGHT		/* MKS Toolkit.
1293 				 * Print MKS copyright on startup (sh).
1294 				 */
1295 #undef	M_SH_CRITERROR		/* MKS Toolkit.
1296 				 * set -o criterror (DOS, OS/2).
1297 				 */
1298 
1299 #define M_SH_MAX_FUNCTION_EVAL_DEPTH	100
1300 				/* The limit on how deep function
1301 				 * evaluation can go when shell
1302 				 * functions execute shell functions.
1303 				 * This stops the shell from crashing
1304 				 * if an infinitely recursive function
1305 				 * is evaluated.  If the value is 0
1306 				 * then functions can't be executed at
1307 				 * all, if the value is 1 then
1308 				 * functions can't execute other
1309 				 * functions, and so on.  If the macro
1310 				 * M_STKCHK is defined then there will
1311 				 * be no limit and M_STKCHK will be
1312 				 * used to prevent a crash.
1313 				 */
1314 
1315 #undef M_SPAWN			/* This code is prototype code only.  It
1316 				 * has not been tested, and should not be
1317 				 * used.
1318 				 * This code is not supported, except through
1319 				 * special arrangements with MKS.
1320 				 */
1321 
1322 
1323 #define M_EXPR_POSIX	1
1324 				/*
1325 				 * POSIX requires that numbers on the
1326 				 * expr command line always be considered
1327 				 * decimal.  We support octal and hex as
1328 				 * as well.  Defining this will turn that
1329 				 * extension off by default, but it is still
1330 				 * accessible by specifying the new '-W' flag
1331 				 */
1332 
1333 #undef M_RE_SUB_ANCHOR		/* Define this if you wish your baisc regular
1334 				 * expressions to support anchors
1335 				 * (^ and $) inside of subexpressions.
1336 				 * See POSIX.2 section 2.8.3.5.
1337 				 */
1338 
1339 
1340 /*
1341  * In order to get full Posix.2 i18n, then you must either:
1342  *
1343  * i) Use the full mks ansi-c library; mks localedef, mks locale.h file...
1344  * ii) Extend your own ansi-c library to contain the mks specified functions
1345  * as described in the mks Porting and Tuning Guide.
1346  *
1347  * Otherwise, it is not possible to conform to posix .2.
1348  *
1349  * You may still turn on I18N, and get as much internationalization as is
1350  * possible using a standard ANSI-C compiler.
1351  *
1352  * Your options are:
1353  * i)   Full posix conformance. You must have i or ii above, and must define
1354  *      M_I18N and M_I18N_MKS_{FULL,XPG}.
1355  * ii)  I18N at ANSI-C level.  You must define I18N, do not
1356  *      define M_I18N_MKS_{FULL,XPG}.
1357  * iii) No I18N.  Do not define I18N, do not define M_I18N_MKS_{FULL,XPG}. */
1358 #define	I18N	1		/* OBSOLESCENT version of I18N
1359 				 * This should be removed when all occurances
1360 				 * of I18N are removed from the MKS code
1361 				 */
1362 #define	M_I18N	1		/* Do we want internationalized code?  To build
1363 			 	 * a system where everything gets deleted at
1364 				 * compile time via #define's when possible,
1365 				 * this flag should be set.  <mks.h> does not
1366 				 * define I18N, but it is normal to set it.
1367 				 */
1368 #define	M_I18N_MKS_FULL	1	/* Defining this, indicates you are using
1369 				 * MKS i18n extension routines
1370 				 *  (e.g m_collrange(), m_collequiv() ...
1371 				 *       localedtconv, localeldconv() ...)
1372 				 * Defining this to 2 indicates that you
1373 				 * want to use MKS's implementation of these
1374 				 * routines and the implementation of MKS's
1375 				 * format of the locale data files.
1376 				 * Defining this to 1 indicates you don't want
1377 				 * MKS's implementation, and you must write
1378 				 * your own code for m_collrange(), collequiv()
1379 				 * ...
1380 				 *   note: there are some routines like
1381 				 *         localedtconv which can  obtain the
1382 				 *         necessary info from nl_langinfo()
1383 				 *         if this is supported
1384 				 *         See M_I18N_MKS_XPG below
1385 				 */
1386 #define	M_I18N_MKS_XPG	1	/* This is only useful if M_I18N_MKS_FULL == 1.
1387 				 * This flag indicates that nl_langinfo()
1388 				 * is available and can be used to
1389 				 * retrieve some of the locale information.
1390 				 * ( used in localeldconv() and localedtconv()
1391 				 *  routines)
1392 				 */
1393 
1394 #define	M_I18N_M_	1	/* MKS has defined some additions i18n API's.
1395 				 * (e.g m_collequiv, m_collrange ...)
1396 				 * This flag indicates that these API's start
1397 				 * with "m_".
1398 				 * It is the MKS intention that if these
1399 				 * extentions get approved/standardized
1400 				 * (by POSIX or ANSI or ...)
1401 				 * all code will have  the m_ removed.
1402 				 * Since it is not yet approved,
1403 				 * we are maintaining the mks conventions of
1404 				 * prefixing our private libraries with m_.
1405 				 * If you have chosen to implement these
1406 				 * routines without the m_ do not define
1407 				 * M_I18N_M_
1408 				 */
1409 
1410 #define M_I18N_MB	1	/* Define if multibyte character support
1411 				 * is required.
1412 				 */
1413 
1414 #define  M_LOCALEINFO_IN_DIRECTORY  1
1415 				/* This macro indicates if the locale
1416 				 * information is stored in a directory,
1417 				 * or in a file.
1418 				 * For instance, many systems use
1419 				 *   /usr/lib/locale
1420 				 * as a directory to store all their locale
1421 				 * information.
1422 				 * In this directory is stored the info
1423 				 * for each supported locale.
1424 				 * (e.g POSIX, C, en_US, fr, ...)
1425 				 * It is assumed that there is one entry here
1426 				 * for each supported locale.
1427 				 * If these entries are sub-directories,
1428 				 * then this macro is defined.
1429 				 * If these entries are files, then do not
1430 				 * define this macro.
1431 				 */
1432 
1433 #undef M_I18N_LOCKING_SHIFT	/* Define if any multibyte character sets
1434 				 * used are locking-shift character sets.
1435 				 */
1436 
1437 
1438 #undef M_VARIANTS		/* This can be defined on EBCDIC systems
1439 				 * where the POSIX.2 portable characters are not
1440 				 * invariant across all the code pages
1441 				 * supported.
1442 				 * By defineing this, user is allowed
1443 				 * to define the encodings
1444 				 * for these characters as they switch between
1445 				 * the various code pages by setting up
1446 				 * the VARIANTS environment variable..
1447 				 * so that the various utilities will cope
1448 				 * with the different encodings gracefully.
1449 				 */
1450 				 /* Source code hints:
1451 				  * if you define this, you will need
1452 				  *    h/variant.h, h/m_invari.h
1453 				  *    libc/mks/getsyntx.c,
1454 				  *    libc/mks/m_varian.c
1455 				  *
1456 				  * If this is not defined, then all you need
1457 				  * is
1458 				  *    h/m_invar.h
1459 				  */
1460 
1461 /*
1462  * Define the following if you want the corresponding posix define with
1463  * a single leading underscore
1464  */
1465 #define	__POSIX_JOB_CONTROL	_POSIX_JOB_CONTROL
1466 #define	__POSIX_SAVED_IDS	_POSIX_SAVED_IDS
1467 #define	__POSIX_NO_TRUNC	(-1)
1468 #define	__POSIX_VDISABLE	0xff
1469 
1470 /*
1471  * On some systems where code size and performance are problems, it
1472  * may be desirable to use a simplified version of the m_loxclose() routine
1473  * in programs that don't require the full functionality. If this is the
1474  * case and routine m_loxqclose() has been provided, define the following
1475  * macro. (Refer to the Library/eXecutable/Object interface documentation
1476  * for more information.
1477  */
1478 #undef M_LOXQCLOSE
1479 
1480 /*
1481  * some systems require overrides after <mks.h> is read.
1482  * If your system requires this, define M_MKSEXTRA_H here
1483  * so that the "#include <mksextra.h>" is exposed in <mks.h>
1484  */
1485 #undef M_MKSEXTRA_H
1486 
1487 /*
1488  * mailx configuration
1489  */
1490 
1491 /*
1492  * Many mail systems support the non-standard "Content-Length" header
1493  * which contains the length of the body of the message (not including
1494  * the headers) in bytes.  Defining M_MAILX_CONTENT_LENGTH_ENABLE will
1495  * turn on code in mailx to generate this header when mail is sent and
1496  * honour it when scanning mailboxes.
1497  */
1498 #undef M_MAILX_CONTENT_LENGHT_ENABLE
1499 
1500 #endif /* 0. not required for POSIX systems; here for documentation only */
1501 
1502 
1503 #define	halloc(n,s)	malloc((size_t)((n)*(s)))/* alloc big chunk of mem*/
1504 #define	hfree(ptr)	free(ptr)		/* free big chunk of mem */
1505 #define m_cp(src, dest, ssb, flags)	(M_CP_NOOP)
1506 #define	rootname(fn)	fn			/* make relative to root */
1507 
1508 
1509 /*
1510  * MKS makes use of types that may or may not already be defined in the
1511  * system <sys/types.h> file.  If not defined, then they must be defined
1512  * here.  (The problem is a lack of #if directive to determine an existing
1513  * typedef.
1514  */
1515 typedef unsigned char	uchar;
1516 typedef	unsigned short	ushort;
1517 typedef unsigned int	uint;
1518 typedef unsigned long	ulong;
1519 
1520 /*
1521  * Define any Optional Facility Configuration Values here.
1522  * See POSIX.2, 2.13.2, Table 2-18
1523  * We define them here as M_ entries; this allows unistd.h to test the
1524  * M_ variable, and if defined, define the official _POSIX2_ variable.
1525  * **Note: It isn't permitted for a real conforming unistd.h to #include <mks.h>
1526  * due to name space contamination problems.  A real, conforming implementation
1527  * will manually modify their unistd.h to define the _POSIX2 variables
1528  * appropriately.
1529  */
1530 #define	M_POSIX2_C_BIND		1
1531 #define	M_POSIX2_C_DEV		1
1532 #undef	M_POSIX2_FORT_DEV
1533 #undef	M_POSIX2_FORT_RUN
1534 #define	M_POSIX2_LOCALEDEF	1
1535 #define	M_POSIX2_SW_DEV		1
1536 
1537 /*
1538  * New definitions for I/PSU 3.3
1539  */
1540 
1541 #undef M_POSIX_PFNCS_ONLY	/* define this to be true if the implementation
1542 				 * only supports the portable filename
1543 				 * set as defined in POSIX.1
1544 				 */
1545 
1546 #undef M_NO_STIME		/* set this define to be true if the system
1547 				 * does not support the stime() API.
1548 				 */
1549 
1550 #undef M_TTYSTREAM		/* if it isn't possible to open a new console
1551 				 * stream through device names, define this
1552 				 * macro to be true. The support library must
1553 				 * define a routine "m_ttystream()" that can
1554 				 * return the required stream.
1555 				 */
1556 
1557 #undef M_NOT_ROOT		/* this should be defined to be the name of a
1558 				 * library routine that returns true if the
1559 				 * process has appropriate privileges
1560 				 */
1561 
1562 #undef M_NO_VI_KEYPAD		/* this should be defined when the system
1563 				 * can't support keypad and cursor-key
1564 				 * functions in vi.
1565 				 */
1566 
1567 #undef M_USERID_FMT		/* format string for printing out the user
1568 				 * name. It is "%-8.8s" by default.
1569 				 */
1570 
1571 #undef M_USE_M_CP		/* indicates that code is to use the m_cp()
1572 				 * interface.
1573 				 * (Note - this API is not fully supported
1574 				 *  in the IPSU.3.X development line.  Full
1575 				 *  support will be available in a future
1576 				 *  major release.)
1577 				 */
1578 
1579 #undef M_GUESS_FILE_TYPE	/* If the system provides alternative
1580 				 * mechanisms for determining the type of a
1581 				 * file, define this macro to true.  If you are
1582 				 * using this feature, you must provide a new
1583 				 * function int m_guess_file_type(char *name);
1584 				 * Returns true if type of file name is
1585 				 * successfully identified.
1586 				 * (Note - this API is not fully supported in
1587 				 *  the IPSU.3.X development line.  Full
1588 				 *  support will be available in a future
1589 				 *  major release.)
1590 				 */
1591 
1592 #undef M_INCR_NICE		/* default nice incr, if this macro is not
1593 				 * defined a builtin default will be used
1594 				 * (see the source for nice for more details.)
1595 				 */
1596 
1597 #undef M_INCR_RENICE		/* default renice incr, if this macro is
1598 				 * not defined a builtin default will be
1599 				 * used (see the source for renice for more
1600 				 * details.)
1601 				 */
1602 
1603 #undef M_PS_COMM_WIDTH		/* width of command field printed by PS */
1604 
1605 #undef M_PS_USER_WIDTH		/* width of user and ruser fields printed by
1606 				 * PS
1607 				 */
1608 
1609 #undef M_PS_PRI_WIDTH		/* width of PRI field printed by PS */
1610 
1611 #undef M_UT_TIME_STRING		/* true if utmp ut_time struct is a string
1612 				 * instead of a number.
1613 				 */
1614 
1615 #undef M_SH_ENTRY1
1616 #undef M_SH_ENTRY2
1617 #undef M_SH_ENTRY3
1618 				/* The above 3 macros are provide in the
1619 				 * shell to allow system-specific extensions
1620 				 * to be added.
1621 				 * (Note - this API is not fully supported in
1622 				 * the IPSU.3.X development line.  Full
1623 				 * support will be available in a future
1624 				 * major release.)
1625 				 */
1626 
1627 #undef M_NO_CANONICAL_MODE	/* set this macro to true if the system
1628 				 * doesn't support tty buffering in
1629 				 * canonical mode.
1630 				 */
1631 
1632 #undef M_NO_PASSWD_SCAN		/* true if system doesn't provide a
1633 				 * mechanism for scanning a list of all
1634 				 * users on the system.
1635 				 */
1636 
1637 #define M_GROUP_PASSWD(grp)	""
1638 	/* prototype:
1639 	 *         char *M_GROUP_PASSWD(struct group *grp)
1640 	 * This api returns a pointer to a string
1641 	 * that contains the password for group 'grp'.
1642 	 * If no password is available, then an empty string should be
1643 	 * returned.
1644 	 *
1645 	 * On historical UNIX systems, group passwords are found in
1646 	 * the gr_passwd member in struct group.
1647 	 * Thus, this macro should be defined as
1648 	 *    #define M_GROUP_PASSWD(grp)	grp->gr_passwd
1649 	 *
1650 	 * On systems that do not provide group passwords,
1651 	 * then macro can be defined as an empty string:
1652 	 *    #define M_GROUP_PASSWD(grp)	""
1653 	 *
1654 	 */
1655 
1656 
1657 #undef M_RCS_NORCSLIB 	/* Set this macro to true in order
1658 			 * remove rcslib dependency of utilities
1659 			 * such as ident.
1660 			 */
1661 
1662 #undef M_CHMOD_LINK	/* Set this macro to true if the system is
1663 			 * able to perform a chmod() of a link as
1664 			 * opposed to following the link.
1665 			 */
1666 /*
1667  * Include any system-specific prototypes here
1668  */
1669 
1670 /*
1671  * Include any #define's to avoid name clashes with namespace polluting
1672  * operating system routines
1673  *
1674  * e.g.: #define openfile MKSopenfile
1675  */
1676 
1677