17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*2b395c3cSAndy Fiddaman * 26*2b395c3cSAndy Fiddaman * Copyright 2014 Garrett D'Amore <garrett@damore.org> 277c478bd9Sstevel@tonic-gate */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate /* 307c478bd9Sstevel@tonic-gate * MKS header file. Defines that make programming easier for us. 317c478bd9Sstevel@tonic-gate * Includes MKS-specific things and posix routines. 327c478bd9Sstevel@tonic-gate * 337c478bd9Sstevel@tonic-gate * Copyright 1985, 1993 by Mortice Kern Systems Inc. All rights reserved. 347c478bd9Sstevel@tonic-gate * 357c478bd9Sstevel@tonic-gate * $Header: /rd/h/rcs/mks.h 1.233 1995/09/28 19:45:19 mark Exp $ 367c478bd9Sstevel@tonic-gate */ 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #ifndef __M_MKS_H__ 397c478bd9Sstevel@tonic-gate #define __M_MKS_H__ 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * This should be a feature test macro defined in the Makefile or 437c478bd9Sstevel@tonic-gate * cc command line. 447c478bd9Sstevel@tonic-gate */ 457c478bd9Sstevel@tonic-gate #ifndef MKS 467c478bd9Sstevel@tonic-gate #define MKS 1 477c478bd9Sstevel@tonic-gate #endif 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate /* 507c478bd9Sstevel@tonic-gate * Write function declarations as follows: 517c478bd9Sstevel@tonic-gate * extern char *function ANSI((char *cp, int flags, NODE *np)); 527c478bd9Sstevel@tonic-gate * Expansion of this happens only when __STDC__ is set. 537c478bd9Sstevel@tonic-gate */ 547c478bd9Sstevel@tonic-gate #ifdef __STDC__ 557c478bd9Sstevel@tonic-gate #define ANSI(x) x 567c478bd9Sstevel@tonic-gate #define _VOID void /* Used in VOID *malloc() */ 577c478bd9Sstevel@tonic-gate #else 587c478bd9Sstevel@tonic-gate #define const 597c478bd9Sstevel@tonic-gate #define signed 607c478bd9Sstevel@tonic-gate #define volatile 617c478bd9Sstevel@tonic-gate #define ANSI(x) () 627c478bd9Sstevel@tonic-gate #define _VOID char /* Used in _VOID *malloc() */ 637c478bd9Sstevel@tonic-gate #endif 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate #ifndef STATIC 667c478bd9Sstevel@tonic-gate # define STATIC static /* Used for function definition */ 677c478bd9Sstevel@tonic-gate #endif /*STATIC*/ 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate #ifndef STATREF 707c478bd9Sstevel@tonic-gate # ifdef __STDC__ 717c478bd9Sstevel@tonic-gate # define STATREF static 727c478bd9Sstevel@tonic-gate # else 737c478bd9Sstevel@tonic-gate # define STATREF /* Used in local function forward declaration */ 747c478bd9Sstevel@tonic-gate # endif 757c478bd9Sstevel@tonic-gate #endif /*STATREF*/ 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate #define LEXTERN extern /* Library external reference */ 787c478bd9Sstevel@tonic-gate #define LDEFN /* Define Loadable library entry */ 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate typedef void (*_sigfun_t)(int); 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate #include <mkslocal.h> 837c478bd9Sstevel@tonic-gate #include <stdio.h> 847c478bd9Sstevel@tonic-gate #include <unistd.h> 857c478bd9Sstevel@tonic-gate #include <limits.h> 867c478bd9Sstevel@tonic-gate #include <sys/stat.h> /* required for m_samefile() prototype. */ 877c478bd9Sstevel@tonic-gate #include <m_wchar.h> 887c478bd9Sstevel@tonic-gate #include <m_i18n.h> 897c478bd9Sstevel@tonic-gate #include <m_invari.h> 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate #if M_TFGETC || M_STTY_CC 927c478bd9Sstevel@tonic-gate #include <termios.h> 937c478bd9Sstevel@tonic-gate #endif 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate #ifndef M_LIBDIR 967c478bd9Sstevel@tonic-gate # error "You must define M_LIBDIR in mkslocal.h" 977c478bd9Sstevel@tonic-gate #endif 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate #ifndef M_ETCDIR 1007c478bd9Sstevel@tonic-gate # error "You must define M_ETCDIR in mkslocal.h" 1017c478bd9Sstevel@tonic-gate #endif 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #ifndef M_SPOOLDIR 1047c478bd9Sstevel@tonic-gate # error "You must define M_SPOOLDIR in mkslocal.h" 1057c478bd9Sstevel@tonic-gate #endif 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate #ifndef M_MANPATH 1087c478bd9Sstevel@tonic-gate # error "You must define M_MANPATH in mkslocal.h" 1097c478bd9Sstevel@tonic-gate #endif 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate #if defined(I18N) && !defined(M_NLSDIR) 1127c478bd9Sstevel@tonic-gate # error "You must define M_NLSDIR in mkslocal.h" 1137c478bd9Sstevel@tonic-gate #endif 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate #if (defined(M_I18N_MKS_FULL) || defined(M_I18N_MKS_XPG)) && !defined(I18N) 1167c478bd9Sstevel@tonic-gate # error I18N must be defined 1177c478bd9Sstevel@tonic-gate #endif 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate /* P_tmpdir - used by tmpnam.c and tempnam.c. 1207c478bd9Sstevel@tonic-gate * Could be in <stdio.h>. But in case it is not .. 1217c478bd9Sstevel@tonic-gate */ 1227c478bd9Sstevel@tonic-gate #ifndef P_tmpdir 1237c478bd9Sstevel@tonic-gate # ifndef M_TMPDIR 1241da57d55SToomas Soome # error M_TMPDIR must be defined in mkslocal.h 1257c478bd9Sstevel@tonic-gate # endif 1267c478bd9Sstevel@tonic-gate # define P_tmpdir M_TMPDIR 1277c478bd9Sstevel@tonic-gate #endif /* P_tmpdir */ 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate /* L_cuserid - used by cuserid.c 1307c478bd9Sstevel@tonic-gate * Could be in <stdio.h>. But in case it is not .. 1317c478bd9Sstevel@tonic-gate */ 1327c478bd9Sstevel@tonic-gate #ifndef L_cuserid 1337c478bd9Sstevel@tonic-gate # ifndef M_L_CUSERID 1341da57d55SToomas Soome # error M_L_CUSERID must be defined in mkslocal.h 1357c478bd9Sstevel@tonic-gate # endif 1367c478bd9Sstevel@tonic-gate # define L_cuserid M_L_CUSERID 1377c478bd9Sstevel@tonic-gate #endif /* L_cuserid */ 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate #ifdef M_AUDIT 1407c478bd9Sstevel@tonic-gate LEXTERN char *m_audmode (int, int); 1417c478bd9Sstevel@tonic-gate #if !defined(M_AUDITW1) || !defined(M_AUDITW2) 1427c478bd9Sstevel@tonic-gate # error "With M_AUDIT set, you must define M_AUDITW1 and M_AUDITW2" 1437c478bd9Sstevel@tonic-gate #endif 1447c478bd9Sstevel@tonic-gate #endif /*M_AUDIT*/ 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate #ifndef M_CS_PATH 1477c478bd9Sstevel@tonic-gate # error "You must define M_CS_PATH in mkslocal.h" 1487c478bd9Sstevel@tonic-gate #endif 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gate #ifndef M_CS_SHELL 1517c478bd9Sstevel@tonic-gate # error "You must define M_CS_SHELL in mkslocal.h" 1527c478bd9Sstevel@tonic-gate #endif 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate #ifndef M_SH_USER_FDS 1557c478bd9Sstevel@tonic-gate /* 1567c478bd9Sstevel@tonic-gate * default number of user file descriptors to be used in the shell 1577c478bd9Sstevel@tonic-gate * Must be >= 10, should be <= OPEN_MAX/2. 1587c478bd9Sstevel@tonic-gate */ 1597c478bd9Sstevel@tonic-gate #define M_SH_USER_FDS 10 1607c478bd9Sstevel@tonic-gate #endif /*M_SH_USER_FDS*/ 1617c478bd9Sstevel@tonic-gate 1627c478bd9Sstevel@tonic-gate #ifndef M_SH_MAX_FUNCTION_EVAL_DEPTH 1637c478bd9Sstevel@tonic-gate #define M_SH_MAX_FUNCTION_EVAL_DEPTH 100 1641da57d55SToomas Soome #endif 1657c478bd9Sstevel@tonic-gate 1667c478bd9Sstevel@tonic-gate #ifndef M_MANPAGER 1677c478bd9Sstevel@tonic-gate #define M_MANPAGER "more -A -s" 1687c478bd9Sstevel@tonic-gate #endif 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate /* set up alert and verticalTab characters - This assumes an ANSI-C compiler */ 1717c478bd9Sstevel@tonic-gate #undef M_ALERT 1727c478bd9Sstevel@tonic-gate #undef M_VTAB 1737c478bd9Sstevel@tonic-gate #define M_ALERT '\a' 1747c478bd9Sstevel@tonic-gate #define M_VTAB '\v' 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate #ifndef M_ESCAPE 1777c478bd9Sstevel@tonic-gate # define M_ESCAPE '\033' /* default to ASCII code for <ESC> */ 1787c478bd9Sstevel@tonic-gate #endif /*M_ESCAPE*/ 1797c478bd9Sstevel@tonic-gate 1801da57d55SToomas Soome #ifndef SETVBUF 1817c478bd9Sstevel@tonic-gate /* if SETVBUF not previously defined, then use default ANSI-C definition */ 1827c478bd9Sstevel@tonic-gate # define SETVBUF setvbuf 1837c478bd9Sstevel@tonic-gate #endif 1847c478bd9Sstevel@tonic-gate 1857c478bd9Sstevel@tonic-gate #ifdef M_NULL 1867c478bd9Sstevel@tonic-gate /* if M_NULL defined in <mkslocal.h> then want to redefine NULL */ 1877c478bd9Sstevel@tonic-gate #undef NULL 1887c478bd9Sstevel@tonic-gate #define NULL (M_NULL) 1897c478bd9Sstevel@tonic-gate #endif /*M_NULL*/ 1907c478bd9Sstevel@tonic-gate 1917c478bd9Sstevel@tonic-gate /* 1927c478bd9Sstevel@tonic-gate * Useful additions to sys/stat.h. 1937c478bd9Sstevel@tonic-gate */ 1947c478bd9Sstevel@tonic-gate #ifndef S_IRALL 1957c478bd9Sstevel@tonic-gate #define S_IRALL (S_IRUSR|S_IRGRP|S_IROTH) 1967c478bd9Sstevel@tonic-gate #endif 1977c478bd9Sstevel@tonic-gate #ifndef S_IWALL 1987c478bd9Sstevel@tonic-gate #define S_IWALL (S_IWUSR|S_IWGRP|S_IWOTH) 1997c478bd9Sstevel@tonic-gate #endif 2007c478bd9Sstevel@tonic-gate #ifndef S_IXALL 2017c478bd9Sstevel@tonic-gate #define S_IXALL (S_IXUSR|S_IXGRP|S_IXOTH) 2027c478bd9Sstevel@tonic-gate #endif 2037c478bd9Sstevel@tonic-gate 2047c478bd9Sstevel@tonic-gate #ifndef M_DEFMODE /* Default directory creation mode */ 2057c478bd9Sstevel@tonic-gate #define M_DEFMODE ((mode_t)S_IRALL|S_IWALL)/* Default file creation mode*/ 2067c478bd9Sstevel@tonic-gate #endif 2077c478bd9Sstevel@tonic-gate #ifndef M_DIRMODE 2087c478bd9Sstevel@tonic-gate #define M_DIRMODE ((mode_t)S_IRALL|S_IWALL|S_IXALL) 2097c478bd9Sstevel@tonic-gate #endif 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate #ifndef M_FLDSEP 2127c478bd9Sstevel@tonic-gate #define M_FLDSEP ':' /* UNIX field separator for passwd, PATH */ 2137c478bd9Sstevel@tonic-gate #endif 2147c478bd9Sstevel@tonic-gate 2157c478bd9Sstevel@tonic-gate #ifndef M_TTYNAME 2167c478bd9Sstevel@tonic-gate #define M_TTYNAME "/dev/tty" 2177c478bd9Sstevel@tonic-gate #endif 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate #ifndef M_NULLNAME 2207c478bd9Sstevel@tonic-gate #define M_NULLNAME "/dev/null" 2217c478bd9Sstevel@tonic-gate #endif 2227c478bd9Sstevel@tonic-gate 2237c478bd9Sstevel@tonic-gate #ifndef M_FSDELIM 2247c478bd9Sstevel@tonic-gate #define M_FSDELIM(c) ((c)=='/') 2257c478bd9Sstevel@tonic-gate #endif 2267c478bd9Sstevel@tonic-gate 2277c478bd9Sstevel@tonic-gate #ifndef M_DRDELIM 2287c478bd9Sstevel@tonic-gate #define M_DRDELIM(c) (0) 2297c478bd9Sstevel@tonic-gate #endif 2307c478bd9Sstevel@tonic-gate 2317c478bd9Sstevel@tonic-gate #ifndef M_DIRSTAT 2327c478bd9Sstevel@tonic-gate #define M_DIRSTAT(name, dp, sb) stat((name), (sb)) 2337c478bd9Sstevel@tonic-gate #endif 2347c478bd9Sstevel@tonic-gate 2357c478bd9Sstevel@tonic-gate #ifndef M_HIDDEN 2367c478bd9Sstevel@tonic-gate #define M_HIDDEN(dirp, dp) ((dp)->d_name[0] == '.') 2377c478bd9Sstevel@tonic-gate #endif 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate #ifndef M_FSMOUNT /* for use by setmnt routine */ 2407c478bd9Sstevel@tonic-gate #define M_FSMOUNT M_ETCDIR(mtab) 2417c478bd9Sstevel@tonic-gate #endif 2427c478bd9Sstevel@tonic-gate 2437c478bd9Sstevel@tonic-gate #ifndef M_FSALL /* for use by setmnt routine */ 2447c478bd9Sstevel@tonic-gate #define M_FSALL M_ETCDIR(fstab) 2457c478bd9Sstevel@tonic-gate #endif 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate #ifndef M_NLSCHARMAP /* Default charmap file for localedef */ 2487c478bd9Sstevel@tonic-gate #define M_NLSCHARMAP M_NLSDIR(charmap/ISO_8859-1) 2497c478bd9Sstevel@tonic-gate #endif 2507c478bd9Sstevel@tonic-gate 2517c478bd9Sstevel@tonic-gate #ifndef M_POSIXPATH /* used when I18N undefined, default posix path */ 2527c478bd9Sstevel@tonic-gate #define M_POSIXPATH M_NLSDIR(locale/POSIX) 2537c478bd9Sstevel@tonic-gate #endif 2547c478bd9Sstevel@tonic-gate 2557c478bd9Sstevel@tonic-gate #ifndef M_ISEOV 2567c478bd9Sstevel@tonic-gate #define M_ISEOV(error) 0 2577c478bd9Sstevel@tonic-gate #endif 2587c478bd9Sstevel@tonic-gate 2597c478bd9Sstevel@tonic-gate #ifndef M_IS_NATIVE_LOCALE 2607c478bd9Sstevel@tonic-gate #define M_IS_NATIVE_LOCALE(s) (strcmp(s, "POSIX")==0 || strcmp(s, "C")==0) 2617c478bd9Sstevel@tonic-gate #endif 2627c478bd9Sstevel@tonic-gate 2637c478bd9Sstevel@tonic-gate #ifndef M_FSCLOSE 2647c478bd9Sstevel@tonic-gate #define M_FSCLOSE(fp) 2657c478bd9Sstevel@tonic-gate #endif 2667c478bd9Sstevel@tonic-gate 2677c478bd9Sstevel@tonic-gate #ifndef ROOTUID /* default superuser uid = 0 */ 2687c478bd9Sstevel@tonic-gate #define ROOTUID 0 2697c478bd9Sstevel@tonic-gate #endif 2707c478bd9Sstevel@tonic-gate 2717c478bd9Sstevel@tonic-gate #ifndef ROOTGID /* default superuser gid = 0 */ 2727c478bd9Sstevel@tonic-gate #define ROOTGID 0 2737c478bd9Sstevel@tonic-gate #endif 2747c478bd9Sstevel@tonic-gate 2757c478bd9Sstevel@tonic-gate #ifndef M_GROUP_PASSWD 2767c478bd9Sstevel@tonic-gate #define M_GROUP_PASSWD(grp) (grp->gr_passwd) 2777c478bd9Sstevel@tonic-gate #endif 2787c478bd9Sstevel@tonic-gate 2797c478bd9Sstevel@tonic-gate 2807c478bd9Sstevel@tonic-gate #ifndef M_NUMSIZE 2817c478bd9Sstevel@tonic-gate /* 2827c478bd9Sstevel@tonic-gate * define the expected max length of a printed number. (used in awk) 2837c478bd9Sstevel@tonic-gate * This should be the longest expected size for any type of number 2847c478bd9Sstevel@tonic-gate * ie. float, long etc. 2857c478bd9Sstevel@tonic-gate * This number is used to calculate the approximate 2867c478bd9Sstevel@tonic-gate * number of bytes needed to hold the number. 2877c478bd9Sstevel@tonic-gate */ 2887c478bd9Sstevel@tonic-gate #define M_NUMSIZE 30 2897c478bd9Sstevel@tonic-gate #endif /* M_NUMSIZE */ 2907c478bd9Sstevel@tonic-gate 2917c478bd9Sstevel@tonic-gate /* 2927c478bd9Sstevel@tonic-gate * VARARG[12345]: declare variadic functions. 2937c478bd9Sstevel@tonic-gate * Expands to either a standard C prototype or a K&R declaration. 2947c478bd9Sstevel@tonic-gate * For example: 2957c478bd9Sstevel@tonic-gate * 2967c478bd9Sstevel@tonic-gate * #include <stdarg.h> 2977c478bd9Sstevel@tonic-gate * int 2987c478bd9Sstevel@tonic-gate * fprintf VARARG2(FILE*, fp, char*, fmt) 2997c478bd9Sstevel@tonic-gate * { 3007c478bd9Sstevel@tonic-gate * va_list ap; 3017c478bd9Sstevel@tonic-gate * 3027c478bd9Sstevel@tonic-gate * va_start(ap, fmt); 3037c478bd9Sstevel@tonic-gate * cp = va_arg(ap, char*); 3047c478bd9Sstevel@tonic-gate * va_end(ap); 3057c478bd9Sstevel@tonic-gate * } 3067c478bd9Sstevel@tonic-gate */ 3077c478bd9Sstevel@tonic-gate #ifndef VARARG1 3087c478bd9Sstevel@tonic-gate #ifdef __STDC__ 3097c478bd9Sstevel@tonic-gate #define VARARG1(type, name) (type name, ...) 3107c478bd9Sstevel@tonic-gate #define VARARG2(t1, n1, t2, n2) (t1 n1, t2 n2, ...) 3117c478bd9Sstevel@tonic-gate #define VARARG3(t1, n1, t2, n2, t3, n3) (t1 n1, t2 n2, t3 n3, ...) 3127c478bd9Sstevel@tonic-gate #define VARARG4(t1, n1, t2, n2, t3, n3, t4, n4) \ 3137c478bd9Sstevel@tonic-gate (t1 n1, t2 n2, t3 n3, t4 n4, ...) 3147c478bd9Sstevel@tonic-gate #define VARARG5(t1, n1, t2, n2, t3, n3, t4, n4, t5, n5) \ 3157c478bd9Sstevel@tonic-gate (t1 n1, t2 n2, t3 n3, t4 n4, t5 n5, ...) 3167c478bd9Sstevel@tonic-gate #else 3177c478bd9Sstevel@tonic-gate #define VARARG1(type, name) (name, va_alist) type name; int va_alist 3187c478bd9Sstevel@tonic-gate #define VARARG2(t1, n1, t2, n2) (n1, n2, va_alist) t1 n1; t2 n2; int va_alist 3197c478bd9Sstevel@tonic-gate #define VARARG3(t1, n1, t2, n2, t3, n3) (n1, n2, n3, va_alist) \ 3207c478bd9Sstevel@tonic-gate t1 n1; t2 n2; t3 n3; int va_alist 3217c478bd9Sstevel@tonic-gate #define VARARG4(t1, n1, t2, n2, t3, n3, t4, n4) (n1, n2, n3, n4, va_alist) \ 3227c478bd9Sstevel@tonic-gate t1 n1; t2 n2; t3 n3; t4 n4; int va_alist 3237c478bd9Sstevel@tonic-gate #define VARARG5(t1, n1, t2, n2, t3, n3, t4, n4, t5, n5) \ 3247c478bd9Sstevel@tonic-gate (n1, n2, n3, n4, n5, va_alist) \ 3257c478bd9Sstevel@tonic-gate t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; int va_alist 3267c478bd9Sstevel@tonic-gate #endif 3277c478bd9Sstevel@tonic-gate #endif 3287c478bd9Sstevel@tonic-gate 3297c478bd9Sstevel@tonic-gate 3307c478bd9Sstevel@tonic-gate /* 3317c478bd9Sstevel@tonic-gate * MKS-specific library entry points. 3327c478bd9Sstevel@tonic-gate */ 3337c478bd9Sstevel@tonic-gate extern char *_cmdname; 3347c478bd9Sstevel@tonic-gate LEXTERN char *basename (char *); 3357c478bd9Sstevel@tonic-gate LEXTERN void crc16 (ushort *, ushort); 3367c478bd9Sstevel@tonic-gate LEXTERN void crcccitt (ushort *, ushort); 3377c478bd9Sstevel@tonic-gate LEXTERN int eprintf (const char *, ...); 3387c478bd9Sstevel@tonic-gate LEXTERN void eputs (const char *); 3397c478bd9Sstevel@tonic-gate LEXTERN int execvep (const char *, char *const *, char *const *); 3407c478bd9Sstevel@tonic-gate LEXTERN int isabsname (const char *); 3417c478bd9Sstevel@tonic-gate LEXTERN const char *m_cescape (wint_t); 3427c478bd9Sstevel@tonic-gate LEXTERN int m_escapec (char **); 3437c478bd9Sstevel@tonic-gate LEXTERN const char *m_toprint (wint_t); 3447c478bd9Sstevel@tonic-gate #if M_STTY_CC 3457c478bd9Sstevel@tonic-gate LEXTERN int m_stty_cc (cc_t* cp, char *str); 3467c478bd9Sstevel@tonic-gate #endif 3477c478bd9Sstevel@tonic-gate LEXTERN char *m_cmdname (char *); 3487c478bd9Sstevel@tonic-gate LEXTERN char *m_strmode (mode_t); 3497c478bd9Sstevel@tonic-gate LEXTERN char *m_readmode (const char *); 3507c478bd9Sstevel@tonic-gate LEXTERN char *m_readnum (long *, char *, char **, int); 3517c478bd9Sstevel@tonic-gate LEXTERN char *m_readunum (unsigned long *, char *, char **, int); 3527c478bd9Sstevel@tonic-gate LEXTERN mode_t m_getmode (mode_t); 3537c478bd9Sstevel@tonic-gate LEXTERN int m_wallow (int, const char *); 3547c478bd9Sstevel@tonic-gate LEXTERN char *m_pathcat (const char *, const char *); 3557c478bd9Sstevel@tonic-gate LEXTERN void m_sigcleanup (void (*__handler)(int __signo) ); 3567c478bd9Sstevel@tonic-gate LEXTERN void m_defaction (int __signo); 3577c478bd9Sstevel@tonic-gate LEXTERN char *m_strdup (const char *s); 3587c478bd9Sstevel@tonic-gate LEXTERN int m_stricmp (const char *, const char *); 3597c478bd9Sstevel@tonic-gate LEXTERN char *m_self (int, char *, char *); 3607c478bd9Sstevel@tonic-gate LEXTERN int m_grouplist (char *user, gid_t *gidlist[]); 3617c478bd9Sstevel@tonic-gate LEXTERN int m_setgroups (int gidsetsize, gid_t grouplist[]); 3627c478bd9Sstevel@tonic-gate LEXTERN uint m_binsrch (uint n, int (*cmp)(uint i)); 3637c478bd9Sstevel@tonic-gate LEXTERN char *m_dirname (const char*); 3647c478bd9Sstevel@tonic-gate LEXTERN char *m_confstr (int); 3657c478bd9Sstevel@tonic-gate 3667c478bd9Sstevel@tonic-gate LEXTERN void m_crcposix (ulong *, const uchar *, size_t); 3677c478bd9Sstevel@tonic-gate LEXTERN int m_setprio (int, unsigned int, int); 3687c478bd9Sstevel@tonic-gate LEXTERN int m_getprio (int, unsigned int); 3697c478bd9Sstevel@tonic-gate LEXTERN int m_incrnice (int, unsigned int, int); 3707c478bd9Sstevel@tonic-gate LEXTERN char *m_devname (dev_t); 3717c478bd9Sstevel@tonic-gate LEXTERN char *m_mountdir (const char *); 3727c478bd9Sstevel@tonic-gate LEXTERN int m_absname(char *, char *, char *, size_t); 3737c478bd9Sstevel@tonic-gate LEXTERN int m_samefile(char *, struct stat *, char *, struct stat *); 3747c478bd9Sstevel@tonic-gate 3757c478bd9Sstevel@tonic-gate /* __m_system() : alternate interface into system() */ 3767c478bd9Sstevel@tonic-gate LEXTERN int __m_system (const char *, const char *, const char *); 3777c478bd9Sstevel@tonic-gate 3787c478bd9Sstevel@tonic-gate 3797c478bd9Sstevel@tonic-gate /* conversion routines - between single byte and UNICODE (wide) strings. 3807c478bd9Sstevel@tonic-gate * These return a pointer to malloc'd memory. 3817c478bd9Sstevel@tonic-gate * It is the caller's responsiblity to free() it, if necessary 3827c478bd9Sstevel@tonic-gate * These are for use primarily on NT 3837c478bd9Sstevel@tonic-gate */ 3847c478bd9Sstevel@tonic-gate extern char *m_unicodetosb(const wchar_t*); 3857c478bd9Sstevel@tonic-gate extern wchar_t *m_sbtounicode(const char*); 3867c478bd9Sstevel@tonic-gate 3877c478bd9Sstevel@tonic-gate 3887c478bd9Sstevel@tonic-gate /* 3897c478bd9Sstevel@tonic-gate * things that could go into an "m_stdio.h" 3907c478bd9Sstevel@tonic-gate */ 3917c478bd9Sstevel@tonic-gate 3927c478bd9Sstevel@tonic-gate /* m_unlink() : alternate unlink() for use with vendor-provided 3937c478bd9Sstevel@tonic-gate * libraries that do not have a satisfactory unlink() */ 3947c478bd9Sstevel@tonic-gate #ifndef M_UNLINK 3957c478bd9Sstevel@tonic-gate #define m_unlink(s) unlink(s) 3967c478bd9Sstevel@tonic-gate #endif 3977c478bd9Sstevel@tonic-gate 3987c478bd9Sstevel@tonic-gate /* __m_popen() : alternate interface into popen() */ 3997c478bd9Sstevel@tonic-gate LEXTERN FILE *__m_popen (const char *, const char *, 4007c478bd9Sstevel@tonic-gate const char *, const char *); 4011da57d55SToomas Soome LEXTERN FILE *__m_popenvp (const char *mode, const char *shell, 4027c478bd9Sstevel@tonic-gate char const * const *args); 4037c478bd9Sstevel@tonic-gate 4047c478bd9Sstevel@tonic-gate #if M_TFGETC 4057c478bd9Sstevel@tonic-gate LEXTERN int m_tfgetc (FILE *fp, struct termios *tp); 4067c478bd9Sstevel@tonic-gate #else 4077c478bd9Sstevel@tonic-gate #define m_tfgetc(fp,tp) fgetc(fp) 4087c478bd9Sstevel@tonic-gate #endif 4097c478bd9Sstevel@tonic-gate 4107c478bd9Sstevel@tonic-gate /* m_fsopen() - special routine for curses */ 4117c478bd9Sstevel@tonic-gate LEXTERN FILE *m_fsopen (char *, size_t, const char *, FILE *); 4127c478bd9Sstevel@tonic-gate 4137c478bd9Sstevel@tonic-gate #ifndef M_FFLUSH_NOT_POSIX_1 4147c478bd9Sstevel@tonic-gate # define m_fflush fflush 4157c478bd9Sstevel@tonic-gate #else 4167c478bd9Sstevel@tonic-gate LEXTERN int m_fflush (FILE *); 4177c478bd9Sstevel@tonic-gate #endif 4187c478bd9Sstevel@tonic-gate 4197c478bd9Sstevel@tonic-gate /* m_fgets return values */ 4207c478bd9Sstevel@tonic-gate enum { 4217c478bd9Sstevel@tonic-gate M_FGETS_OK, /* Normal return */ 4227c478bd9Sstevel@tonic-gate M_FGETS_EOF, /* 4237c478bd9Sstevel@tonic-gate * Regular EOF (same as NULL from fgets). 4247c478bd9Sstevel@tonic-gate * Buffer is *untouched*. 4257c478bd9Sstevel@tonic-gate */ 4267c478bd9Sstevel@tonic-gate M_FGETS_SHORT, /* 4277c478bd9Sstevel@tonic-gate * Short input (buf[strlen(buf)-1] != '\n') 4287c478bd9Sstevel@tonic-gate * This is a trailing line, without a newline at the 4297c478bd9Sstevel@tonic-gate * end of the file. The buffer is valid, ending in 4307c478bd9Sstevel@tonic-gate * a \0, with no newline. The case of terminal input 4317c478bd9Sstevel@tonic-gate * ending with an EOF in the middle of the line will 4327c478bd9Sstevel@tonic-gate * restart -- typing two EOF's will result in this 4337c478bd9Sstevel@tonic-gate * case. 4347c478bd9Sstevel@tonic-gate */ 4357c478bd9Sstevel@tonic-gate M_FGETS_LONG, /* 4367c478bd9Sstevel@tonic-gate * Line too long: newline not found within len bytes 4377c478bd9Sstevel@tonic-gate * (buf[len-1] != '\n'). 4387c478bd9Sstevel@tonic-gate * At this point, while((c=getc(fp)) != '\n') ... 4397c478bd9Sstevel@tonic-gate * is a valid method to get the rest of the line. 4407c478bd9Sstevel@tonic-gate */ 4417c478bd9Sstevel@tonic-gate M_FGETS_BINARY, /* 4427c478bd9Sstevel@tonic-gate * Input contained an invalid character (e.g. \0) 4437c478bd9Sstevel@tonic-gate * Buffer contents *undefined*. 4447c478bd9Sstevel@tonic-gate */ 4457c478bd9Sstevel@tonic-gate M_FGETS_ERROR /* 4467c478bd9Sstevel@tonic-gate * A system call returned an error, errno is set. 4477c478bd9Sstevel@tonic-gate * Buffer contents *undefined*. 4487c478bd9Sstevel@tonic-gate */ 4497c478bd9Sstevel@tonic-gate }; 4507c478bd9Sstevel@tonic-gate LEXTERN int m_fgets (char *, size_t, FILE *); 4517c478bd9Sstevel@tonic-gate 4527c478bd9Sstevel@tonic-gate /* 4537c478bd9Sstevel@tonic-gate * end of things that could go into an "m_stdio.h" 4547c478bd9Sstevel@tonic-gate */ 4557c478bd9Sstevel@tonic-gate 4567c478bd9Sstevel@tonic-gate LEXTERN int m_winsize (int *, int *); 4577c478bd9Sstevel@tonic-gate LEXTERN char *m_cuserid (); 4587c478bd9Sstevel@tonic-gate 4597c478bd9Sstevel@tonic-gate /* m_ctype: generic character classification */ 4607c478bd9Sstevel@tonic-gate typedef int m_ctype_t; /* ctype property */ 4617c478bd9Sstevel@tonic-gate LEXTERN m_ctype_t m_ctype (const char *property); 4627c478bd9Sstevel@tonic-gate LEXTERN int m_isctype (int c, m_ctype_t ctype); 4637c478bd9Sstevel@tonic-gate LEXTERN char *m_readdate (char *, time_t *, int); 4647c478bd9Sstevel@tonic-gate 4657c478bd9Sstevel@tonic-gate #ifndef M_READDATE_SYSV 4667c478bd9Sstevel@tonic-gate #define M_READDATE_SYSV 0 4677c478bd9Sstevel@tonic-gate #endif 4687c478bd9Sstevel@tonic-gate #ifndef M_READDATE_BSD 4697c478bd9Sstevel@tonic-gate #define M_READDATE_BSD 1 4707c478bd9Sstevel@tonic-gate #endif 4717c478bd9Sstevel@tonic-gate 4727c478bd9Sstevel@tonic-gate #ifdef M_MALLOC 4737c478bd9Sstevel@tonic-gate LEXTERN _VOID *m_malloc (size_t size); 4747c478bd9Sstevel@tonic-gate #else 4757c478bd9Sstevel@tonic-gate # define m_malloc(size) malloc(size) 4767c478bd9Sstevel@tonic-gate #endif /*M_MALLOC*/ 4777c478bd9Sstevel@tonic-gate 4787c478bd9Sstevel@tonic-gate #ifdef M_REALLOC 4797c478bd9Sstevel@tonic-gate LEXTERN _VOID *m_realloc (void* ptr, size_t size); 4807c478bd9Sstevel@tonic-gate #else 4817c478bd9Sstevel@tonic-gate # define m_realloc realloc 4827c478bd9Sstevel@tonic-gate #endif /*M_MALLOC*/ 4837c478bd9Sstevel@tonic-gate 4847c478bd9Sstevel@tonic-gate #ifdef NAME_MAX 4857c478bd9Sstevel@tonic-gate #define m_namemax(path) NAME_MAX 4867c478bd9Sstevel@tonic-gate #else 4877c478bd9Sstevel@tonic-gate LEXTERN int m_namemax (char *path); 4887c478bd9Sstevel@tonic-gate #endif /*NAME_MAX*/ 4897c478bd9Sstevel@tonic-gate 4907c478bd9Sstevel@tonic-gate #ifdef PATH_MAX 4917c478bd9Sstevel@tonic-gate #define m_pathmax(path) PATH_MAX 4927c478bd9Sstevel@tonic-gate #else 4937c478bd9Sstevel@tonic-gate LEXTERN int m_pathmax (char *path); 4947c478bd9Sstevel@tonic-gate #endif /* PATH_MAX */ 4957c478bd9Sstevel@tonic-gate 4967c478bd9Sstevel@tonic-gate #ifdef M_DEVBIN 4977c478bd9Sstevel@tonic-gate LEXTERN int m_devbin (int fd); /* begin raw I/O transfer */ 4987c478bd9Sstevel@tonic-gate LEXTERN void m_devstd (int fd, int mode); /* end raw I/O transfer */ 4997c478bd9Sstevel@tonic-gate #else 5007c478bd9Sstevel@tonic-gate # define m_devbin(fd) 0 5017c478bd9Sstevel@tonic-gate # define m_devstd(fd, mode) 5027c478bd9Sstevel@tonic-gate #endif /*M_DEVBIN*/ 5037c478bd9Sstevel@tonic-gate 5047c478bd9Sstevel@tonic-gate #ifndef m_setbinary 5057c478bd9Sstevel@tonic-gate #define m_setbinary(fp) 5067c478bd9Sstevel@tonic-gate #endif /*m_setbinary*/ 5077c478bd9Sstevel@tonic-gate 5087c478bd9Sstevel@tonic-gate #ifndef M_PRIO_PROCESS 5097c478bd9Sstevel@tonic-gate #define M_PRIO_PROCESS 0 5107c478bd9Sstevel@tonic-gate #endif 5117c478bd9Sstevel@tonic-gate #ifndef M_PRIO_PGRP 5127c478bd9Sstevel@tonic-gate #define M_PRIO_PGRP 1 5137c478bd9Sstevel@tonic-gate #endif 5147c478bd9Sstevel@tonic-gate #ifndef M_PRIO_USER 5157c478bd9Sstevel@tonic-gate #define M_PRIO_USER 2 5167c478bd9Sstevel@tonic-gate #endif 5177c478bd9Sstevel@tonic-gate 5187c478bd9Sstevel@tonic-gate /* m_wallow type values */ 5197c478bd9Sstevel@tonic-gate #ifndef MWA_NO 5207c478bd9Sstevel@tonic-gate #define MWA_NO 0 /* Deny talk, write */ 5217c478bd9Sstevel@tonic-gate #endif 5227c478bd9Sstevel@tonic-gate #ifndef MWA_YES 5237c478bd9Sstevel@tonic-gate #define MWA_YES 1 /* Allow talk, write */ 5247c478bd9Sstevel@tonic-gate #endif 5257c478bd9Sstevel@tonic-gate #ifndef MWA_TEST 5267c478bd9Sstevel@tonic-gate #define MWA_TEST 2 /* Test for YES/NO */ 5277c478bd9Sstevel@tonic-gate #endif 5287c478bd9Sstevel@tonic-gate 5297c478bd9Sstevel@tonic-gate /* Interface for compression (m_cm_*) and decompression (m_dc_*) */ 5307c478bd9Sstevel@tonic-gate LEXTERN int m_cm_open (int (*wrtfn) (const uchar *,int), int); 5317c478bd9Sstevel@tonic-gate LEXTERN int m_cm_write (const uchar *, int); 5327c478bd9Sstevel@tonic-gate LEXTERN int m_cm_close (int); 5337c478bd9Sstevel@tonic-gate LEXTERN char *m_cm_error (void); 5347c478bd9Sstevel@tonic-gate LEXTERN int m_dc_open (ssize_t (*rdfn)(uchar *, int)); 5357c478bd9Sstevel@tonic-gate LEXTERN ssize_t m_dc_read (uchar *, size_t); 5367c478bd9Sstevel@tonic-gate LEXTERN int m_dc_close (int); 5377c478bd9Sstevel@tonic-gate LEXTERN char *m_dc_error (void); 5387c478bd9Sstevel@tonic-gate 5397c478bd9Sstevel@tonic-gate LEXTERN int m_mkpardir (char *); 5407c478bd9Sstevel@tonic-gate 5417c478bd9Sstevel@tonic-gate /* 5427c478bd9Sstevel@tonic-gate * Some UNIX routines that aren't in SVID 5437c478bd9Sstevel@tonic-gate */ 5447c478bd9Sstevel@tonic-gate LEXTERN void cfree (void *, size_t, size_t); 5457c478bd9Sstevel@tonic-gate LEXTERN void swaw (const short *, short *, int); 5467c478bd9Sstevel@tonic-gate 5477c478bd9Sstevel@tonic-gate /* Some dos routines we sometimes want from posix utilities */ 5487c478bd9Sstevel@tonic-gate LEXTERN void _uttoof (time_t, ushort *, ushort *); 5497c478bd9Sstevel@tonic-gate LEXTERN time_t _oftout (ushort, ushort); 5507c478bd9Sstevel@tonic-gate 5517c478bd9Sstevel@tonic-gate 5527c478bd9Sstevel@tonic-gate #ifndef M_SETENV 5537c478bd9Sstevel@tonic-gate #define m_setenv() environ 5547c478bd9Sstevel@tonic-gate #endif 5557c478bd9Sstevel@tonic-gate 5567c478bd9Sstevel@tonic-gate #ifdef M_NON_STATIC_GETENV 5577c478bd9Sstevel@tonic-gate #define __m_getenv getenv 5587c478bd9Sstevel@tonic-gate #else 559*2b395c3cSAndy Fiddaman LEXTERN char *__m_getenv(char const *); /* Library safe getenv() */ 5607c478bd9Sstevel@tonic-gate #endif 5617c478bd9Sstevel@tonic-gate 5627c478bd9Sstevel@tonic-gate #ifndef M_CRON_MAILER 5631da57d55SToomas Soome /* 5647c478bd9Sstevel@tonic-gate * Default case: assume only POSIX.2 mailx is available. 5657c478bd9Sstevel@tonic-gate * Must be careful when cron sends output to mailx. 5667c478bd9Sstevel@tonic-gate * We must ensure that lines with leading '~' are escaped 5677c478bd9Sstevel@tonic-gate * so mailx doesn't interpret these lines 5687c478bd9Sstevel@tonic-gate * This string MUST include a trailing space character. 5697c478bd9Sstevel@tonic-gate */ 5707c478bd9Sstevel@tonic-gate #define M_CRON_MAILER "sed -e s/^~/~~/ | mailx " 5717c478bd9Sstevel@tonic-gate #endif 5727c478bd9Sstevel@tonic-gate 5737c478bd9Sstevel@tonic-gate /* 5747c478bd9Sstevel@tonic-gate * m_cp() - copy a file in an O/S specific way. See m_cp.3 5757c478bd9Sstevel@tonic-gate * for details 5767c478bd9Sstevel@tonic-gate */ 5777c478bd9Sstevel@tonic-gate 5787c478bd9Sstevel@tonic-gate /* Return codes */ 5797c478bd9Sstevel@tonic-gate #define M_CP_ERR -1 5807c478bd9Sstevel@tonic-gate #define M_CP_NOOP -2 5817c478bd9Sstevel@tonic-gate 5827c478bd9Sstevel@tonic-gate /* processing flags */ 5837c478bd9Sstevel@tonic-gate #define M_CP_PRESERVE 1 5847c478bd9Sstevel@tonic-gate 5857c478bd9Sstevel@tonic-gate /* 5867c478bd9Sstevel@tonic-gate * MKS MEMORY MANIPULATIONS: 5877c478bd9Sstevel@tonic-gate * Specific to MKS and non-portable. 5887c478bd9Sstevel@tonic-gate */ 5897c478bd9Sstevel@tonic-gate LEXTERN _VOID *membtst (const char *s, size_t m, int c); 5907c478bd9Sstevel@tonic-gate 5917c478bd9Sstevel@tonic-gate #ifdef M_LDATA 5927c478bd9Sstevel@tonic-gate #define memLchr memchr 5937c478bd9Sstevel@tonic-gate #define memSLccpy memccpy 5947c478bd9Sstevel@tonic-gate #define memLbtst membtst 5957c478bd9Sstevel@tonic-gate #define memLset memset 5967c478bd9Sstevel@tonic-gate #define memLLcpy memcpy 5977c478bd9Sstevel@tonic-gate #define memLLrlcpy memrlcpy 5987c478bd9Sstevel@tonic-gate #define memLLcmp memcmp 5997c478bd9Sstevel@tonic-gate #else 6007c478bd9Sstevel@tonic-gate /* for machines with small data models (e.g PC's - DOS, OS2) */ 6017c478bd9Sstevel@tonic-gate LEXTERN void far*memLchr (const void far*s, int c, size_t n); 6027c478bd9Sstevel@tonic-gate LEXTERN void *memSLccpy (_VOID *s1, const _VOID far*s2, int, size_t n); 6037c478bd9Sstevel@tonic-gate LEXTERN void far*memLbtst (const char far*s, size_t m, int n); 6047c478bd9Sstevel@tonic-gate LEXTERN void far*memLset (void far*s, int c, size_t n); 6057c478bd9Sstevel@tonic-gate LEXTERN void far*memLsetl (void far*p, int value, long count); 6067c478bd9Sstevel@tonic-gate LEXTERN void far*memLLcpy (void far*s1, const void far*s2, size_t n); 6077c478bd9Sstevel@tonic-gate LEXTERN void far*memLLrlcpy (void far*s1, const void far*s2, size_t); 6087c478bd9Sstevel@tonic-gate LEXTERN int memLLcmp (const void far *s1,const void far *s2,size_t n); 6097c478bd9Sstevel@tonic-gate #endif /* M_LDATA */ 6107c478bd9Sstevel@tonic-gate 6117c478bd9Sstevel@tonic-gate 6127c478bd9Sstevel@tonic-gate /* mks error handling routines */ 6137c478bd9Sstevel@tonic-gate #include <stdarg.h> 6147c478bd9Sstevel@tonic-gate LEXTERN void m_error (const char * fmt, ...); 6157c478bd9Sstevel@tonic-gate LEXTERN void m_errorexit (const char *fmt, va_list args); 6167c478bd9Sstevel@tonic-gate LEXTERN void m_errorret (const char *fmt, va_list args); 6177c478bd9Sstevel@tonic-gate LEXTERN void m_errorjmp (const char *fmt, va_list args); 6187c478bd9Sstevel@tonic-gate LEXTERN void m_errornull (const char *fmt, va_list args); 6197c478bd9Sstevel@tonic-gate LEXTERN void (*m_errorfn) (const char *fmt, va_list args); 6207c478bd9Sstevel@tonic-gate #define M_ERROR(fn) void (*m_errorfn) (const char *fmt, va_list args) = fn 6217c478bd9Sstevel@tonic-gate 6227c478bd9Sstevel@tonic-gate /* 6237c478bd9Sstevel@tonic-gate * The filesystem type and attribute routine 6247c478bd9Sstevel@tonic-gate */ 6257c478bd9Sstevel@tonic-gate #ifndef M_FSTYPE 6267c478bd9Sstevel@tonic-gate #define m_fstype(path) M_FSTYPE_POSIX 6277c478bd9Sstevel@tonic-gate #endif 6287c478bd9Sstevel@tonic-gate 6297c478bd9Sstevel@tonic-gate /* File system types */ 6307c478bd9Sstevel@tonic-gate #define M_FSTYPE_MASK 0x1 6317c478bd9Sstevel@tonic-gate #define M_FSTYPE_POSIX 0 6327c478bd9Sstevel@tonic-gate #define M_FSTYPE_FAT 1 6337c478bd9Sstevel@tonic-gate 6347c478bd9Sstevel@tonic-gate /* File system attributes */ 6357c478bd9Sstevel@tonic-gate #define M_FSATTR_NO_LEADING_DOT 0x08 6367c478bd9Sstevel@tonic-gate #define M_FSATTR_ONE_DOT 0x10 6377c478bd9Sstevel@tonic-gate #define M_FSATTR_SHORT_FILENAME 0x20 6387c478bd9Sstevel@tonic-gate #define M_FSATTR_SHORT_EXT 0x40 6397c478bd9Sstevel@tonic-gate #define M_FSATTR_LOWER_CASE 0x80 6407c478bd9Sstevel@tonic-gate 6417c478bd9Sstevel@tonic-gate /* This one should be ifdef'ed on something else */ 6427c478bd9Sstevel@tonic-gate #ifndef M_FNMATCH_DUALCASE 6437c478bd9Sstevel@tonic-gate #define m_get_original_filename_case(path) /* nil */ 6447c478bd9Sstevel@tonic-gate #endif 6457c478bd9Sstevel@tonic-gate 6467c478bd9Sstevel@tonic-gate /* 6471da57d55SToomas Soome * m_tempname() generates a filename for a temp file using "code" 6487c478bd9Sstevel@tonic-gate * in the name. 6497c478bd9Sstevel@tonic-gate */ 6507c478bd9Sstevel@tonic-gate #ifndef M_TEMPNAME 6517c478bd9Sstevel@tonic-gate #define m_tempname(code) tempnam(__m_getenv("TMPDIR"), (code)) 6527c478bd9Sstevel@tonic-gate #else 6537c478bd9Sstevel@tonic-gate char *m_tempname(char const *code); 6547c478bd9Sstevel@tonic-gate #endif 6557c478bd9Sstevel@tonic-gate 6567c478bd9Sstevel@tonic-gate /* 6577c478bd9Sstevel@tonic-gate * __m_getopt() alternate "stateless" entry into getopt(). 6587c478bd9Sstevel@tonic-gate */ 6597c478bd9Sstevel@tonic-gate 6607c478bd9Sstevel@tonic-gate struct getopt_state { 6617c478bd9Sstevel@tonic-gate char *optarg; /* Argument */ 6627c478bd9Sstevel@tonic-gate int optind; /* Index into argv */ 6637c478bd9Sstevel@tonic-gate int opterr; /* Print error message */ 6647c478bd9Sstevel@tonic-gate int optopt; /* Invalid option */ 6657c478bd9Sstevel@tonic-gate int index; /* argv[optind] index */ 6667c478bd9Sstevel@tonic-gate #ifdef M_I18N_MB 6677c478bd9Sstevel@tonic-gate mbstate_t st; /* State of argv[optind][index] */ 6681da57d55SToomas Soome #endif 6697c478bd9Sstevel@tonic-gate }; 6707c478bd9Sstevel@tonic-gate 6717c478bd9Sstevel@tonic-gate int __m_getopt(int argc, char * const *argv, char const *optstring, 6727c478bd9Sstevel@tonic-gate struct getopt_state *state); 6731da57d55SToomas Soome 6747c478bd9Sstevel@tonic-gate 6757c478bd9Sstevel@tonic-gate #ifdef M_MKSEXTRA_H 6767c478bd9Sstevel@tonic-gate /* Any overrides etcetera for a particular system can go in here */ 6777c478bd9Sstevel@tonic-gate #include <mksextra.h> 6787c478bd9Sstevel@tonic-gate #endif /* M_MKSEXTRA_H */ 6797c478bd9Sstevel@tonic-gate 6807c478bd9Sstevel@tonic-gate #endif /* __M_MKS_H__ */ 681