1238730Sdelphij/*
2294286Sdelphij * Copyright (C) 1984-2015  Mark Nudelman
3238730Sdelphij *
4238730Sdelphij * You may distribute under the terms of either the GNU General Public
5238730Sdelphij * License or the Less License, as specified in the README file.
6238730Sdelphij *
7238730Sdelphij * For more information, see the README file.
8238730Sdelphij */
960786Sps
10170259Sdelphij#define NEWBOT 1
1160786Sps
1260786Sps/*
1360786Sps * Standard include file for "less".
1460786Sps */
1560786Sps
1660786Sps/*
1760786Sps * Defines for MSDOS_COMPILER.
1860786Sps */
1960786Sps#define	MSOFTC		1	/* Microsoft C */
2060786Sps#define	BORLANDC	2	/* Borland C */
2160786Sps#define	WIN32C		3	/* Windows (Borland C or Microsoft C) */
2260786Sps#define	DJGPPC		4	/* DJGPP C */
2360786Sps
2460786Sps/*
2560786Sps * Include the file of compile-time options.
2660786Sps * The <> make cc search for it in -I., not srcdir.
2760786Sps */
2860786Sps#include <defines.h>
2960786Sps
3060786Sps#ifdef _SEQUENT_
3160786Sps/*
3260786Sps * Kludge for Sequent Dynix systems that have sigsetmask, but
3360786Sps * it's not compatible with the way less calls it.
3460786Sps * {{ Do other systems need this? }}
3560786Sps */
3660786Sps#undef HAVE_SIGSETMASK
3760786Sps#endif
3860786Sps
3960786Sps/*
4060786Sps * Language details.
4160786Sps */
4260786Sps#if HAVE_VOID
4360786Sps#define	VOID_POINTER	void *
4460786Sps#else
4560786Sps#define	VOID_POINTER	char *
4660786Sps#define	void  int
4760786Sps#endif
4860786Sps#if HAVE_CONST
4960786Sps#define	constant	const
5060786Sps#else
5160786Sps#define	constant
5260786Sps#endif
5360786Sps
5460786Sps#define	public		/* PUBLIC FUNCTION */
5560786Sps
5660786Sps/* Library function declarations */
5760786Sps
5860786Sps#if HAVE_SYS_TYPES_H
5960786Sps#include <sys/types.h>
6060786Sps#endif
6160786Sps#if HAVE_STDIO_H
6260786Sps#include <stdio.h>
6360786Sps#endif
6460786Sps#if HAVE_FCNTL_H
6560786Sps#include <fcntl.h>
6660786Sps#endif
6760786Sps#if HAVE_UNISTD_H
6860786Sps#include <unistd.h>
6960786Sps#endif
7060786Sps#if HAVE_CTYPE_H
7160786Sps#include <ctype.h>
7260786Sps#endif
73173685Sdelphij#if HAVE_WCTYPE_H
74173685Sdelphij#include <wctype.h>
75173685Sdelphij#endif
7689022Sps#if HAVE_LIMITS_H
7789022Sps#include <limits.h>
7889022Sps#endif
7960786Sps#if HAVE_STDLIB_H
8060786Sps#include <stdlib.h>
8160786Sps#endif
8260786Sps#if HAVE_STRING_H
8360786Sps#include <string.h>
8460786Sps#endif
85161478Sdelphij
86161478Sdelphij/* OS-specific includes */
8760786Sps#ifdef _OSK
8860786Sps#include <modes.h>
8960786Sps#include <strings.h>
9060786Sps#endif
91161478Sdelphij
92161478Sdelphij#ifdef __TANDEM
93161478Sdelphij#include <floss.h>
94161478Sdelphij#endif
95161478Sdelphij
9689022Sps#if MSDOS_COMPILER==WIN32C || OS2
9760786Sps#include <io.h>
9860786Sps#endif
99161478Sdelphij
10060786Sps#if MSDOS_COMPILER==DJGPPC
10160786Sps#include <io.h>
10260786Sps#include <sys/exceptn.h>
10360786Sps#include <conio.h>
10460786Sps#include <pc.h>
10560786Sps#endif
10660786Sps
10760786Sps#if !HAVE_STDLIB_H
10860786Spschar *getenv();
10960786Spsoff_t lseek();
11060786SpsVOID_POINTER calloc();
11160786Spsvoid free();
11260786Sps#endif
11360786Sps
11460786Sps/*
11560786Sps * Simple lowercase test which can be used during option processing
11660786Sps * (before options are parsed which might tell us what charset to use).
11760786Sps */
118161478Sdelphij#define ASCII_IS_UPPER(c)	((c) >= 'A' && (c) <= 'Z')
119161478Sdelphij#define ASCII_IS_LOWER(c)	((c) >= 'a' && (c) <= 'z')
120161478Sdelphij#define	ASCII_TO_UPPER(c)	((c) - 'a' + 'A')
121161478Sdelphij#define	ASCII_TO_LOWER(c)	((c) - 'A' + 'a')
12260786Sps
123161478Sdelphij#undef IS_UPPER
124161478Sdelphij#undef IS_LOWER
125161478Sdelphij#undef TO_UPPER
126161478Sdelphij#undef TO_LOWER
127161478Sdelphij#undef IS_SPACE
128161478Sdelphij#undef IS_DIGIT
129161478Sdelphij
130173685Sdelphij#if HAVE_WCTYPE
131173685Sdelphij#define	IS_UPPER(c)	iswupper(c)
132173685Sdelphij#define	IS_LOWER(c)	iswlower(c)
133173685Sdelphij#define	TO_UPPER(c)	towupper(c)
134173685Sdelphij#define	TO_LOWER(c)	towlower(c)
135161478Sdelphij#else
136173685Sdelphij#if HAVE_UPPER_LOWER
137161478Sdelphij#define	IS_UPPER(c)	isupper((unsigned char) (c))
138161478Sdelphij#define	IS_LOWER(c)	islower((unsigned char) (c))
139161478Sdelphij#define	TO_UPPER(c)	toupper((unsigned char) (c))
140161478Sdelphij#define	TO_LOWER(c)	tolower((unsigned char) (c))
141173685Sdelphij#else
142173685Sdelphij#define	IS_UPPER(c)	ASCII_IS_UPPER(c)
143173685Sdelphij#define	IS_LOWER(c)	ASCII_IS_LOWER(c)
144173685Sdelphij#define	TO_UPPER(c)	ASCII_TO_UPPER(c)
145173685Sdelphij#define	TO_LOWER(c)	ASCII_TO_LOWER(c)
14660786Sps#endif
147173685Sdelphij#endif
14860786Sps
149161478Sdelphij#ifdef isspace
150161478Sdelphij#define IS_SPACE(c)	isspace((unsigned char)(c))
151161478Sdelphij#else
152161478Sdelphij#define IS_SPACE(c)	((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) == '\r' || (c) == '\f')
153161478Sdelphij#endif
154161478Sdelphij
155161478Sdelphij#ifdef isdigit
156161478Sdelphij#define IS_DIGIT(c)	isdigit((unsigned char)(c))
157161478Sdelphij#else
158161478Sdelphij#define IS_DIGIT(c)	((c) >= '0' && (c) <= '9')
159161478Sdelphij#endif
160161478Sdelphij
161191930Sdelphij#define IS_CSI_START(c)	(((LWCHAR)(c)) == ESC || (((LWCHAR)(c)) == CSI))
162172471Sdelphij
16360786Sps#ifndef NULL
16460786Sps#define	NULL	0
16560786Sps#endif
16660786Sps
16760786Sps#ifndef TRUE
16860786Sps#define	TRUE		1
16960786Sps#endif
17060786Sps#ifndef FALSE
17160786Sps#define	FALSE		0
17260786Sps#endif
17360786Sps
17460786Sps#define	OPT_OFF		0
17560786Sps#define	OPT_ON		1
17660786Sps#define	OPT_ONPLUS	2
17760786Sps
17860786Sps#if !HAVE_MEMCPY
17960786Sps#ifndef memcpy
18060786Sps#define	memcpy(to,from,len)	bcopy((from),(to),(len))
18160786Sps#endif
18260786Sps#endif
18360786Sps
184161478Sdelphij#if HAVE_SNPRINTF
185161478Sdelphij#define SNPRINTF1(str, size, fmt, v1)             snprintf((str), (size), (fmt), (v1))
186161478Sdelphij#define SNPRINTF2(str, size, fmt, v1, v2)         snprintf((str), (size), (fmt), (v1), (v2))
187161478Sdelphij#define SNPRINTF3(str, size, fmt, v1, v2, v3)     snprintf((str), (size), (fmt), (v1), (v2), (v3))
188161478Sdelphij#define SNPRINTF4(str, size, fmt, v1, v2, v3, v4) snprintf((str), (size), (fmt), (v1), (v2), (v3), (v4))
189161478Sdelphij#else
190161478Sdelphij/* Use unsafe sprintf if we don't have snprintf. */
191161478Sdelphij#define SNPRINTF1(str, size, fmt, v1)             sprintf((str), (fmt), (v1))
192161478Sdelphij#define SNPRINTF2(str, size, fmt, v1, v2)         sprintf((str), (fmt), (v1), (v2))
193161478Sdelphij#define SNPRINTF3(str, size, fmt, v1, v2, v3)     sprintf((str), (fmt), (v1), (v2), (v3))
194161478Sdelphij#define SNPRINTF4(str, size, fmt, v1, v2, v3, v4) sprintf((str), (fmt), (v1), (v2), (v3), (v4))
195161478Sdelphij#endif
196161478Sdelphij
19760786Sps#define	BAD_LSEEK	((off_t)-1)
19860786Sps
199173685Sdelphij#ifndef SEEK_SET
200173685Sdelphij#define SEEK_SET 0
201173685Sdelphij#endif
202173685Sdelphij#ifndef SEEK_END
203173685Sdelphij#define SEEK_END 2
204173685Sdelphij#endif
205173685Sdelphij
20689022Sps#ifndef CHAR_BIT
20789022Sps#define CHAR_BIT 8
20889022Sps#endif
20989022Sps
21060786Sps/*
21189022Sps * Upper bound on the string length of an integer converted to string.
21289022Sps * 302 / 1000 is ceil (log10 (2.0)).  Subtract 1 for the sign bit;
21389022Sps * add 1 for integer division truncation; add 1 more for a minus sign.
21489022Sps */
21589022Sps#define INT_STRLEN_BOUND(t) ((sizeof(t) * CHAR_BIT - 1) * 302 / 1000 + 1 + 1)
21689022Sps
21789022Sps/*
21860786Sps * Special types and constants.
21960786Sps */
220161478Sdelphijtypedef unsigned long LWCHAR;
22160814Spstypedef off_t		POSITION;
222128348Stjrtypedef off_t		LINENUM;
223128348Stjr#define MIN_LINENUM_WIDTH  7	/* Min printing width of a line number */
224161478Sdelphij#define MAX_UTF_CHAR_LEN   6	/* Max bytes in one UTF-8 char */
22560786Sps
22660786Sps#define	NULL_POSITION	((POSITION)(-1))
22760786Sps
22860786Sps/*
22960786Sps * Flags for open()
23060786Sps */
23160786Sps#if MSDOS_COMPILER || OS2
23260786Sps#define	OPEN_READ	(O_RDONLY|O_BINARY)
23360786Sps#else
23460786Sps#ifdef _OSK
23560786Sps#define	OPEN_READ	(S_IREAD)
23660786Sps#else
23760786Sps#ifdef O_RDONLY
23860786Sps#define	OPEN_READ	(O_RDONLY)
23960786Sps#else
24060786Sps#define	OPEN_READ	(0)
24160786Sps#endif
24260786Sps#endif
24360786Sps#endif
24460786Sps
24560786Sps#if defined(O_WRONLY) && defined(O_APPEND)
24660786Sps#define	OPEN_APPEND	(O_APPEND|O_WRONLY)
24760786Sps#else
24860786Sps#ifdef _OSK
24960786Sps#define OPEN_APPEND	(S_IWRITE)
25060786Sps#else
25160786Sps#define	OPEN_APPEND	(1)
25260786Sps#endif
25360786Sps#endif
25460786Sps
25560786Sps/*
25660786Sps * Set a file descriptor to binary mode.
25760786Sps */
25860786Sps#if MSDOS_COMPILER==MSOFTC
25960786Sps#define	SET_BINARY(f)	_setmode(f, _O_BINARY);
26060786Sps#else
26189022Sps#if MSDOS_COMPILER || OS2
26260786Sps#define	SET_BINARY(f)	setmode(f, O_BINARY)
26360786Sps#else
26460786Sps#define	SET_BINARY(f)
26560786Sps#endif
26660786Sps#endif
26760786Sps
26860786Sps/*
26960786Sps * Does the shell treat "?" as a metacharacter?
27060786Sps */
27160786Sps#if MSDOS_COMPILER || OS2 || _OSK
27260786Sps#define	SHELL_META_QUEST 0
27360786Sps#else
27460786Sps#define	SHELL_META_QUEST 1
27560786Sps#endif
27660786Sps
27760786Sps#define	SPACES_IN_FILENAMES 1
27860786Sps
27960786Sps/*
28060786Sps * An IFILE represents an input file.
28160786Sps */
28260786Sps#define	IFILE		VOID_POINTER
28360786Sps#define	NULL_IFILE	((IFILE)NULL)
28460786Sps
28560786Sps/*
28660786Sps * The structure used to represent a "screen position".
28760786Sps * This consists of a file position, and a screen line number.
28860786Sps * The meaning is that the line starting at the given file
28960786Sps * position is displayed on the ln-th line of the screen.
29060786Sps * (Screen lines before ln are empty.)
29160786Sps */
29260786Spsstruct scrpos
29360786Sps{
29460786Sps	POSITION pos;
29560786Sps	int ln;
29660786Sps};
29760786Sps
298294286Sdelphij/*
299294286Sdelphij * A mark is an ifile (input file) plus a position within the file.
300294286Sdelphij */
301294286Sdelphijstruct mark
302294286Sdelphij{
303294286Sdelphij	IFILE m_ifile;
304294286Sdelphij	struct scrpos m_scrpos;
305294286Sdelphij};
306294286Sdelphij
30760786Spstypedef union parg
30860786Sps{
30960786Sps	char *p_string;
31060786Sps	int p_int;
311128348Stjr	LINENUM p_linenum;
31260786Sps} PARG;
31360786Sps
31460786Sps#define	NULL_PARG	((PARG *)NULL)
31560786Sps
31660786Spsstruct textlist
31760786Sps{
31860786Sps	char *string;
31960786Sps	char *endstring;
32060786Sps};
32160786Sps
322294286Sdelphijstruct wchar_range
323294286Sdelphij{
324294286Sdelphij	LWCHAR first, last;
325294286Sdelphij};
326294286Sdelphij
327294286Sdelphijstruct wchar_range_table
328294286Sdelphij{
329294286Sdelphij	struct wchar_range *table;
330294286Sdelphij	int count;
331294286Sdelphij};
332294286Sdelphij
33360786Sps#define	EOI		(-1)
33460786Sps
33560786Sps#define	READ_INTR	(-2)
33660786Sps
337170259Sdelphij/* A fraction is represented by an int n; the fraction is n/NUM_FRAC_DENOM */
338170259Sdelphij#define NUM_FRAC_DENOM			1000000
339170259Sdelphij#define NUM_LOG_FRAC_DENOM		6
340170259Sdelphij
34160786Sps/* How quiet should we be? */
34260786Sps#define	NOT_QUIET	0	/* Ring bell at eof and for errors */
34360786Sps#define	LITTLE_QUIET	1	/* Ring bell only for errors */
34460786Sps#define	VERY_QUIET	2	/* Never ring bell */
34560786Sps
34660786Sps/* How should we prompt? */
34760786Sps#define	PR_SHORT	0	/* Prompt with colon */
34860786Sps#define	PR_MEDIUM	1	/* Prompt with message */
34960786Sps#define	PR_LONG		2	/* Prompt with longer message */
35060786Sps
35160786Sps/* How should we handle backspaces? */
35260786Sps#define	BS_SPECIAL	0	/* Do special things for underlining and bold */
35360786Sps#define	BS_NORMAL	1	/* \b treated as normal char; actually output */
35460786Sps#define	BS_CONTROL	2	/* \b treated as control char; prints as ^H */
35560786Sps
35660786Sps/* How should we search? */
357191930Sdelphij#define	SRCH_FORW       (1 << 0)  /* Search forward from current position */
358191930Sdelphij#define	SRCH_BACK       (1 << 1)  /* Search backward from current position */
359191930Sdelphij#define SRCH_NO_MOVE    (1 << 2)  /* Highlight, but don't move */
360191930Sdelphij#define SRCH_FIND_ALL   (1 << 4)  /* Find and highlight all matches */
361191930Sdelphij#define SRCH_NO_MATCH   (1 << 8)  /* Search for non-matching lines */
362191930Sdelphij#define SRCH_PAST_EOF   (1 << 9)  /* Search past end-of-file, into next file */
363191930Sdelphij#define SRCH_FIRST_FILE (1 << 10) /* Search starting at the first file */
364191930Sdelphij#define SRCH_NO_REGEX   (1 << 12) /* Don't use regular expressions */
365191930Sdelphij#define SRCH_FILTER     (1 << 13) /* Search is for '&' (filter) command */
366221715Sdelphij#define SRCH_AFTER_TARGET (1 << 14) /* Start search after the target line */
36760786Sps
36860786Sps#define	SRCH_REVERSE(t)	(((t) & SRCH_FORW) ? \
36960786Sps				(((t) & ~SRCH_FORW) | SRCH_BACK) : \
37060786Sps				(((t) & ~SRCH_BACK) | SRCH_FORW))
37160786Sps
37260786Sps/* */
37360786Sps#define	NO_MCA		0
37460786Sps#define	MCA_DONE	1
37560786Sps#define	MCA_MORE	2
37660786Sps
37760786Sps#define	CC_OK		0	/* Char was accepted & processed */
37860786Sps#define	CC_QUIT		1	/* Char was a request to abort current cmd */
37960786Sps#define	CC_ERROR	2	/* Char could not be accepted due to error */
38060786Sps#define	CC_PASS		3	/* Char was rejected (internal) */
38160786Sps
38260786Sps#define CF_QUIT_ON_ERASE 0001   /* Abort cmd if its entirely erased */
38360786Sps
384161478Sdelphij/* Special char bit-flags used to tell put_line() to do something special */
38560786Sps#define	AT_NORMAL	(0)
386161478Sdelphij#define	AT_UNDERLINE	(1 << 0)
387161478Sdelphij#define	AT_BOLD		(1 << 1)
388161478Sdelphij#define	AT_BLINK	(1 << 2)
389161478Sdelphij#define	AT_STANDOUT	(1 << 3)
390161478Sdelphij#define	AT_ANSI		(1 << 4)  /* Content-supplied "ANSI" escape sequence */
391161478Sdelphij#define	AT_BINARY	(1 << 5)  /* LESS*BINFMT representation */
392161478Sdelphij#define	AT_HILITE	(1 << 6)  /* Internal highlights (e.g., for search) */
39360786Sps
39489022Sps#if '0' == 240
39589022Sps#define IS_EBCDIC_HOST 1
39689022Sps#endif
39789022Sps
39860786Sps#if IS_EBCDIC_HOST
39960786Sps/*
40060786Sps * Long definition for EBCDIC.
40160786Sps * Since the argument is usually a constant, this macro normally compiles
40260786Sps * into a constant.
40360786Sps */
40460786Sps#define CONTROL(c) ( \
40560786Sps	(c)=='[' ? '\047' : \
40660786Sps	(c)=='a' ? '\001' : \
40760786Sps	(c)=='b' ? '\002' : \
40860786Sps	(c)=='c' ? '\003' : \
40960786Sps	(c)=='d' ? '\067' : \
41060786Sps	(c)=='e' ? '\055' : \
41160786Sps	(c)=='f' ? '\056' : \
41260786Sps	(c)=='g' ? '\057' : \
41360786Sps	(c)=='h' ? '\026' : \
41460786Sps	(c)=='i' ? '\005' : \
41560786Sps	(c)=='j' ? '\025' : \
41660786Sps	(c)=='k' ? '\013' : \
41760786Sps	(c)=='l' ? '\014' : \
41860786Sps	(c)=='m' ? '\015' : \
41960786Sps	(c)=='n' ? '\016' : \
42060786Sps	(c)=='o' ? '\017' : \
42160786Sps	(c)=='p' ? '\020' : \
42260786Sps	(c)=='q' ? '\021' : \
42360786Sps	(c)=='r' ? '\022' : \
42460786Sps	(c)=='s' ? '\023' : \
42560786Sps	(c)=='t' ? '\074' : \
42660786Sps	(c)=='u' ? '\075' : \
42760786Sps	(c)=='v' ? '\062' : \
42860786Sps	(c)=='w' ? '\046' : \
42960786Sps	(c)=='x' ? '\030' : \
43060786Sps	(c)=='y' ? '\031' : \
43160786Sps	(c)=='z' ? '\077' : \
43260786Sps	(c)=='A' ? '\001' : \
43360786Sps	(c)=='B' ? '\002' : \
43460786Sps	(c)=='C' ? '\003' : \
43560786Sps	(c)=='D' ? '\067' : \
43660786Sps	(c)=='E' ? '\055' : \
43760786Sps	(c)=='F' ? '\056' : \
43860786Sps	(c)=='G' ? '\057' : \
43960786Sps	(c)=='H' ? '\026' : \
44060786Sps	(c)=='I' ? '\005' : \
44160786Sps	(c)=='J' ? '\025' : \
44260786Sps	(c)=='K' ? '\013' : \
44360786Sps	(c)=='L' ? '\014' : \
44460786Sps	(c)=='M' ? '\015' : \
44560786Sps	(c)=='N' ? '\016' : \
44660786Sps	(c)=='O' ? '\017' : \
44760786Sps	(c)=='P' ? '\020' : \
44860786Sps	(c)=='Q' ? '\021' : \
44960786Sps	(c)=='R' ? '\022' : \
45060786Sps	(c)=='S' ? '\023' : \
45160786Sps	(c)=='T' ? '\074' : \
45260786Sps	(c)=='U' ? '\075' : \
45360786Sps	(c)=='V' ? '\062' : \
45460786Sps	(c)=='W' ? '\046' : \
45560786Sps	(c)=='X' ? '\030' : \
45660786Sps	(c)=='Y' ? '\031' : \
45760786Sps	(c)=='Z' ? '\077' : \
45860786Sps	(c)=='|' ? '\031' : \
45960786Sps	(c)=='\\' ? '\034' : \
46060786Sps	(c)=='^' ? '\036' : \
46160786Sps	(c)&077)
46260786Sps#else
46360786Sps#define	CONTROL(c)	((c)&037)
46460786Sps#endif /* IS_EBCDIC_HOST */
46560786Sps
46660786Sps#define	ESC		CONTROL('[')
467172471Sdelphij#define	CSI		((unsigned char)'\233')
468294286Sdelphij#define	CHAR_END_COMMAND 0x40000000
46960786Sps
47060786Sps#if _OSK_MWC32
47160786Sps#define	LSIGNAL(sig,func)	os9_signal(sig,func)
47260786Sps#else
47360786Sps#define	LSIGNAL(sig,func)	signal(sig,func)
47460786Sps#endif
47560786Sps
47663131Sps#if HAVE_SIGPROCMASK
47763131Sps#if HAVE_SIGSET_T
47863131Sps#else
47963131Sps#undef HAVE_SIGPROCMASK
48063131Sps#endif
48163131Sps#endif
48263131Sps#if HAVE_SIGPROCMASK
48363131Sps#if HAVE_SIGEMPTYSET
48463131Sps#else
48563131Sps#undef  sigemptyset
48663131Sps#define sigemptyset(mp) *(mp) = 0
48763131Sps#endif
48863131Sps#endif
48963131Sps
49060786Sps#define	S_INTERRUPT	01
49160786Sps#define	S_STOP		02
49260786Sps#define S_WINCH		04
49360786Sps#define	ABORT_SIGS()	(sigs & (S_INTERRUPT|S_STOP))
49460786Sps
49560786Sps#define	QUIT_OK		0
49660786Sps#define	QUIT_ERROR	1
497221715Sdelphij#define	QUIT_INTERRUPT	2
49860786Sps#define	QUIT_SAVED_STATUS (-1)
49960786Sps
500173685Sdelphij#define FOLLOW_DESC     0
501173685Sdelphij#define FOLLOW_NAME     1
502173685Sdelphij
50360786Sps/* filestate flags */
50460786Sps#define	CH_CANSEEK	001
50560786Sps#define	CH_KEEPOPEN	002
50660786Sps#define	CH_POPENED	004
50760786Sps#define	CH_HELPFILE	010
508237613Sdelphij#define	CH_NODATA  	020	/* Special case for zero length files */
50960786Sps
510237613Sdelphij
51160786Sps#define	ch_zero()	((POSITION)0)
51260786Sps
51360786Sps#define	FAKE_HELPFILE	"@/\\less/\\help/\\file/\\@"
514237613Sdelphij#define FAKE_EMPTYFILE	"@/\\less/\\empty/\\file/\\@"
51560786Sps
516195941Sdelphij/* Flags for cvt_text */
517195941Sdelphij#define	CVT_TO_LC	01	/* Convert upper-case to lower-case */
518195941Sdelphij#define	CVT_BS		02	/* Do backspace processing */
519195941Sdelphij#define	CVT_CRLF	04	/* Remove CR after LF */
520195941Sdelphij#define	CVT_ANSI	010	/* Remove ANSI escape sequences */
521195941Sdelphij
522294286Sdelphij#if HAVE_TIME_T
523294286Sdelphij#define time_type	time_t
524294286Sdelphij#else
525294286Sdelphij#define	time_type	long
526294286Sdelphij#endif
527294286Sdelphij
52860786Sps#include "funcs.h"
52960786Sps
530128348Stjr/* Functions not included in funcs.h */
531128348Stjrvoid postoa();
532128348Stjrvoid linenumtoa();
533128348Stjrvoid inttoa();
534