Euphoria Ticket #1021: EGets() not handling carriage return line breaks

Details

Type: Bug Report Severity: Normal Category: Library Routine
Assigned To: ghaberek Status: Accepted Reported Release:
Fixed in SVN #: View VCS: none Milestone: 4.2.0

1. Comment by ghaberek Mar 02, 2023

Proposed correction:

diff --git a/source/be_runtime.c b/source/be_runtime.c 
index 5eac628..97178d6 100644 
--- a/source/be_runtime.c 
+++ b/source/be_runtime.c 
@@ -3894,6 +3894,15 @@ object EGets(object file_no) 
    /* read a character */ 
    c = getc(f); 
 
+   /* test for CR or CRLF */ 
+   if (c == '\r') { 
+       c = getc(f); 
+       if (c != '\n' && c != EOF) { 
+           ungetc(c, f); 
+           c = '\n'; 
+       } 
+   } 
+ 
    if (c == EOF) { 
            break; 
    } 

2. Comment by jimcbrown Mar 05, 2023

Looks good to me.

Search



Quick Links

User menu

Not signed in.

Misc Menu