Changeset 1790 for box/chris/general/bin/bbackupquery/bbackupquery.cpp
- Timestamp:
- 03/08/2007 00:29:31 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
box/chris/general/bin/bbackupquery/bbackupquery.cpp
r1690 r1790 13 13 #include <unistd.h> 14 14 #endif 15 16 #include <errno.h> 15 17 #include <stdio.h> 16 #include <sys/types.h> 18 19 #ifdef HAVE_SYS_TYPES_H 20 #include <sys/types.h> 21 #endif 22 17 23 #ifdef HAVE_LIBREADLINE 18 24 #ifdef HAVE_READLINE_READLINE_H … … 169 175 if(logFile == 0) 170 176 { 171 printf("Can't open log file '%s'\n", optarg); 177 BOX_ERROR("Failed to open log file '" << 178 optarg << "': " << strerror(errno)); 172 179 } 173 180 break; … … 202 209 if (!SetConsoleCP(CP_UTF8)) 203 210 { 204 fprintf(stderr, "Failed to set input codepage: "205 "error %d\n", GetLastError());211 BOX_ERROR("Failed to set input codepage: " << 212 GetErrorMessage(GetLastError())); 206 213 } 207 214 208 215 if (!SetConsoleOutputCP(CP_UTF8)) 209 216 { 210 fprintf(stderr, "Failed to set output codepage: "211 "error %d\n", GetLastError());217 BOX_ERROR("Failed to set output codepage: " << 218 GetErrorMessage(GetLastError())); 212 219 } 213 220 … … 223 230 224 231 // Read in the configuration file 225 if(!quiet) printf("Using configuration file %s\n", 226 configFilename.c_str()); 232 if(!quiet) BOX_INFO("Using configuration file " << configFilename); 227 233 228 234 std::string errs; … … 233 239 if(config.get() == 0 || !errs.empty()) 234 240 { 235 printf("Invalid configuration file:\n%s", errs.c_str());241 BOX_FATAL("Invalid configuration file: " << errs); 236 242 return 1; 237 243 } … … 253 259 254 260 // 2. Connect to server 255 if(!quiet) printf("Connecting to store...\n");261 if(!quiet) BOX_INFO("Connecting to store..."); 256 262 SocketStreamTLS socket; 257 263 socket.Open(tlsContext, Socket::TypeINET, conf.GetKeyValue("StoreHostname").c_str(), BOX_PORT_BBSTORED); 258 264 259 265 // 3. Make a protocol, and handshake 260 if(!quiet) printf("Handshake with store...\n");266 if(!quiet) BOX_INFO("Handshake with store..."); 261 267 BackupProtocolClient connection(socket); 262 268 connection.Handshake(); … … 269 275 270 276 // 4. Log in to server 271 if(!quiet) printf("Login to store...\n");277 if(!quiet) BOX_INFO("Login to store..."); 272 278 // Check the version of the server 273 279 { … … 346 352 347 353 // Done... stop nicely 348 if(!quiet) printf("Logging off...\n");354 if(!quiet) BOX_INFO("Logging off..."); 349 355 connection.QueryFinished(); 350 if(!quiet) printf("Session finished.\n");356 if(!quiet) BOX_INFO("Session finished."); 351 357 352 358 // Return code
Note: See TracChangeset
for help on using the changeset viewer.
