summaryrefslogtreecommitdiff
path: root/pico
diff options
context:
space:
mode:
Diffstat (limited to 'pico')
-rw-r--r--pico/file.c16
-rw-r--r--pico/fileio.c5
-rw-r--r--pico/line.c6
3 files changed, 19 insertions, 8 deletions
diff --git a/pico/file.c b/pico/file.c
index 2493d02b..8185593b 100644
--- a/pico/file.c
+++ b/pico/file.c
@@ -519,7 +519,10 @@ readin(char fname[], /* name of file to read */
}
else{
if(newline){
- lnewline();
+ if(lnewline() == FALSE){
+ done++;
+ continue;
+ }
newline = 0;
}
@@ -530,7 +533,7 @@ readin(char fname[], /* name of file to read */
case FIOLNG :
for(linep = line; charsread-- > 0; linep++)
- linsert(1, *linep);
+ if(linsert(1, *linep) == FALSE) done++;
break;
@@ -975,8 +978,11 @@ ifile(char fname[])
}
else{
if(newline){
- lnewline();
- newline = 0;
+ if(lnewline() == FALSE){
+ done++;
+ continue;
+ }
+ newline = 0;
}
switch(s){
@@ -986,7 +992,7 @@ ifile(char fname[])
case FIOLNG :
for(linep = line; charsread-- > 0; linep++)
- linsert(1, *linep);
+ if(linsert(1, *linep) == FALSE) done++;
break;
diff --git a/pico/fileio.c b/pico/fileio.c
index 5cf124c0..91eacf9d 100644
--- a/pico/fileio.c
+++ b/pico/fileio.c
@@ -95,6 +95,7 @@ ffgetline(UCS buf[], size_t nbuf, size_t *charsreturned, int msg)
{
size_t i;
UCS ucs;
+ static int displayed = 0;
if(charsreturned)
*charsreturned = 0;
@@ -121,8 +122,10 @@ ffgetline(UCS buf[], size_t nbuf, size_t *charsreturned, int msg)
if(charsreturned)
*charsreturned = nbuf - 1;
- if(msg)
+ if(msg && displayed == 0){
emlwrite("File has long line", NULL);
+ displayed = 1;
+ }
return FIOLNG;
}
diff --git a/pico/line.c b/pico/line.c
index e5df3670..d1fb31e4 100644
--- a/pico/line.c
+++ b/pico/line.c
@@ -73,6 +73,7 @@ lalloc(int used)
register LINE *lp;
register int size;
EML eml;
+ static int displayed = 0;
if((size = (used+NBLOCK-1) & ~(NBLOCK-1)) > NLINE)
size *= 2;
@@ -80,9 +81,10 @@ lalloc(int used)
if (size == 0) /* Assume that an empty */
size = NBLOCK; /* line is for type-in. */
- if ((lp = (LINE *) malloc(sizeof(LINE)+(size*sizeof(CELL)))) == NULL) {
+ if (displayed == 0 && (lp = (LINE *) malloc(sizeof(LINE)+(size*sizeof(CELL)))) == NULL){
eml.s = comatose(size);
- emlwrite("Cannot allocate %s bytes", &eml);
+ emlwrite("Cannot allocate %s bytes (read file incomplete)", &eml);
+ displayed++;
return (NULL);
}