[sword-svn] r2000 - trunk/utilities

dglassey at www.crosswire.org dglassey at www.crosswire.org
Sat Nov 25 08:30:34 MST 2006


Author: dglassey
Date: 2006-11-25 08:30:34 -0700 (Sat, 25 Nov 2006)
New Revision: 2000

Modified:
   trunk/utilities/treeidxutil.cpp
Log:
use fgets instead of the unsafe gets


Modified: trunk/utilities/treeidxutil.cpp
===================================================================
--- trunk/utilities/treeidxutil.cpp	2006-11-25 15:20:51 UTC (rev 1999)
+++ trunk/utilities/treeidxutil.cpp	2006-11-25 15:30:34 UTC (rev 2000)
@@ -34,7 +34,7 @@
 void setLocalName(TreeKeyIdx *treeKey) {
 	char buf[1023];
 	std::cout << "Enter New Node Name: ";
-	gets(buf);
+	fgets(buf, 1000, stdin);
 	treeKey->setLocalName(buf);
 	treeKey->save();
 }
@@ -43,7 +43,7 @@
 void assurePath(TreeKeyIdx *treeKey) {
 	char buf[1023];
 	std::cout << "Enter path: ";
-	gets(buf);
+	fgets(buf, 1000, stdin);
 	treeKey->assureKeyPath(buf);
 }
 
@@ -52,7 +52,7 @@
 	if (treeKey->getOffset()) {
 		char buf[1023];
 		std::cout << "Enter New Sibbling Name: ";
-		gets(buf);
+		fgets(buf, 1000, stdin);
 		treeKey->append();
 		treeKey->setLocalName(buf);
 		treeKey->save();
@@ -64,7 +64,7 @@
 void appendChild(TreeKeyIdx *treeKey) {
 	char buf[1023];
 	std::cout << "Enter New Child Name: ";
-	gets(buf);
+	fgets(buf, 1000, stdin);
 	treeKey->appendChild();
 	treeKey->setLocalName(buf);
 	treeKey->save();
@@ -101,7 +101,7 @@
 
 	do {
 		std::cout << "[" << treeKey->getText() << "] > ";
-		gets(line);
+		fgets(line, 1000, stdin);
 		input = line;
 		if (input.length() > 0) {
 			switch (input[0]) {




More information about the sword-cvs mailing list