1 /****************************************************************************
2 * Copyright (c) 1998-2000 Free Software Foundation, Inc. *
4 * Permission is hereby granted, free of charge, to any person obtaining a *
5 * copy of this software and associated documentation files (the *
6 * "Software"), to deal in the Software without restriction, including *
7 * without limitation the rights to use, copy, modify, merge, publish, *
8 * distribute, distribute with modifications, sublicense, and/or sell *
9 * copies of the Software, and to permit persons to whom the Software is *
10 * furnished to do so, subject to the following conditions: *
12 * The above copyright notice and this permission notice shall be included *
13 * in all copies or substantial portions of the Software. *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 * Except as contained in this notice, the name(s) of the above copyright *
24 * holders shall not be used in advertising or otherwise to promote the *
25 * sale, use or other dealings in this Software without prior written *
27 ****************************************************************************/
29 /****************************************************************************
30 * Author: Thomas E. Dickey <dickey@clark.net> 1997,1998 *
31 ****************************************************************************/
33 * $Id: progs.priv.h,v 1.27 2001/06/18 18:43:52 tom Exp $
37 * Header file for curses utility programs
40 #include <ncurses_cfg.h>
43 #define MODULE_ID(id) static const char Ident[] = id;
45 #define MODULE_ID(id) /*nothing*/
51 #include <sys/types.h>
61 #if HAVE_SYS_BSDTYPES_H
62 #include <sys/bsdtypes.h> /* needed for ISC */
67 #elif HAVE_SYS_PARAM_H
68 # include <sys/param.h>
73 # define NAMLEN(dirent) strlen((dirent)->d_name)
75 # define dirent direct
76 # define NAMLEN(dirent) (dirent)->d_namlen
78 # include <sys/ndir.h>
97 /* 'getopt()' may be prototyped in <stdlib.h>, but declaring its
98 * variables doesn't hurt.
102 #endif /* HAVE_GETOPT_H */
105 #include <term_entry.h>
107 #include <nc_alloc.h>
109 /* usually in <unistd.h> */
110 #ifndef STDOUT_FILENO
111 #define STDOUT_FILENO 1
114 #ifndef STDERR_FILENO
115 #define STDERR_FILENO 2
119 #define EXIT_SUCCESS 0
123 #define EXIT_FAILURE 1
127 #define R_OK 4 /* Test for readable. */
131 #define W_OK 2 /* Test for writable. */
135 #define X_OK 1 /* Test for executable. */
139 #define F_OK 0 /* Test for existence. */
142 /* usually in <unistd.h> */
143 #ifndef STDOUT_FILENO
144 #define STDOUT_FILENO 1
147 #ifndef STDERR_FILENO
148 #define STDERR_FILENO 2
151 /* may be in limits.h, included from various places */
153 # if defined(_POSIX_PATH_MAX)
154 # define PATH_MAX _POSIX_PATH_MAX
155 # elif defined(MAXPATHLEN)
156 # define PATH_MAX MAXPATHLEN
158 # define PATH_MAX 255 /* the Posix minimum pathsize */
162 /* We use isascii only to guard against use of 7-bit ctype tables in the
163 * isprint test in infocmp.
167 # if ('z'-'a' == 25) && ('z' < 127) && ('Z'-'A' == 25) && ('Z' < 127) && ('9' < 127)
168 # define isascii(c) (UChar(c) <= 127)
170 # define isascii(c) 1 /* not really ascii anyway */
174 #define UChar(c) ((unsigned char)(c))
176 #define SIZEOF(v) (sizeof(v)/sizeof(v[0]))