summaryrefslogtreecommitdiffstats
path: root/contrib/less/ch.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2007-10-08 16:14:52 +0000
committerdelphij <delphij@FreeBSD.org>2007-10-08 16:14:52 +0000
commitaa9fcd738666aeeba852b8c048517501f6704bc0 (patch)
tree2a78cc9eb4488e323c6e10ad2cee170d3b3eed87 /contrib/less/ch.c
parentbb6dbdf2f382ed564a935433f1553a0c588e0f5f (diff)
downloadFreeBSD-src-aa9fcd738666aeeba852b8c048517501f6704bc0.zip
FreeBSD-src-aa9fcd738666aeeba852b8c048517501f6704bc0.tar.gz
Virgin import of less v408.
Approved by: re (kensmith)
Diffstat (limited to 'contrib/less/ch.c')
-rw-r--r--contrib/less/ch.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/contrib/less/ch.c b/contrib/less/ch.c
index 61bc83a..2ac14d7 100644
--- a/contrib/less/ch.c
+++ b/contrib/less/ch.c
@@ -128,6 +128,9 @@ fch_get()
POSITION pos;
POSITION len;
+ if (thisfile == NULL)
+ return (EOI);
+
slept = FALSE;
/*
@@ -416,6 +419,9 @@ ch_seek(pos)
BLOCKNUM new_block;
POSITION len;
+ if (thisfile == NULL)
+ return (0);
+
len = ch_length();
if (pos < ch_zero() || (len != NULL_POSITION && pos > len))
return (1);
@@ -450,6 +456,9 @@ ch_end_seek()
{
POSITION len;
+ if (thisfile == NULL)
+ return (0);
+
if (ch_flags & CH_CANSEEK)
ch_fsize = filesize(ch_file);
@@ -503,6 +512,8 @@ ch_beg_seek()
public POSITION
ch_length()
{
+ if (thisfile == NULL)
+ return (NULL_POSITION);
if (ignore_eoi)
return (NULL_POSITION);
if (ch_flags & CH_HELPFILE)
@@ -516,6 +527,8 @@ ch_length()
public POSITION
ch_tell()
{
+ if (thisfile == NULL)
+ return (NULL_POSITION);
return (ch_block * LBUFSIZE) + ch_offset;
}
@@ -527,6 +540,8 @@ ch_forw_get()
{
register int c;
+ if (thisfile == NULL)
+ return (EOI);
c = ch_get();
if (c == EOI)
return (EOI);
@@ -546,6 +561,8 @@ ch_forw_get()
public int
ch_back_get()
{
+ if (thisfile == NULL)
+ return (EOI);
if (ch_offset > 0)
ch_offset --;
else
@@ -586,6 +603,9 @@ ch_flush()
{
register struct buf *bp;
+ if (thisfile == NULL)
+ return;
+
if (!(ch_flags & CH_CANSEEK))
{
/*
@@ -769,6 +789,9 @@ ch_close()
{
int keepstate = FALSE;
+ if (thisfile == NULL)
+ return;
+
if (ch_flags & (CH_CANSEEK|CH_POPENED|CH_HELPFILE))
{
/*
@@ -807,6 +830,8 @@ ch_close()
public int
ch_getflags()
{
+ if (thisfile == NULL)
+ return (0);
return (ch_flags);
}
OpenPOWER on IntegriCloud