From 3b2a58d763ec2e0ee8385a34aad2a9e7e3ab7222 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Wed, 14 Aug 2019 06:31:54 +0000
Subject: [PATCH] Search for the file in the data dir first, before falling
 back to the CWD (ctrl_dir). Use the CPM-EOF printfile mode to stop printing
 files when encountering a SAUCE record.

---
 exec/text_sec.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/exec/text_sec.js b/exec/text_sec.js
index df2a38d30e..a8644f30e3 100644
--- a/exec/text_sec.js
+++ b/exec/text_sec.js
@@ -9,6 +9,7 @@
 require("text.js", 'TextSectionLstHdr');
 require("nodedefs.js", 'NODE_RTXT');
 require("cga_defs.js", 'LIGHTGRAY');
+require("sbbsdefs.js", 'P_CPM_EOF');
 
 if(!bbs.mods.cnflib)
 	bbs.mods.cnflib = load({}, "cnflib.js");
@@ -29,9 +30,9 @@ function read_list(sec)
 	f.close();
 	var list = [];
 	for(var i = 0; i < lines.length; i += 2) {
-		var path = file_getcase(lines[i]);
+		var path = txtsec_data(sec) + "/" + lines[i]; 
 		if(!path)
-			path = txtsec_data(sec) + "/" + lines[i];
+			path = file_getcase(lines[i]);
 		list.push({ path: path, orig_path: lines[i], desc: lines[i + 1]});
 	}
 	return list;
@@ -145,10 +146,10 @@ while(bbs.online) {
 				if(typeof(cmd) == "number") {
 					cmd--;
 					console.attributes = LIGHTGRAY;
-					console.printfile(list[cmd].path);
+					console.printfile(list[cmd].path, P_CPM_EOF);
 					log(LOG_INFO, "read text file: " + list[cmd].path);
 					console.pause();
 				}
 		}
 	}
-}
\ No newline at end of file
+}
-- 
GitLab