Changeset 24040
- Timestamp:
- 2011-05-19T10:52:11+12:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/tdb-edit/trunk/src/src/txt2tdb-src/txt2tdb.cpp
r23996 r24040 5 5 * 6 6 * A component of the Greenstone digital library software 7 * from the New Zealand Digital Library Project at the 7 * from the New Zealand Digital Library Project at the 8 8 * University of Waikato, New Zealand. 9 9 * 10 10 * Copyright (C) 2011 The New Zealand Digital Library Project 11 * 11 * 12 12 * This program is free software; you can redistribute it and/or modify 13 13 * it under the terms of the GNU General Public License as published by … … 64 64 exit (0); 65 65 } 66 66 67 67 char *dbname; 68 68 int append = 0; … … 74 74 append = 1; 75 75 dbname = argv[2]; 76 } 76 } 77 77 else 78 78 { … … 86 86 dbname = argv[1]; 87 87 } 88 88 89 89 // open the database 90 90 int hash_size = 0; … … 102 102 exit (0); 103 103 } 104 104 105 105 char c; 106 106 cin.get(c); … … 110 110 text_t key = ""; 111 111 text_t value = ""; 112 112 113 113 // Parse out 'key' from [key]\n 114 114 // - scan for first occurrence of [ … … 133 133 // is to be deleted, not added 134 134 cin.get(c); 135 if (c == '-') { 135 if (c == '-') 136 { 136 137 delkey = 1; 137 138 } 138 else { 139 else 140 { 139 141 delkey = 0; 140 142 } … … 151 153 { 152 154 tmp.push_back ((unsigned char)c); 153 num_dashes = 0; 155 num_dashes = 0; 154 156 } 155 157 else if (c == '\r') 156 { 157 // Here we are able to process both Windows-specific text files 158 // (containing carriage-return, newline) and Linux text files 159 // (containing only newline characters) by ignoring the Windows' 158 { 159 // Here we are able to process both Windows-specific text files 160 // (containing carriage-return, newline) and Linux text files 161 // (containing only newline characters) by ignoring the Windows' 160 162 // carriage-return altogether so that we produce a uniform database 161 // file from either system's type of text file. 163 // file from either system's type of text file. 162 164 // If we don't ignore the carriage return here, txt.gz files 163 165 // produced on Windows cause a GS library running on Linux to break. … … 178 180 cin.get(c); 179 181 } 180 182 181 183 // We should now have a key/value pair. If the key is not an empty string 182 184 // store this key-value pair … … 231 233 exit (0); 232 234 } 233 235 234 236 return 0; 235 237 }
Note:
See TracChangeset
for help on using the changeset viewer.