version 1.1.1.3, 2011/09/16 17:47:00 |
version 1.1.1.4, 2014/04/25 13:33:41 |
|
|
/* |
/* |
* Copyright (C) 1984-2011 Mark Nudelman |
* Copyright (C) 1984-2012 Mark Nudelman |
* |
* |
* You may distribute under the terms of either the GNU General Public |
* You may distribute under the terms of either the GNU General Public |
* License or the Less License, as specified in the README file. |
* License or the Less License, as specified in the README file. |
* |
* |
* For more information about less, or for information on how to |
* For more information, see the README file. |
* contact the author, see the README file. |
|
*/ |
*/ |
|
|
|
|
|
|
static int maxbufs = -1; |
static int maxbufs = -1; |
|
|
extern int autobuf; |
extern int autobuf; |
extern int sigs; |
extern volatile sig_atomic_t sigs; |
extern int secure; |
extern int secure; |
extern int screen_trashed; |
extern int screen_trashed; |
extern int follow_mode; |
extern int follow_mode; |
extern constant char helpdata[]; |
|
extern constant int size_helpdata; |
|
extern IFILE curr_ifile; |
extern IFILE curr_ifile; |
#if LOGFILE |
#if LOGFILE |
extern int logfile; |
extern int logfile; |
|
|
bp->data[bp->datasize] = ch_ungotchar; |
bp->data[bp->datasize] = ch_ungotchar; |
n = 1; |
n = 1; |
ch_ungotchar = -1; |
ch_ungotchar = -1; |
} else if (ch_flags & CH_HELPFILE) |
|
{ |
|
bp->data[bp->datasize] = helpdata[ch_fpos]; |
|
n = 1; |
|
} else |
} else |
{ |
{ |
n = iread(ch_file, &bp->data[bp->datasize], |
n = iread(ch_file, &bp->data[bp->datasize], |
|
|
return (NULL_POSITION); |
return (NULL_POSITION); |
if (ignore_eoi) |
if (ignore_eoi) |
return (NULL_POSITION); |
return (NULL_POSITION); |
if (ch_flags & CH_HELPFILE) |
if (ch_flags & CH_NODATA) |
return (size_helpdata); |
return (0); |
return (ch_fsize); |
return (ch_fsize); |
} |
} |
|
|
|
|
} |
} |
|
|
/* |
/* |
|
* Force EOF to be at the current read position. |
|
* This is used after an ignore_eof read, during which the EOF may change. |
|
*/ |
|
public void |
|
ch_set_eof() |
|
{ |
|
ch_fsize = ch_fpos; |
|
} |
|
|
|
|
|
/* |
* Initialize file state for a new file. |
* Initialize file state for a new file. |
*/ |
*/ |
public void |
public void |
|
|
* But don't really close it if it was opened via popen(), |
* But don't really close it if it was opened via popen(), |
* because pclose() wants to close it. |
* because pclose() wants to close it. |
*/ |
*/ |
if (!(ch_flags & (CH_POPENED|CH_HELPFILE))) |
if (!(ch_flags & CH_POPENED)) |
close(ch_file); |
close(ch_file); |
ch_file = -1; |
ch_file = -1; |
} else |
} else |