aboutsummaryrefslogtreecommitdiff
path: root/justify.cc
diff options
context:
space:
mode:
authorAdrian Kummerlaender2016-04-22 22:23:35 +0200
committerAdrian Kummerlaender2016-04-22 22:23:35 +0200
commit5eb3689c9985f28b46651f547b9b32d55b4a07b5 (patch)
tree798b747b241de9f9233fa7b5dc6ce96a2fbbcde5 /justify.cc
parentb647d08bb19abe4d199166a05f9f14c65f5f0ed4 (diff)
downloadjustify-5eb3689c9985f28b46651f547b9b32d55b4a07b5.tar
justify-5eb3689c9985f28b46651f547b9b32d55b4a07b5.tar.gz
justify-5eb3689c9985f28b46651f547b9b32d55b4a07b5.tar.bz2
justify-5eb3689c9985f28b46651f547b9b32d55b4a07b5.tar.lz
justify-5eb3689c9985f28b46651f547b9b32d55b4a07b5.tar.xz
justify-5eb3689c9985f28b46651f547b9b32d55b4a07b5.tar.zst
justify-5eb3689c9985f28b46651f547b9b32d55b4a07b5.zip
Handle input stream EOF
Diffstat (limited to 'justify.cc')
-rw-r--r--justify.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/justify.cc b/justify.cc
index 8120ded..c417dfd 100644
--- a/justify.cc
+++ b/justify.cc
@@ -81,8 +81,12 @@ bool process(const boost::program_options::variables_map& variables) {
justify::LineAccumulator acc{line_length, line_offset};
std::string token;
- while ( std::cin >> token ) {
- acc(token);
+ while ( std::cin.good() ) {
+ if ( std::cin >> token ) {
+ acc(token);
+ } else {
+ return true;
+ }
}
return true;