On Sat, Jan 23, 2016 at 09:48:52PM -0800, Isaac Dunham wrote: > On Fri, Aug 21, 2015 at 12:08:48AM -0400, Greg Hellings wrote: > > Developers and other interested parties, > > > > I've created a tarball and an SVN tag for SWORD 1.7.5a1. Please test > > it and let me know if there are issues. If I hear nothing or only > > positive feedback, I'll bless the same tarball as the final 1.7.5 > > release. > > > > http://crosswire.org/ftpmirror/pub/sword/source/v1.7/sword-1.7.5a1.tar.gz > > A bug that I've referred to before but not sent the patch for > (an omission for which I must apologize): > > Platform: Alpine Linux, any musl-based release > SWORD versions: 1.7.x, possibly 1.8.x > Symptoms: > When 'installmgr -r <Repo>' issues the standard warning, it seemingly hangs > after the line ending "...then type yes at the prompt". > After typing in a response ending in a newline, the prompt shows up. > Cause: > cout (at least on this platform) is essentially an alternate way of writing > to stdout, which is supposed to be line-buffered by default. > Here, this means that if you want to display a partial line (no newline), > you need to flush cout after writing it, or the line will just > sit in the buffer. > > grepping through utilities/, I see that genbookutil.cpp has a few spots > that should hit the same bug. > > Here's a patch for those issues.
And my apologies. I'd used fflush(stdout), which worked. Then I decided to make it more idiomatic, porting it to std::flush. I didn't think to check whether I needed to specify std::. Here's a fixed patch. God bless, Isaac Dunham
diff --git a/utilities/genbookutil.cpp b/utilities/genbookutil.cpp index 71363e3..7c82b8a 100644 --- a/utilities/genbookutil.cpp +++ b/utilities/genbookutil.cpp @@ -59,7 +59,7 @@ void printLocalName(TreeKeyIdx *treeKey) { void setLocalName(TreeKeyIdx *treeKey) { char buf[1023]; - std::cout << "Enter New Node Name: "; + std::cout << "Enter New Node Name: " << std::flush; fgets(buf, 1000, stdin); SWBuf name = buf; treeKey->setLocalName(name.trim()); @@ -69,7 +69,7 @@ void setLocalName(TreeKeyIdx *treeKey) { void gotoPath(TreeKeyIdx *treeKey) { char buf[1023]; - std::cout << "Enter Path: "; + std::cout << "Enter Path: " << std::flush; fgets(buf, 1000, stdin); SWBuf path = buf; (*treeKey) = path.trim(); @@ -78,7 +78,7 @@ void gotoPath(TreeKeyIdx *treeKey) { void assurePath(TreeKeyIdx *treeKey) { char buf[1023]; - std::cout << "Enter Path: "; + std::cout << "Enter Path: " << std::flush; fgets(buf, 1000, stdin); SWBuf path = buf; treeKey->assureKeyPath(path.trim()); @@ -117,7 +117,7 @@ void setEntryText(RawGenBook *book) { void appendSibbling(TreeKeyIdx *treeKey) { if (treeKey->getOffset()) { char buf[1023]; - std::cout << "Enter New Sibbling Name: "; + std::cout << "Enter New Sibbling Name: " << std::flush; fgets(buf, 1000, stdin); SWBuf name = buf; treeKey->append(); @@ -176,7 +176,7 @@ int main(int argc, char **argv) { char line[1024]; do { - std::cout << "[" << treeKey->getText() << "] > "; + std::cout << "[" << treeKey->getText() << "] > " << std::flush; fgets(line, 1000, stdin); input = line; input.trim(); diff --git a/utilities/installmgr.cpp b/utilities/installmgr.cpp index b705c25..4f76ef0 100644 --- a/utilities/installmgr.cpp +++ b/utilities/installmgr.cpp @@ -38,6 +38,7 @@ using namespace sword; using std::cout; using std::cerr; using std::cin; +using std::flush; using std::map; @@ -72,7 +73,7 @@ virtual bool isUserDisclaimerConfirmed() const { cout << "cannot be held responsible for their content. CAVEAT EMPTOR.\n\n\n"; cout << "If you understand this and are willing to enable remote source features\n"; cout << "then type yes at the prompt\n\n"; - cout << "enable? [no] "; + cout << "enable? [no] " << flush; char prompt[10]; fgets(prompt, 9, stdin);
_______________________________________________ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page