summaryrefslogtreecommitdiff
path: root/djgpp/djgpp.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-09-10 17:49:35 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-09-10 17:49:35 +0000
commit933fea7ffa6c794a1a2b8e713eb2b30851598bc8 (patch)
treef90e88b4e5daecb28dda82759223d272f14525dc /djgpp/djgpp.c
parent54a137f5a208ce9a432cfbce29ffe72d9e61bfe9 (diff)
downloadperl-933fea7ffa6c794a1a2b8e713eb2b30851598bc8.tar.gz
dos-djgpp update (from Laszlo Molnar <laszlo.molnar@eth.ericsson.se>)
p4raw-id: //depot/perl@4121
Diffstat (limited to 'djgpp/djgpp.c')
-rw-r--r--djgpp/djgpp.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/djgpp/djgpp.c b/djgpp/djgpp.c
index 5c1d3c4de4..5a8fc5fa5c 100644
--- a/djgpp/djgpp.c
+++ b/djgpp/djgpp.c
@@ -123,7 +123,7 @@ convretcode (pTHX_ int rc,char *prog,int fl)
Perl_warner(aTHX_ WARN_EXEC,"Can't %s \"%s\": %s",
fl ? "exec" : "spawn",prog,Strerror (errno));
if (rc > 0)
- return rc <<= 8;
+ return rc << 8;
if (rc < 0)
return 255 << 8;
return 0;
@@ -252,6 +252,7 @@ struct globinfo
int fd;
char *matches;
size_t size;
+ fpos_t pos;
};
#define MAXOPENGLOBS 10
@@ -286,6 +287,7 @@ glob_handler (__FSEXT_Fnumber n,int *rv,va_list args)
if ((gi=searchfd (-1)) == NULL)
break;
+ gi->pos=0;
pattern=alloca (strlen (name+=13)+1);
strcpy (pattern,name);
if (!_USE_LFN)
@@ -332,11 +334,10 @@ glob_handler (__FSEXT_Fnumber n,int *rv,va_list args)
if ((gi=searchfd (fd))==NULL)
break;
- ic=tell (fd);
- if (siz+ic>=gi->size)
- siz=gi->size-ic;
- memcpy (buf,ic+gi->matches,siz);
- lseek (fd,siz,1);
+ if (siz+gi->pos > gi->size)
+ siz = gi->size - gi->pos;
+ memcpy (buf,gi->pos+gi->matches,siz);
+ gi->pos += siz;
*rv=siz;
return 1;
}