1139825Simp/* 21541Srgrimes * Copyright (C) 1984-2017 Mark Nudelman 31541Srgrimes * 41541Srgrimes * You may distribute under the terms of either the GNU General Public 51541Srgrimes * License or the Less License, as specified in the README file. 61541Srgrimes * 71541Srgrimes * For more information, see the README file. 81541Srgrimes */ 91541Srgrimes 101541Srgrimes#define NEWBOT 1 111541Srgrimes 121541Srgrimes/* 131541Srgrimes * Standard include file for "less". 141541Srgrimes */ 151541Srgrimes 161541Srgrimes/* 171541Srgrimes * Defines for MSDOS_COMPILER. 181541Srgrimes */ 191541Srgrimes#define MSOFTC 1 /* Microsoft C */ 201541Srgrimes#define BORLANDC 2 /* Borland C */ 211541Srgrimes#define WIN32C 3 /* Windows (Borland C or Microsoft C) */ 221541Srgrimes#define DJGPPC 4 /* DJGPP C */ 231541Srgrimes 241541Srgrimes/* 251541Srgrimes * Include the file of compile-time options. 261541Srgrimes * The <> make cc search for it in -I., not srcdir. 271541Srgrimes */ 281541Srgrimes#include <defines.h> 2922521Sdyson 301541Srgrimes#ifdef _SEQUENT_ 311541Srgrimes/* 32116192Sobrien * Kludge for Sequent Dynix systems that have sigsetmask, but 33116192Sobrien * it's not compatible with the way less calls it. 34116192Sobrien * {{ Do other systems need this? }} 351541Srgrimes */ 3622521Sdyson#undef HAVE_SIGSETMASK 3755206Speter#endif 3822521Sdyson 3998542Smckusick/* 4022521Sdyson * Language details. 411541Srgrimes */ 4231561Sbde#if HAVE_ANSI_PROTOS 4398542Smckusick#define LESSPARAMS(a) a 4498542Smckusick#else 451541Srgrimes#define LESSPARAMS(a) () 4660041Sphk#endif 471541Srgrimes#if HAVE_VOID 4834924Sbde#define VOID_POINTER void * 4934924Sbde#define VOID_PARAM void 501541Srgrimes#else 511541Srgrimes#define VOID_POINTER char * 5298542Smckusick#define VOID_PARAM 5398542Smckusick#define void int 5498542Smckusick#endif 5522521Sdyson#if HAVE_CONST 5698542Smckusick#define constant const 571541Srgrimes#else 58131907Smarcel#define constant 5992728Salfred#endif 6031352Sbde 6131352Sbde#define public /* PUBLIC FUNCTION */ 621541Srgrimes 631541Srgrimes/* Library function declarations */ 641541Srgrimes 651541Srgrimes#if HAVE_SYS_TYPES_H 661541Srgrimes#include <sys/types.h> 671541Srgrimes#endif 6830474Sphk#if HAVE_STDIO_H 6930474Sphk#include <stdio.h> 7030474Sphk#endif 7130474Sphk#if HAVE_FCNTL_H 7230474Sphk#include <fcntl.h> 731541Srgrimes#endif 741541Srgrimes#if HAVE_UNISTD_H 7596506Sphk#include <unistd.h> 761541Srgrimes#endif 7798542Smckusick#if HAVE_CTYPE_H 781541Srgrimes#include <ctype.h> 791541Srgrimes#endif 8030474Sphk#if HAVE_WCTYPE_H 811541Srgrimes#include <wctype.h> 8230474Sphk#endif 831541Srgrimes#if HAVE_LIMITS_H 841541Srgrimes#include <limits.h> 8530474Sphk#endif 8630474Sphk#if HAVE_STDLIB_H 873487Sphk#include <stdlib.h> 881541Srgrimes#endif 891541Srgrimes#if HAVE_STRING_H 901541Srgrimes#include <string.h> 9130474Sphk#endif 9230474Sphk 9330474Sphk/* OS-specific includes */ 941541Srgrimes#ifdef _OSK 951541Srgrimes#include <modes.h> 961541Srgrimes#include <strings.h> 971541Srgrimes#endif 9898542Smckusick 9998542Smckusick#ifdef __TANDEM 10098542Smckusick#include <floss.h> 10198542Smckusick#endif 102108315Sphk 10398542Smckusick#if MSDOS_COMPILER==WIN32C || OS2 10498542Smckusick#include <io.h> 10598542Smckusick#endif 10698542Smckusick 10798542Smckusick#if MSDOS_COMPILER==DJGPPC 10898542Smckusick#include <io.h> 10998542Smckusick#include <sys/exceptn.h> 11098542Smckusick#include <conio.h> 11198542Smckusick#include <pc.h> 11298542Smckusick#endif 11398542Smckusick 11498542Smckusick#if !HAVE_STDLIB_H 11598542Smckusickchar *getenv(); 11698542Smckusickoff_t lseek(); 11798542SmckusickVOID_POINTER calloc(); 11898542Smckusickvoid free(); 11998542Smckusick#endif 12098542Smckusick 12198542Smckusick/* 12298542Smckusick * Simple lowercase test which can be used during option processing 12398542Smckusick * (before options are parsed which might tell us what charset to use). 12498542Smckusick */ 12598542Smckusick#define ASCII_IS_UPPER(c) ((c) >= 'A' && (c) <= 'Z') 12698542Smckusick#define ASCII_IS_LOWER(c) ((c) >= 'a' && (c) <= 'z') 12798542Smckusick#define ASCII_TO_UPPER(c) ((c) - 'a' + 'A') 12898542Smckusick#define ASCII_TO_LOWER(c) ((c) - 'A' + 'a') 12998542Smckusick 13098542Smckusick#undef IS_UPPER 13198542Smckusick#undef IS_LOWER 13298542Smckusick#undef TO_UPPER 13398542Smckusick#undef TO_LOWER 1348876Srgrimes#undef IS_SPACE 1351541Srgrimes#undef IS_DIGIT 1361541Srgrimes 1371541Srgrimes#if HAVE_WCTYPE 1381541Srgrimes#define IS_UPPER(c) iswupper(c) 1391541Srgrimes#define IS_LOWER(c) iswlower(c) 1401541Srgrimes#define TO_UPPER(c) towupper(c) 14122521Sdyson#define TO_LOWER(c) towlower(c) 1421541Srgrimes#else 1431541Srgrimes#if HAVE_UPPER_LOWER 1441541Srgrimes#define IS_UPPER(c) isupper((unsigned char) (c)) 14596506Sphk#define IS_LOWER(c) islower((unsigned char) (c)) 14696506Sphk#define TO_UPPER(c) toupper((unsigned char) (c)) 1471541Srgrimes#define TO_LOWER(c) tolower((unsigned char) (c)) 1481541Srgrimes#else 1491541Srgrimes#define IS_UPPER(c) ASCII_IS_UPPER(c) 1501541Srgrimes#define IS_LOWER(c) ASCII_IS_LOWER(c) 1511541Srgrimes#define TO_UPPER(c) ASCII_TO_UPPER(c) 1521541Srgrimes#define TO_LOWER(c) ASCII_TO_LOWER(c) 1531541Srgrimes#endif 1541541Srgrimes#endif 1551541Srgrimes 1561541Srgrimes#ifdef isspace 1571541Srgrimes#define IS_SPACE(c) isspace((unsigned char)(c)) 1581541Srgrimes#else 1591541Srgrimes#define IS_SPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) == '\r' || (c) == '\f') 1601541Srgrimes#endif 1611541Srgrimes 1621541Srgrimes#ifdef isdigit 1631541Srgrimes#define IS_DIGIT(c) isdigit((unsigned char)(c)) 1641541Srgrimes#else 1651541Srgrimes#define IS_DIGIT(c) ((c) >= '0' && (c) <= '9') 1661541Srgrimes#endif 1671541Srgrimes 168131907Smarcel#define IS_CSI_START(c) (((LWCHAR)(c)) == ESC || (((LWCHAR)(c)) == CSI)) 16942567Seivind 1701541Srgrimes#ifndef NULL 1711541Srgrimes#define NULL 0 1721541Srgrimes#endif 1731541Srgrimes 17496506Sphk#ifndef TRUE 17598542Smckusick#define TRUE 1 1761541Srgrimes#endif 1771541Srgrimes#ifndef FALSE 1781541Srgrimes#define FALSE 0 1791541Srgrimes#endif 1801541Srgrimes 1811541Srgrimes#define OPT_OFF 0 1821541Srgrimes#define OPT_ON 1 1831541Srgrimes#define OPT_ONPLUS 2 1841541Srgrimes 18576173Sphk#if !HAVE_MEMCPY 1861541Srgrimes#ifndef memcpy 1871541Srgrimes#define memcpy(to,from,len) bcopy((from),(to),(len)) 1881541Srgrimes#endif 1891541Srgrimes#endif 1901541Srgrimes 19198687Smux#if HAVE_SNPRINTF 19298542Smckusick#define SNPRINTF1(str, size, fmt, v1) snprintf((str), (size), (fmt), (v1)) 19398542Smckusick#define SNPRINTF2(str, size, fmt, v1, v2) snprintf((str), (size), (fmt), (v1), (v2)) 19423560Smpp#define SNPRINTF3(str, size, fmt, v1, v2, v3) snprintf((str), (size), (fmt), (v1), (v2), (v3)) 1951541Srgrimes#define SNPRINTF4(str, size, fmt, v1, v2, v3, v4) snprintf((str), (size), (fmt), (v1), (v2), (v3), (v4)) 1961541Srgrimes#else 197131907Smarcel/* Use unsafe sprintf if we don't have snprintf. */ 1981541Srgrimes#define SNPRINTF1(str, size, fmt, v1) sprintf((str), (fmt), (v1)) 1991541Srgrimes#define SNPRINTF2(str, size, fmt, v1, v2) sprintf((str), (fmt), (v1), (v2)) 2001541Srgrimes#define SNPRINTF3(str, size, fmt, v1, v2, v3) sprintf((str), (fmt), (v1), (v2), (v3)) 2011541Srgrimes#define SNPRINTF4(str, size, fmt, v1, v2, v3, v4) sprintf((str), (fmt), (v1), (v2), (v3), (v4)) 2021541Srgrimes#endif 2031541Srgrimes 2041541Srgrimes#define BAD_LSEEK ((off_t)-1) 2051541Srgrimes 2061541Srgrimes#ifndef SEEK_SET 2071541Srgrimes#define SEEK_SET 0 20898542Smckusick#endif 2091541Srgrimes#ifndef SEEK_END 2101541Srgrimes#define SEEK_END 2 2111541Srgrimes#endif 2121541Srgrimes 2131541Srgrimes#ifndef CHAR_BIT 2141541Srgrimes#define CHAR_BIT 8 2151541Srgrimes#endif 2161541Srgrimes 2171541Srgrimes/* 2181541Srgrimes * Upper bound on the string length of an integer converted to string. 2191541Srgrimes * 302 / 1000 is ceil (log10 (2.0)). Subtract 1 for the sign bit; 2201541Srgrimes * add 1 for integer division truncation; add 1 more for a minus sign. 2211541Srgrimes */ 2221541Srgrimes#define INT_STRLEN_BOUND(t) ((sizeof(t) * CHAR_BIT - 1) * 302 / 1000 + 1 + 1) 2231541Srgrimes 2241541Srgrimes/* 225207141Sjeff * Special types and constants. 2261541Srgrimes */ 227207141Sjefftypedef unsigned long LWCHAR; 228207141Sjefftypedef off_t POSITION; 2291541Srgrimestypedef off_t LINENUM; 23073942Smckusick#define MIN_LINENUM_WIDTH 7 /* Min printing width of a line number */ 2311541Srgrimes#define MAX_UTF_CHAR_LEN 6 /* Max bytes in one UTF-8 char */ 2321541Srgrimes 2331541Srgrimes#define NULL_POSITION ((POSITION)(-1)) 234207141Sjeff 235207141Sjeff/* 236207141Sjeff * Flags for open() 237207141Sjeff */ 238207141Sjeff#if MSDOS_COMPILER || OS2 239207141Sjeff#define OPEN_READ (O_RDONLY|O_BINARY) 240207141Sjeff#else 241207141Sjeff#ifdef _OSK 242207141Sjeff#define OPEN_READ (S_IREAD) 243207141Sjeff#else 244207141Sjeff#ifdef O_RDONLY 245207141Sjeff#define OPEN_READ (O_RDONLY) 246207141Sjeff#else 247207141Sjeff#define OPEN_READ (0) 248207141Sjeff#endif 249207141Sjeff#endif 250207141Sjeff#endif 251207141Sjeff 252207141Sjeff#if defined(O_WRONLY) && defined(O_APPEND) 253207141Sjeff#define OPEN_APPEND (O_APPEND|O_WRONLY) 254207141Sjeff#else 255207141Sjeff#ifdef _OSK 256207141Sjeff#define OPEN_APPEND (S_IWRITE) 257207141Sjeff#else 258207141Sjeff#define OPEN_APPEND (1) 259207141Sjeff#endif 260207141Sjeff#endif 261207141Sjeff 2621541Srgrimes/* 2631541Srgrimes * Set a file descriptor to binary mode. 2641541Srgrimes */ 2651541Srgrimes#if MSDOS_COMPILER==MSOFTC 2661541Srgrimes#define SET_BINARY(f) _setmode(f, _O_BINARY); 2671541Srgrimes#else 26898542Smckusick#if MSDOS_COMPILER || OS2 2691541Srgrimes#define SET_BINARY(f) setmode(f, O_BINARY) 2701541Srgrimes#else 2711541Srgrimes#define SET_BINARY(f) 2721541Srgrimes#endif 2731541Srgrimes#endif 2741541Srgrimes 2751541Srgrimes/* 2761541Srgrimes * Does the shell treat "?" as a metacharacter? 2771541Srgrimes */ 2781541Srgrimes#if MSDOS_COMPILER || OS2 || _OSK 2791541Srgrimes#define SHELL_META_QUEST 0 2801541Srgrimes#else 2811541Srgrimes#define SHELL_META_QUEST 1 2821541Srgrimes#endif 2831541Srgrimes 2841541Srgrimes#define SPACES_IN_FILENAMES 1 285207141Sjeff 2861541Srgrimes/* 287207141Sjeff * An IFILE represents an input file. 288207141Sjeff */ 2891541Srgrimes#define IFILE VOID_POINTER 2901541Srgrimes#define NULL_IFILE ((IFILE)NULL) 2911541Srgrimes 2921541Srgrimes/* 2931541Srgrimes * The structure used to represent a "screen position". 2941541Srgrimes * This consists of a file position, and a screen line number. 2951541Srgrimes * The meaning is that the line starting at the given file 2961541Srgrimes * position is displayed on the ln-th line of the screen. 2971541Srgrimes * (Screen lines before ln are empty.) 2981541Srgrimes */ 29998542Smckusickstruct scrpos 3001541Srgrimes{ 3011541Srgrimes POSITION pos; 3021541Srgrimes int ln; 3031541Srgrimes}; 3041541Srgrimes 3051541Srgrimes/* 3061541Srgrimes * A mark is an ifile (input file) plus a position within the file. 3071541Srgrimes */ 3081541Srgrimesstruct mark 3091541Srgrimes{ 3101541Srgrimes IFILE m_ifile; 3111541Srgrimes struct scrpos m_scrpos; 3121541Srgrimes}; 3131541Srgrimes 3141541Srgrimestypedef union parg 3151541Srgrimes{ 3161541Srgrimes char *p_string; 317207141Sjeff int p_int; 3181541Srgrimes LINENUM p_linenum; 319207141Sjeff} PARG; 320207141Sjeff 3211541Srgrimes#define NULL_PARG ((PARG *)NULL) 3221541Srgrimes 323207141Sjeffstruct textlist 324207141Sjeff{ 325207141Sjeff char *string; 326207141Sjeff char *endstring; 327207141Sjeff}; 328207141Sjeff 329207141Sjeffstruct wchar_range 330207141Sjeff{ 331207141Sjeff LWCHAR first, last; 332207141Sjeff}; 333207141Sjeff 334207141Sjeffstruct wchar_range_table 335207141Sjeff{ 336207141Sjeff struct wchar_range *table; 337207141Sjeff int count; 338207141Sjeff}; 339207141Sjeff 340207141Sjeff#define EOI (-1) 341207141Sjeff 342207141Sjeff#define READ_INTR (-2) 343207141Sjeff 344207141Sjeff/* A fraction is represented by an int n; the fraction is n/NUM_FRAC_DENOM */ 345207141Sjeff#define NUM_FRAC_DENOM 1000000 346207141Sjeff#define NUM_LOG_FRAC_DENOM 6 347207141Sjeff 348207141Sjeff/* How quiet should we be? */ 349207141Sjeff#define NOT_QUIET 0 /* Ring bell at eof and for errors */ 350207141Sjeff#define LITTLE_QUIET 1 /* Ring bell only for errors */ 351207141Sjeff#define VERY_QUIET 2 /* Never ring bell */ 352207141Sjeff 353207141Sjeff/* How should we prompt? */ 354207141Sjeff#define PR_SHORT 0 /* Prompt with colon */ 355207141Sjeff#define PR_MEDIUM 1 /* Prompt with message */ 356207141Sjeff#define PR_LONG 2 /* Prompt with longer message */ 357207141Sjeff 358207141Sjeff/* How should we handle backspaces? */ 359207141Sjeff#define BS_SPECIAL 0 /* Do special things for underlining and bold */ 360207141Sjeff#define BS_NORMAL 1 /* \b treated as normal char; actually output */ 361207141Sjeff#define BS_CONTROL 2 /* \b treated as control char; prints as ^H */ 362207141Sjeff 363207141Sjeff/* How should we search? */ 364207141Sjeff#define SRCH_FORW (1 << 0) /* Search forward from current position */ 365207141Sjeff#define SRCH_BACK (1 << 1) /* Search backward from current position */ 366207141Sjeff#define SRCH_NO_MOVE (1 << 2) /* Highlight, but don't move */ 367207141Sjeff#define SRCH_FIND_ALL (1 << 4) /* Find and highlight all matches */ 368207141Sjeff#define SRCH_NO_MATCH (1 << 8) /* Search for non-matching lines */ 369207141Sjeff#define SRCH_PAST_EOF (1 << 9) /* Search past end-of-file, into next file */ 370207141Sjeff#define SRCH_FIRST_FILE (1 << 10) /* Search starting at the first file */ 371207141Sjeff#define SRCH_NO_REGEX (1 << 12) /* Don't use regular expressions */ 372207141Sjeff#define SRCH_FILTER (1 << 13) /* Search is for '&' (filter) command */ 373207141Sjeff#define SRCH_AFTER_TARGET (1 << 14) /* Start search after the target line */ 374207141Sjeff 375207141Sjeff#define SRCH_REVERSE(t) (((t) & SRCH_FORW) ? \ 376207141Sjeff (((t) & ~SRCH_FORW) | SRCH_BACK) : \ 377207141Sjeff (((t) & ~SRCH_BACK) | SRCH_FORW)) 378207141Sjeff 379207141Sjeff/* */ 380207141Sjeff#define NO_MCA 0 381207141Sjeff#define MCA_DONE 1 382207141Sjeff#define MCA_MORE 2 383207141Sjeff 384207141Sjeff#define CC_OK 0 /* Char was accepted & processed */ 385207141Sjeff#define CC_QUIT 1 /* Char was a request to abort current cmd */ 386207141Sjeff#define CC_ERROR 2 /* Char could not be accepted due to error */ 387207141Sjeff#define CC_PASS 3 /* Char was rejected (internal) */ 388207141Sjeff 389207141Sjeff#define CF_QUIT_ON_ERASE 0001 /* Abort cmd if its entirely erased */ 390207141Sjeff 391207141Sjeff/* Special char bit-flags used to tell put_line() to do something special */ 392207141Sjeff#define AT_NORMAL (0) 393207141Sjeff#define AT_UNDERLINE (1 << 0) 394207141Sjeff#define AT_BOLD (1 << 1) 395207141Sjeff#define AT_BLINK (1 << 2) 396207141Sjeff#define AT_STANDOUT (1 << 3) 397207141Sjeff#define AT_ANSI (1 << 4) /* Content-supplied "ANSI" escape sequence */ 398207141Sjeff#define AT_BINARY (1 << 5) /* LESS*BINFMT representation */ 399207141Sjeff#define AT_HILITE (1 << 6) /* Internal highlights (e.g., for search) */ 400207141Sjeff 401207141Sjeff#if '0' == 240 402207141Sjeff#define IS_EBCDIC_HOST 1 403207141Sjeff#endif 404207141Sjeff 405207141Sjeff#if IS_EBCDIC_HOST 406207141Sjeff/* 407207141Sjeff * Long definition for EBCDIC. 408207141Sjeff * Since the argument is usually a constant, this macro normally compiles 409207141Sjeff * into a constant. 410207141Sjeff */ 411207141Sjeff#define CONTROL(c) ( \ 412207141Sjeff (c)=='[' ? '\047' : \ 413207141Sjeff (c)=='a' ? '\001' : \ 414207141Sjeff (c)=='b' ? '\002' : \ 415 (c)=='c' ? '\003' : \ 416 (c)=='d' ? '\067' : \ 417 (c)=='e' ? '\055' : \ 418 (c)=='f' ? '\056' : \ 419 (c)=='g' ? '\057' : \ 420 (c)=='h' ? '\026' : \ 421 (c)=='i' ? '\005' : \ 422 (c)=='j' ? '\025' : \ 423 (c)=='k' ? '\013' : \ 424 (c)=='l' ? '\014' : \ 425 (c)=='m' ? '\015' : \ 426 (c)=='n' ? '\016' : \ 427 (c)=='o' ? '\017' : \ 428 (c)=='p' ? '\020' : \ 429 (c)=='q' ? '\021' : \ 430 (c)=='r' ? '\022' : \ 431 (c)=='s' ? '\023' : \ 432 (c)=='t' ? '\074' : \ 433 (c)=='u' ? '\075' : \ 434 (c)=='v' ? '\062' : \ 435 (c)=='w' ? '\046' : \ 436 (c)=='x' ? '\030' : \ 437 (c)=='y' ? '\031' : \ 438 (c)=='z' ? '\077' : \ 439 (c)=='A' ? '\001' : \ 440 (c)=='B' ? '\002' : \ 441 (c)=='C' ? '\003' : \ 442 (c)=='D' ? '\067' : \ 443 (c)=='E' ? '\055' : \ 444 (c)=='F' ? '\056' : \ 445 (c)=='G' ? '\057' : \ 446 (c)=='H' ? '\026' : \ 447 (c)=='I' ? '\005' : \ 448 (c)=='J' ? '\025' : \ 449 (c)=='K' ? '\013' : \ 450 (c)=='L' ? '\014' : \ 451 (c)=='M' ? '\015' : \ 452 (c)=='N' ? '\016' : \ 453 (c)=='O' ? '\017' : \ 454 (c)=='P' ? '\020' : \ 455 (c)=='Q' ? '\021' : \ 456 (c)=='R' ? '\022' : \ 457 (c)=='S' ? '\023' : \ 458 (c)=='T' ? '\074' : \ 459 (c)=='U' ? '\075' : \ 460 (c)=='V' ? '\062' : \ 461 (c)=='W' ? '\046' : \ 462 (c)=='X' ? '\030' : \ 463 (c)=='Y' ? '\031' : \ 464 (c)=='Z' ? '\077' : \ 465 (c)=='|' ? '\031' : \ 466 (c)=='\\' ? '\034' : \ 467 (c)=='^' ? '\036' : \ 468 (c)&077) 469#else 470#define CONTROL(c) ((c)&037) 471#endif /* IS_EBCDIC_HOST */ 472 473#define ESC CONTROL('[') 474#define CSI ((unsigned char)'\233') 475#define CHAR_END_COMMAND 0x40000000 476 477#if _OSK_MWC32 478#define LSIGNAL(sig,func) os9_signal(sig,func) 479#else 480#define LSIGNAL(sig,func) signal(sig,func) 481#endif 482 483#if HAVE_SIGPROCMASK 484#if HAVE_SIGSET_T 485#else 486#undef HAVE_SIGPROCMASK 487#endif 488#endif 489#if HAVE_SIGPROCMASK 490#if HAVE_SIGEMPTYSET 491#else 492#undef sigemptyset 493#define sigemptyset(mp) *(mp) = 0 494#endif 495#endif 496 497#define S_INTERRUPT 01 498#define S_STOP 02 499#define S_WINCH 04 500#define ABORT_SIGS() (sigs & (S_INTERRUPT|S_STOP)) 501 502#define QUIT_OK 0 503#define QUIT_ERROR 1 504#define QUIT_INTERRUPT 2 505#define QUIT_SAVED_STATUS (-1) 506 507#define FOLLOW_DESC 0 508#define FOLLOW_NAME 1 509 510/* filestate flags */ 511#define CH_CANSEEK 001 512#define CH_KEEPOPEN 002 513#define CH_POPENED 004 514#define CH_HELPFILE 010 515#define CH_NODATA 020 /* Special case for zero length files */ 516 517#define ch_zero() ((POSITION)0) 518 519#define FAKE_HELPFILE "@/\\less/\\help/\\file/\\@" 520#define FAKE_EMPTYFILE "@/\\less/\\empty/\\file/\\@" 521 522/* Flags for cvt_text */ 523#define CVT_TO_LC 01 /* Convert upper-case to lower-case */ 524#define CVT_BS 02 /* Do backspace processing */ 525#define CVT_CRLF 04 /* Remove CR after LF */ 526#define CVT_ANSI 010 /* Remove ANSI escape sequences */ 527 528#if HAVE_TIME_T 529#define time_type time_t 530#else 531#define time_type long 532#endif 533 534struct mlist; 535struct loption; 536struct hilite_tree; 537#include "pattern.h" 538#include "funcs.h" 539 540/* Functions not included in funcs.h */ 541void postoa LESSPARAMS ((POSITION, char*)); 542void linenumtoa LESSPARAMS ((LINENUM, char*)); 543void inttoa LESSPARAMS ((int, char*)); 544