1/*
2 * Copyright (C) 1984-2023  Mark Nudelman
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information, see the README file.
8 */
9
10
11/* DOS definition file for less.  */
12/*
13 * This file has 2 sections:
14 * User preferences.
15 * Settings always true for MS-DOS systems. 
16 */
17
18/* User preferences.  */
19
20/*
21 * SECURE is 1 if you wish to disable a bunch of features in order to
22 * be safe to run by unprivileged users.
23 */
24#define	SECURE		0
25
26/*
27 * SHELL_ESCAPE is 1 if you wish to allow shell escapes.
28 * (This is possible only if your system supplies the system() function.)
29 */
30#define	SHELL_ESCAPE	(!SECURE)
31
32/*
33 * EXAMINE is 1 if you wish to allow examining files by name from within less.
34 */
35#define	EXAMINE		(!SECURE)
36
37/*
38 * TAB_COMPLETE_FILENAME is 1 if you wish to allow the TAB key
39 * to complete filenames at prompts.
40 */
41#define	TAB_COMPLETE_FILENAME	(!SECURE)
42
43/*
44 * CMD_HISTORY is 1 if you wish to allow keys to cycle through
45 * previous commands at prompts.
46 */
47#define	CMD_HISTORY	1
48
49/*
50 * HILITE_SEARCH is 1 if you wish to have search targets to be 
51 * displayed in standout mode.
52 */
53#define	HILITE_SEARCH	1
54
55/*
56 * EDITOR is 1 if you wish to allow editor invocation (the "v" command).
57 * (This is possible only if your system supplies the system() function.)
58 * EDIT_PGM is the name of the (default) editor to be invoked.
59 */
60#define	EDITOR		(!SECURE)
61#define	EDIT_PGM	"vi"
62
63/*
64 * TAGS is 1 if you wish to support tag files.
65 */
66#define	TAGS		(!SECURE)
67
68/*
69 * USERFILE is 1 if you wish to allow a .less file to specify 
70 * user-defined key bindings.
71 */
72#define	USERFILE	(!SECURE)
73
74/*
75 * GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
76 * This will generally work if your system provides the "popen" function
77 * and the "echo" shell command.
78 */
79#ifdef __DJGPP__
80#define	GLOB		(!SECURE)
81#else
82#define	GLOB		0
83#endif
84
85/*
86 * PIPEC is 1 if you wish to have the "|" command
87 * which allows the user to pipe data into a shell command.
88 */
89#ifdef __DJGPP__
90#define	PIPEC		(!SECURE)
91#else
92#define	PIPEC		0
93#endif
94
95/*
96 * LOGFILE is 1 if you wish to allow the -o option (to create log files).
97 */
98#define	LOGFILE		(!SECURE)
99
100/*
101 * GNU_OPTIONS is 1 if you wish to support the GNU-style command
102 * line options --help and --version.
103 */
104#define	GNU_OPTIONS	1
105
106/*
107 * ONLY_RETURN is 1 if you want RETURN to be the only input which
108 * will continue past an error message.
109 * Otherwise, any key will continue past an error message.
110 */
111#define	ONLY_RETURN	0
112
113/*
114 * LESSKEYFILE is the filename of the default lesskey output file 
115 * (in the HOME directory).
116 * LESSKEYFILE_SYS is the filename of the system-wide lesskey output file.
117 * DEF_LESSKEYINFILE is the filename of the default lesskey input 
118 * (in the HOME directory).
119 * LESSHISTFILE is the filename of the history file
120 * (in the HOME directory).
121 */
122#define	LESSKEYFILE		"_less"
123#define	LESSKEYFILE_SYS		"c:\\_sysless"
124#define	DEF_LESSKEYINFILE	"_lesskey"
125#define	LESSKEYINFILE_SYS	"c:\\_syslesskey"
126#define LESSHISTFILE		"_lesshst"
127
128
129/* Settings always true for MS-DOS systems.  */
130
131/*
132 * Define MSDOS_COMPILER if compiling for MS-DOS.
133 */
134#ifdef __DJGPP__
135#define	MSDOS_COMPILER		DJGPPC
136#else
137#ifdef __BORLANDC__
138#define	MSDOS_COMPILER		BORLANDC
139#else
140#define	MSDOS_COMPILER		MSOFTC
141#endif
142#endif
143
144/*
145 * Pathname separator character.
146 */
147#define	PATHNAME_SEP	"\\"
148
149/*
150 * HAVE_ANSI_PROTOS	is 1 if your compiler supports ANSI function prototypes.
151 */
152#define HAVE_ANSI_PROTOS	1
153
154/*
155 * HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
156 */
157#define HAVE_SYS_TYPES_H	1
158
159/*
160 * Define if you have the <sgstat.h> header file.
161 */
162#define HAVE_SGSTAT_H	0
163
164/*
165 * HAVE_PERROR is 1 if your system has the perror() call.
166 * (Actually, if it has sys_errlist, sys_nerr and errno.)
167 */
168#define	HAVE_PERROR	1
169
170/*
171 * HAVE_TIME is 1 if your system has the time() call.
172 */
173#define	HAVE_TIME	1
174
175/*
176 * HAVE_SHELL is 1 if your system supports a SHELL command interpreter.
177 */
178#define	HAVE_SHELL	0
179
180/*
181 * Default shell metacharacters and meta-escape character.
182 */
183#define	DEF_METACHARS	"; *?\t\n'\"()<>|&"
184#define	DEF_METAESCAPE	""
185
186/* 
187 * HAVE_DUP is 1 if your system has the dup() call.
188 */
189#define	HAVE_DUP	1
190
191/* Define to 1 to support reading lesskey source files (not just binary). */
192#define HAVE_LESSKEYSRC 1
193
194/*
195 * Sizes of various buffers.
196 */
197#if 0 /* old sizes for small memory machines
198#define	CMDBUF_SIZE	512	/* Buffer for multichar commands */
199#define	UNGOT_SIZE	100	/* Max chars to unget() */
200#define	LINEBUF_SIZE	1024	/* Max size of line in input file */
201#define	OUTBUF_SIZE	1024	/* Output buffer */
202#define	PROMPT_SIZE	200	/* Max size of prompt string */
203#define	TERMBUF_SIZE	2048	/* Termcap buffer for tgetent */
204#define	TERMSBUF_SIZE	1024	/* Buffer to hold termcap strings */
205#define	TAGLINE_SIZE	512	/* Max size of line in tags file */
206#define	TABSTOP_MAX	32	/* Max number of custom tab stops */
207#else /* more reasonable sizes for modern machines */
208#define	CMDBUF_SIZE	2048	/* Buffer for multichar commands */
209#define	UNGOT_SIZE	200	/* Max chars to unget() */
210#define	LINEBUF_SIZE	1024	/* Initial max size of line in input file */
211#define	OUTBUF_SIZE	1024	/* Output buffer */
212#define	PROMPT_SIZE	2048	/* Max size of prompt string */
213#define	TERMBUF_SIZE	2048	/* Termcap buffer for tgetent */
214#define	TERMSBUF_SIZE	1024	/* Buffer to hold termcap strings */
215#define	TAGLINE_SIZE	1024	/* Max size of line in tags file */
216#define	TABSTOP_MAX	128	/* Max number of custom tab stops */
217#endif
218
219/* Define to `long' if <sys/types.h> doesn't define.  */
220#if MSDOS_COMPILER==BORLANDC
221#define	off_t	long 
222#endif
223
224/* Define if you need to in order for stat and other things to work.  */
225/* #undef _POSIX_SOURCE */
226
227/* Define as the return type of signal handlers (int or void).  */
228#define RETSIGTYPE void
229
230
231/*
232 * Regular expression library.
233 * Define exactly one of the following to be 1:
234 * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h
235 * HAVE_RE_COMP: BSD re_comp()
236 * HAVE_REGCMP: System V regcmp()
237 * HAVE_V8_REGCOMP: Henry Spencer V8 regcomp() and regexp.h
238 * NO_REGEX: pattern matching is supported, but without metacharacters.
239 */
240/* #undef HAVE_POSIX_REGCOMP */
241/* #undef HAVE_RE_COMP */
242/* #undef HAVE_REGCMP */
243/* #undef HAVE_V8_REGCOMP */
244#if MSDOS_COMPILER==DJGPPC
245#define	HAVE_POSIX_REGCOMP 1
246#else
247#define NO_REGEX 1
248#endif
249
250/* Define HAVE_VOID if your compiler supports the "void" type. */
251#define HAVE_VOID 1
252
253/* Define HAVE_CONST if your compiler supports the "const" modifier. */
254#define HAVE_CONST 1
255
256/* Define HAVE_TIME_T if your system supports the "time_t" type. */
257#define HAVE_TIME_T 1
258
259/* Define HAVE_STRERROR if you have the strerror() function. */
260#define HAVE_STRERROR 1
261
262/* Define HAVE_FILENO if you have the fileno() macro. */
263#define HAVE_FILENO 1
264
265/* Define HAVE_ERRNO if you have the errno variable */
266/* Define MUST_DEFINE_ERRNO if you have errno but it is not defined
267 * in errno.h */
268#if MSDOS_COMPILER==MSOFTC || MSDOS_COMPILER==DJGPPC
269#define HAVE_ERRNO 1
270#define MUST_DEFINE_ERRNO 0
271#else
272#define HAVE_ERRNO 1
273#define MUST_DEFINE_ERRNO 1
274#endif
275
276/* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable */
277#define HAVE_SYS_ERRLIST 1
278
279/* Define HAVE_OSPEED if your termcap library has the ospeed variable */
280/* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined
281 * in termcap.h. */
282#define HAVE_OSPEED 0
283#define MUST_DEFINE_OSPEED 0
284
285/* Define HAVE_LOCALE if you have locale.h and setlocale. */
286#define HAVE_LOCALE 0
287
288/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */
289#define HAVE_TERMIOS_FUNCS 0
290
291/* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower */
292#define HAVE_UPPER_LOWER 1
293
294/* Define if you have the _setjmp function.  */
295#if MSDOS_COMPILER==MSOFTC || MSDOS_COMPILER==DJGPPC
296#define HAVE__SETJMP	0
297#else
298#define HAVE__SETJMP	1
299#endif
300
301/* Define if you have the memcpy function.  */
302#define HAVE_MEMCPY 1
303
304/* Define if you have the popen function.  */
305#if MSDOS_COMPILER==DJGPPC
306#define HAVE_POPEN	1
307#else
308#define HAVE_POPEN	0
309#endif
310
311/* Define if you have the sigsetmask function.  */
312#define HAVE_SIGSETMASK	0
313
314/* Define if you have the sigprocmask function.  */
315#define HAVE_SIGPROCMASK	0
316
317/* Define if you have the sigset_t type and sigemptyset macro */
318#define HAVE_SIGSET_T	0
319#define HAVE_SIGEMPTYSET	0
320
321/* Define if you have the stat function.  */
322#define HAVE_STAT 1
323
324/* Define if you have the strchr function.  */
325#define HAVE_STRCHR 1
326
327/* Define if you have the system function.  */
328#define HAVE_SYSTEM	1
329
330/* Define if you have the snprintf function.  */
331#define HAVE_SNPRINTF	0
332
333/* Define if you have the <ctype.h> header file.  */
334#define HAVE_CTYPE_H 1
335
336/* Define if you have the <wctype.h> header file.  */
337#define HAVE_WCTYPE_H 0
338
339/* Define if you have the <errno.h> header file.  */
340#define HAVE_ERRNO_H 1
341
342/* Define if you have the <fcntl.h> header file.  */
343#define HAVE_FCNTL_H 1
344
345/* Define if you have the <limits.h> header file.  */
346#define HAVE_LIMITS_H 1
347
348/* Define if you have the <stdio.h> header file.  */
349#define HAVE_STDIO_H 1
350
351/* Define if you have the <stdlib> header file. */
352#define HAVE_STDLIB_H 1
353
354/* Define if you have the <string.h> header file.  */
355#define HAVE_STRING_H 1
356
357/* Define if you have the <sys/ioctl.h> header file.  */
358#define HAVE_SYS_IOCTL_H 0
359
360/* Define if you have the <sys/ptem.h> header file.  */
361#define HAVE_SYS_PTEM_H	0
362
363/* Define if you have the <sys/stream.h> header file.  */
364#define HAVE_SYS_STREAM_H	0
365
366/* Define if you have the <termcap.h> header file.  */
367#define HAVE_TERMCAP_H	0
368
369/* Define if you have the <termio.h> header file.  */
370#define HAVE_TERMIO_H	0
371
372/* Define if you have the <termios.h> header file.  */
373#define HAVE_TERMIOS_H 0
374
375/* Define if you have the <time.h> header file.  */
376#define HAVE_TIME_H 1
377
378/* Define if you have the <unistd.h> header file.  */
379#if MSDOS_COMPILER==DJGPPC
380#define HAVE_UNISTD_H 1
381#else
382#define HAVE_UNISTD_H 0
383#endif
384
385/* Define if you have the <values.h> header file.  */
386#if MSDOS_COMPILER==MSOFTC
387#define HAVE_VALUES_H 0
388#else
389#define HAVE_VALUES_H 1
390#endif
391
392#if MSDOS_COMPILER == MSOFTC && _MSC_VER >= 700
393/*
394 * The names of these things changed in Microsoft C version 7.0.
395 */
396#define videoconfig	_videoconfig
397#define rccoord		_rccoord
398#define O_RDONLY	_O_RDONLY
399#define O_WRONLY	_O_WRONLY
400#define O_APPEND	_O_APPEND
401#define O_BINARY	_O_BINARY
402#define O_TEXT		_O_TEXT
403#define find_t		_find_t
404#define stat		_stat
405#define S_IFMT		_S_IFMT
406#define S_IFDIR		_S_IFDIR
407#define S_IFREG		_S_IFREG
408#define dup		_dup
409#define open		_open
410#define lseek		_lseek
411#define write		_write
412#define creat		_creat
413#define fstat		_fstat
414#define isatty		_isatty
415#define close		_close
416#define read		_read
417#define ungetch		_ungetch
418#define kbhit		_kbhit
419#define getch		_getch
420#endif
421