1 /****************************************************************************
2 * Copyright 2019-2022,2024 Thomas E. Dickey *
3 * Copyright 1998-2015,2017 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************/
30 /****************************************************************************
31 * Author: Thomas E. Dickey 1997-on *
32 ****************************************************************************/
34 * $Id: progs.priv.h,v 1.62 2024/04/08 17:28:28 tom Exp $
38 * Header file for curses utility programs
42 #define PROGS_PRIV_H 1
44 #include <curses.priv.h>
50 # define NAMLEN(dirent) strlen((dirent)->d_name)
51 # if defined(_FILE_OFFSET_BITS) && defined(HAVE_STRUCT_DIRENT64)
52 # if !defined(_LP64) && (_FILE_OFFSET_BITS == 64)
53 # define DIRENT struct dirent64
55 # define DIRENT struct dirent
58 # define DIRENT struct dirent
61 # define DIRENT struct direct
62 # define NAMLEN(dirent) (dirent)->d_namlen
64 # include <sys/ndir.h>
76 #elif !defined(HAVE_GETOPT_HEADER)
77 /* 'getopt()' may be prototyped in <stdlib.h>, but declaring its
78 * variables doesn't hurt.
82 #endif /* HAVE_GETOPT_H */
89 #define ExitProgram(code) exit_terminfo(code)
91 #define ExitProgram(code) _nc_free_tic(code)
95 /* error-returns for tput */
99 #define ErrSystem(n) (4 + (n))
101 /* We use isascii only to guard against use of 7-bit ctype tables in the
102 * isprint test in infocmp.
106 # if ('z'-'a' == 25) && ('z' < 127) && ('Z'-'A' == 25) && ('Z' < 127) && ('9' < 127)
107 # define isascii(c) (UChar(c) <= 127)
109 # define isascii(c) 1 /* not really ascii anyway */
113 #define VtoTrace(opt) (unsigned) ((opt > 0) ? opt : (opt == 0))
116 * If configured for tracing, the debug- and trace-output are merged together
117 * in the trace file for "upper" levels of the verbose option.
120 #define use_verbosity(level) do { \
121 set_trace_level(level); \
122 if (_nc_tracing > DEBUG_LEVEL(2)) \
123 _nc_tracing |= TRACE_MAXIMUM; \
124 else if (_nc_tracing == DEBUG_LEVEL(2)) \
125 _nc_tracing |= TRACE_ORDINARY; \
127 curses_trace(_nc_tracing); \
130 #define use_verbosity(level) do { set_trace_level(level); } while (0)
134 #define CUR ((TERMTYPE *)(cur_term))->
137 #endif /* PROGS_PRIV_H */