/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* MKS header file. Defines that make programming easier for us.
* Includes MKS-specific things and posix routines.
*
* Copyright 1985, 1993 by Mortice Kern Systems Inc. All rights reserved.
*
*/
#ifndef __M_MKS_H__
#define __M_MKS_H__
/*
* This should be a feature test macro defined in the Makefile or
* cc command line.
*/
#ifndef MKS
#endif
/*
* Write function declarations as follows:
* extern char *function ANSI((char *cp, int flags, NODE *np));
* Expansion of this happens only when __STDC__ is set.
*/
#ifdef __STDC__
#define ANSI(x) x
#else
#define const
#define signed
#define volatile
#define ANSI(x) ()
#endif
#ifndef STATIC
#endif /*STATIC*/
#ifndef STATREF
# ifdef __STDC__
# define STATREF static
# else
# endif
#endif /*STATREF*/
typedef void (*_sigfun_t)(int);
#include <mkslocal.h>
#include <stdio.h>
#include <unistd.h>
#include <limits.h>
#include <m_wchar.h>
#include <m_i18n.h>
#include <m_invari.h>
#include <termios.h>
#endif
#ifndef M_LIBDIR
# error "You must define M_LIBDIR in mkslocal.h"
#endif
#ifndef M_ETCDIR
# error "You must define M_ETCDIR in mkslocal.h"
#endif
#ifndef M_SPOOLDIR
# error "You must define M_SPOOLDIR in mkslocal.h"
#endif
#ifndef M_MANPATH
# error "You must define M_MANPATH in mkslocal.h"
#endif
# error "You must define M_NLSDIR in mkslocal.h"
#endif
#endif
* Could be in <stdio.h>. But in case it is not ..
*/
#ifndef P_tmpdir
# ifndef M_TMPDIR
# endif
#endif /* P_tmpdir */
/* L_cuserid - used by cuserid.c
* Could be in <stdio.h>. But in case it is not ..
*/
#ifndef L_cuserid
# ifndef M_L_CUSERID
# endif
#endif /* L_cuserid */
#ifdef M_AUDIT
# error "With M_AUDIT set, you must define M_AUDITW1 and M_AUDITW2"
#endif
#endif /*M_AUDIT*/
#ifndef M_CS_PATH
# error "You must define M_CS_PATH in mkslocal.h"
#endif
#ifndef M_CS_SHELL
# error "You must define M_CS_SHELL in mkslocal.h"
#endif
#ifndef M_SH_USER_FDS
/*
* default number of user file descriptors to be used in the shell
* Must be >= 10, should be <= OPEN_MAX/2.
*/
#endif /*M_SH_USER_FDS*/
#ifndef M_SH_MAX_FUNCTION_EVAL_DEPTH
#endif
#ifndef M_MANPAGER
#endif
/* set up alert and verticalTab characters - This assumes an ANSI-C compiler */
#ifndef M_ESCAPE
#endif /*M_ESCAPE*/
#ifndef SETVBUF
/* if SETVBUF not previously defined, then use default ANSI-C definition */
#endif
#ifdef M_NULL
/* if M_NULL defined in <mkslocal.h> then want to redefine NULL */
#endif /*M_NULL*/
/*
*/
#ifndef S_IRALL
#endif
#ifndef S_IWALL
#endif
#ifndef S_IXALL
#endif
#ifndef M_DEFMODE /* Default directory creation mode */
#endif
#ifndef M_DIRMODE
#endif
#ifndef M_FLDSEP
#endif
#ifndef M_TTYNAME
#endif
#ifndef M_NULLNAME
#endif
#ifndef M_FSDELIM
#endif
#ifndef M_DRDELIM
#define M_DRDELIM(c) (0)
#endif
#ifndef M_DIRSTAT
#endif
#ifndef M_HIDDEN
#endif
#ifndef M_FSMOUNT /* for use by setmnt routine */
#endif
#ifndef M_FSALL /* for use by setmnt routine */
#endif
#ifndef M_NLSCHARMAP /* Default charmap file for localedef */
#endif
#ifndef M_POSIXPATH /* used when I18N undefined, default posix path */
#endif
#ifndef M_ISEOV
#endif
#ifndef M_IS_NATIVE_LOCALE
#endif
#ifndef M_FSCLOSE
#endif
#ifndef ROOTUID /* default superuser uid = 0 */
#define ROOTUID 0
#endif
#ifndef ROOTGID /* default superuser gid = 0 */
#define ROOTGID 0
#endif
#ifndef M_GROUP_PASSWD
#endif
#ifndef M_NUMSIZE
/*
* define the expected max length of a printed number. (used in awk)
* This should be the longest expected size for any type of number
* ie. float, long etc.
* This number is used to calculate the approximate
* number of bytes needed to hold the number.
*/
#endif /* M_NUMSIZE */
/*
* VARARG[12345]: declare variadic functions.
* Expands to either a standard C prototype or a K&R declaration.
* For example:
*
* #include <stdarg.h>
* int
* fprintf VARARG2(FILE*, fp, char*, fmt)
* {
* va_list ap;
*
* va_start(ap, fmt);
* cp = va_arg(ap, char*);
* va_end(ap);
* }
*/
#ifndef VARARG1
#ifdef __STDC__
#else
#endif
#endif
/*
* MKS-specific library entry points.
*/
extern char *_cmdname;
#if M_STTY_CC
#endif
LEXTERN char *m_readmode (const char *);
LEXTERN char *m_readunum (unsigned long *, char *, char **, int);
LEXTERN int m_incrnice (int, unsigned int, int);
LEXTERN char *m_mountdir (const char *);
/* __m_system() : alternate interface into system() */
LEXTERN int __m_system (const char *, const char *, const char *);
/* conversion routines - between single byte and UNICODE (wide) strings.
* These return a pointer to malloc'd memory.
* It is the caller's responsiblity to free() it, if necessary
* These are for use primarily on NT
*/
extern char *m_unicodetosb(const wchar_t*);
extern wchar_t *m_sbtounicode(const char*);
/*
* things that could go into an "m_stdio.h"
*/
/* m_unlink() : alternate unlink() for use with vendor-provided
* libraries that do not have a satisfactory unlink() */
#ifndef M_UNLINK
#endif
/* __m_popen() : alternate interface into popen() */
const char *, const char *);
char const * const *args);
#if M_TFGETC
#else
#endif
/* m_fsopen() - special routine for curses */
#ifndef M_FFLUSH_NOT_POSIX_1
#else
#endif
/* m_fgets return values */
enum {
* Regular EOF (same as NULL from fgets).
* Buffer is *untouched*.
*/
* Short input (buf[strlen(buf)-1] != '\n')
* This is a trailing line, without a newline at the
* end of the file. The buffer is valid, ending in
* a \0, with no newline. The case of terminal input
* ending with an EOF in the middle of the line will
* restart -- typing two EOF's will result in this
* case.
*/
* Line too long: newline not found within len bytes
* (buf[len-1] != '\n').
* At this point, while((c=getc(fp)) != '\n') ...
* is a valid method to get the rest of the line.
*/
* Input contained an invalid character (e.g. \0)
* Buffer contents *undefined*.
*/
* A system call returned an error, errno is set.
* Buffer contents *undefined*.
*/
};
/*
* end of things that could go into an "m_stdio.h"
*/
/* m_ctype: generic character classification */
#ifndef M_READDATE_SYSV
#define M_READDATE_SYSV 0
#endif
#ifndef M_READDATE_BSD
#endif
#ifdef M_MALLOC
#else
#endif /*M_MALLOC*/
#ifdef M_REALLOC
#else
#endif /*M_MALLOC*/
#ifdef NAME_MAX
#else
#endif /*NAME_MAX*/
#ifdef PATH_MAX
#else
#endif /* PATH_MAX */
#ifdef M_DEVBIN
#else
#endif /*M_DEVBIN*/
#ifndef m_setbinary
#endif /*m_setbinary*/
#ifndef M_PRIO_PROCESS
#define M_PRIO_PROCESS 0
#endif
#ifndef M_PRIO_PGRP
#endif
#ifndef M_PRIO_USER
#endif
/* m_wallow type values */
#ifndef MWA_NO
#endif
#ifndef MWA_YES
#endif
#ifndef MWA_TEST
#endif
/* Interface for compression (m_cm_*) and decompression (m_dc_*) */
LEXTERN int m_cm_close (int);
LEXTERN char *m_cm_error (void);
LEXTERN int m_dc_close (int);
LEXTERN char *m_dc_error (void);
LEXTERN int m_mkpardir (char *);
/*
* Some UNIX routines that aren't in SVID
*/
/* Some dos routines we sometimes want from posix utilities */
#ifndef M_SETENV
#endif
#ifdef M_NON_STATIC_GETENV
#else
#endif
#ifndef M_CRON_MAILER
/*
* Default case: assume only POSIX.2 mailx is available.
* Must be careful when cron sends output to mailx.
* We must ensure that lines with leading '~' are escaped
* so mailx doesn't interpret these lines
* This string MUST include a trailing space character.
*/
#endif
/*
* m_cp() - copy a file in an O/S specific way. See m_cp.3
* for details
*/
/* Return codes */
/* processing flags */
/*
* MKS MEMORY MANIPULATIONS:
* Specific to MKS and non-portable.
*/
#ifdef M_LDATA
#else
/* for machines with small data models (e.g PC's - DOS, OS2) */
#endif /* M_LDATA */
/* mks error handling routines */
#include <stdarg.h>
/*
* The filesystem type and attribute routine
*/
#ifndef M_FSTYPE
#endif
/* File system types */
#define M_FSTYPE_POSIX 0
/* File system attributes */
/* This one should be ifdef'ed on something else */
#ifndef M_FNMATCH_DUALCASE
#endif
/*
* m_tempname() generates a filename for a temp file using "code"
* in the name.
*/
#ifndef M_TEMPNAME
#else
char *m_tempname(char const *code);
#endif
/*
* __m_getopt() alternate "stateless" entry into getopt().
*/
struct getopt_state {
#ifdef M_I18N_MB
#endif
};
struct getopt_state *state);
#ifdef M_MKSEXTRA_H
/* Any overrides etcetera for a particular system can go in here */
#include <mksextra.h>
#endif /* M_MKSEXTRA_H */
#endif /* __M_MKS_H__ */