comparison src/pst2ldif.cpp @ 33:12cac756bc05 stable-0-5-5

enable -d option, but if not specified, don't generate a debug file
author carl
date Tue, 10 Jul 2007 20:23:55 -0700
parents d64a9df0dc02
children f5c024aa1dc5
comparison
equal deleted inserted replaced
32:c03974357771 33:12cac756bc05
360 int main(int argc, char** argv) { 360 int main(int argc, char** argv) {
361 pst_desc_ll *d_ptr; 361 pst_desc_ll *d_ptr;
362 char *fname = NULL; 362 char *fname = NULL;
363 char *temp = NULL; //temporary char pointer 363 char *temp = NULL; //temporary char pointer
364 char c; 364 char c;
365 char *d_log = NULL;
365 prog_name = argv[0]; 366 prog_name = argv[0];
366 pst_item *item = NULL; 367 pst_item *item = NULL;
367 368
368 while ((c = getopt(argc, argv, "b:c:Vh"))!= -1) { 369 while ((c = getopt(argc, argv, "b:c:d:Vh"))!= -1) {
369 switch (c) { 370 switch (c) {
370 case 'b': 371 case 'b':
371 ldap_base = optarg; 372 ldap_base = optarg;
372 temp = strchr(ldap_base, ','); 373 temp = strchr(ldap_base, ',');
373 if (temp) { 374 if (temp) {
376 *temp = ','; 377 *temp = ',';
377 } 378 }
378 break; 379 break;
379 case 'c': 380 case 'c':
380 ldap_class = optarg; 381 ldap_class = optarg;
382 break;
383 case 'd':
384 d_log = optarg;
381 break; 385 break;
382 case 'h': 386 case 'h':
383 usage(); 387 usage();
384 exit(0); 388 exit(0);
385 break; 389 break;
400 usage(); 404 usage();
401 exit(2); 405 exit(2);
402 } 406 }
403 407
404 #ifdef DEBUG_ALL 408 #ifdef DEBUG_ALL
405 DEBUG_INIT("pst2ldif.log"); 409 // force a log file
406 DEBUG_REGISTER_CLOSE(); 410 if (!d_log) d_log = "pst2ldif.log";
407 #endif 411 #endif
412 DEBUG_INIT(d_log);
413 DEBUG_REGISTER_CLOSE();
408 DEBUG_ENT("main"); 414 DEBUG_ENT("main");
409 RET_DERROR(pst_open(&pstfile, fname, "r"), 1, ("Error opening File\n")); 415 RET_DERROR(pst_open(&pstfile, fname, "r"), 1, ("Error opening File\n"));
410 RET_DERROR(pst_load_index(&pstfile), 2, ("Index Error\n")); 416 RET_DERROR(pst_load_index(&pstfile), 2, ("Index Error\n"));
411 417
412 pst_load_extended_attributes(&pstfile); 418 pst_load_extended_attributes(&pstfile);