diff options
Diffstat (limited to 'utilities/treeidxutil.cpp')
-rw-r--r-- | utilities/treeidxutil.cpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/utilities/treeidxutil.cpp b/utilities/treeidxutil.cpp index d622dfa..fcd5db7 100644 --- a/utilities/treeidxutil.cpp +++ b/utilities/treeidxutil.cpp @@ -2,7 +2,7 @@ * * treeidxutil.cpp - * - * $Id: treeidxutil.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: treeidxutil.cpp 3063 2014-03-04 13:04:11Z chrislit $ * * Copyright 2002-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -58,33 +58,27 @@ void printLocalName(TreeKeyIdx *treeKey) { void setLocalName(TreeKeyIdx *treeKey) { - char buf[1023], *c; + char buf[1023]; std::cout << "Enter New Node Name: "; - c = fgets(buf, 1000, stdin); - if (c == NULL) - std::cerr << "ERROR: fgets failed in setLocalName\n"; + fgets(buf, 1000, stdin); treeKey->setLocalName(buf); treeKey->save(); } void assurePath(TreeKeyIdx *treeKey) { - char buf[1023], *c; + char buf[1023]; std::cout << "Enter path: "; - c = fgets(buf, 1000, stdin); - if (c == NULL) - std::cerr << "ERROR: fgets failed in assurePath\n"; + fgets(buf, 1000, stdin); treeKey->assureKeyPath(buf); } void appendSibbling(TreeKeyIdx *treeKey) { if (treeKey->getOffset()) { - char buf[1023], *c; + char buf[1023]; std::cout << "Enter New Sibbling Name: "; - c = fgets(buf, 1000, stdin); - if (c == NULL) - std::cerr << "ERROR: fgets failed in appendSibbling\n"; + fgets(buf, 1000, stdin); treeKey->append(); treeKey->setLocalName(buf); treeKey->save(); @@ -94,11 +88,9 @@ void appendSibbling(TreeKeyIdx *treeKey) { void appendChild(TreeKeyIdx *treeKey) { - char buf[1023], *c; + char buf[1023]; std::cout << "Enter New Child Name: "; - c = fgets(buf, 1000, stdin); - if (c == NULL) - std::cerr << "ERROR: fgets failed in appendChild\n"; + fgets(buf, 1000, stdin); treeKey->appendChild(); treeKey->setLocalName(buf); treeKey->save(); @@ -131,13 +123,11 @@ int main(int argc, char **argv) { TreeKeyIdx root = *treeKey; std::string input; - char line[1024], *c; + char line[1024]; do { std::cout << "[" << treeKey->getText() << "] > "; - c = fgets(line, 1000, stdin); - if (c == NULL) - std::cerr << "ERROR: fgets failed in main\n"; + fgets(line, 1000, stdin); input = line; if (input.length() > 0) { switch (input[0]) { |