Index: /trunk/gsdl/src/txt2db/txt2db.cpp
===================================================================
--- /trunk/gsdl/src/txt2db/txt2db.cpp	(revision 622)
+++ /trunk/gsdl/src/txt2db/txt2db.cpp	(revision 623)
@@ -49,101 +49,99 @@
 
 void print_usage (char *program_name) {
-	cerr << "usage: " << program_name << " database-name\n\n";
+  cerr << "usage: " << program_name << " database-name\n\n";
 }
 
 
 int main (int argc, char *argv[]) {
-	int block_size = 0;
-	GDBM_FILE dbf;
-	char c;
-	text_t key;
-	text_t value;
-	text_t tmp;
-	int num_dashes = 0;
-
-	// sanity check
-	if (argc != 2) {
-		print_usage (argv[0]);
-		exit (0);
-	}
-
-	// open the database
-	dbf = gdbm_open  (argv[1], block_size, GDBM_NEWDB, 00664, NULL);
-    if (dbf == NULL) {
-		cerr << "couldn't create " << argv[1] << "\n";
-		exit (0);
-	}
-
-	cin.get(c);
-	while (!cin.eof()) {
-		num_dashes = 0;
-		key = "";
-		value = "";
-
-		// look for [key]\n
-		while (!cin.eof() && c != '[') cin.get(c);
-		if (!cin.eof()) cin.get(c); // skip [
-		while (!cin.eof() && c != ']') {
-			key.push_back ((unsigned char)c);
-			cin.get(c);
-		}
-		if (!cin.eof()) cin.get(c); // skip ]
-		while (!cin.eof() && (c == '\n' || c == 'r')) cin.get(c);
-
-		// look for 70 dashes
-		tmp = "";
-		while (!cin.eof() && (num_dashes < 70)) {
-			if (c == '\n' || c == '\r') {
-				tmp.push_back ((unsigned char)c);
-				num_dashes = 0;
-
-			} else if (c == '-') {
-				tmp.push_back ((unsigned char)c);
-				num_dashes++;
-
-			} else {
-				value += tmp;
-				value.push_back ((unsigned char)c);
-				tmp = "";
-				num_dashes = 0;
-			}
-			cin.get(c);
-		}
-		
-		// if the key is not an empty string store this key-value pair
-		if (!key.empty()) {
-			// convert key to a datum datatype
-			datum key_data;
-			key_data.dptr = key.getcstr();
-			if (key_data.dptr == NULL) {
-				cerr << "NULL key_data.dptr\n";
-				exit (0);
-			}
-			key_data.dsize = strlen(key_data.dptr);
-
-			// convert value to a datum datatype
-			datum value_data;
-			value_data.dptr = value.getcstr();
-			if (value_data.dptr == NULL) {
-				cerr << "NULL value_data.dptr\n";
-				exit (0);
-			}
-			value_data.dsize = strlen(value_data.dptr);
-
-			// store the value
-			if (gdbm_store (dbf, key_data, value_data, GDBM_REPLACE) < 0) {
-				cerr << "gdbm_store returned an error\n";
-				exit (0);
-			}
-
-			delete key_data.dptr;
-			delete value_data.dptr;
-		}
-	}
-
-
-	gdbm_close (dbf);
-
-
-	return 0;
+  int block_size = 0;
+  GDBM_FILE dbf;
+  char c;
+  text_t key;
+  text_t value;
+  text_t tmp;
+  int num_dashes = 0;
+  
+  // sanity check
+  if (argc != 2) {
+    print_usage (argv[0]);
+    exit (0);
+  }
+  
+  // open the database
+  dbf = gdbm_open  (argv[1], block_size, GDBM_NEWDB | GDBM_FAST, 00664, NULL);
+  if (dbf == NULL) {
+    cerr << "couldn't create " << argv[1] << "\n";
+    exit (0);
+  }
+  
+  cin.get(c);
+  while (!cin.eof()) {
+    num_dashes = 0;
+    key = "";
+    value = "";
+    
+    // look for [key]\n
+    while (!cin.eof() && c != '[') cin.get(c);
+    if (!cin.eof()) cin.get(c); // skip [
+    while (!cin.eof() && c != ']') {
+      key.push_back ((unsigned char)c);
+      cin.get(c);
+    }
+    if (!cin.eof()) cin.get(c); // skip ]
+    while (!cin.eof() && (c == '\n' || c == 'r')) cin.get(c);
+    
+    // look for 70 dashes
+    tmp = "";
+    while (!cin.eof() && (num_dashes < 70)) {
+      if (c == '\n' || c == '\r') {
+	tmp.push_back ((unsigned char)c);
+	num_dashes = 0;
+	
+      } else if (c == '-') {
+	tmp.push_back ((unsigned char)c);
+	num_dashes++;
+	
+      } else {
+	value += tmp;
+	value.push_back ((unsigned char)c);
+	tmp = "";
+	num_dashes = 0;
+      }
+      cin.get(c);
+    }
+    
+    // if the key is not an empty string store this key-value pair
+    if (!key.empty()) {
+      // convert key to a datum datatype
+      datum key_data;
+      key_data.dptr = key.getcstr();
+      if (key_data.dptr == NULL) {
+	cerr << "NULL key_data.dptr\n";
+	exit (0);
+      }
+      key_data.dsize = strlen(key_data.dptr);
+      
+      // convert value to a datum datatype
+      datum value_data;
+      value_data.dptr = value.getcstr();
+      if (value_data.dptr == NULL) {
+	cerr << "NULL value_data.dptr\n";
+	exit (0);
+      }
+      value_data.dsize = strlen(value_data.dptr);
+      
+      // store the value
+      if (gdbm_store (dbf, key_data, value_data, GDBM_REPLACE) < 0) {
+	cerr << "gdbm_store returned an error\n";
+	exit (0);
+      }
+      
+      delete key_data.dptr;
+      delete value_data.dptr;
+    }
+  }
+  
+  gdbm_close (dbf);
+  
+  return 0;
 }
