summaryrefslogtreecommitdiff
path: root/src/io
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-11-03 13:35:54 -0800
committerBen Longbons <b.r.longbons@gmail.com>2014-11-04 20:10:50 -0800
commit1853e964e96c41e762ca0ab97259ee4e79d86ec7 (patch)
treeedc76f58ed786263a28da79564786f4d75400092 /src/io
parent1a00fe4ea75924bfe594c4d92073cc95eaa2f32d (diff)
downloadtmwa-1853e964e96c41e762ca0ab97259ee4e79d86ec7.tar.gz
tmwa-1853e964e96c41e762ca0ab97259ee4e79d86ec7.tar.bz2
tmwa-1853e964e96c41e762ca0ab97259ee4e79d86ec7.tar.xz
tmwa-1853e964e96c41e762ca0ab97259ee4e79d86ec7.zip
Use the new ASTs
Diffstat (limited to 'src/io')
-rw-r--r--src/io/read.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/io/read.cpp b/src/io/read.cpp
index d701c7f..32974d6 100644
--- a/src/io/read.cpp
+++ b/src/io/read.cpp
@@ -118,6 +118,7 @@ namespace io
}
bool ReadFile::getline(AString& line)
{
+ bool was_real_file = fd != FD();
MString tmp;
char c;
bool anything = false;
@@ -151,8 +152,10 @@ namespace io
else
FPRINTF(stderr, "warning: file contains bare CR\n"_fmt);
}
- else if (!happy && anything)
+ else if (!happy && anything && was_real_file)
+ {
FPRINTF(stderr, "warning: file does not contain a trailing newline\n"_fmt);
+ }
line = AString(tmp);
return anything;
}