Changeset 1692
- Timestamp:
- 2000-11-22T16:40:38+13:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/gsConvert.pl
r1687 r1692 49 49 sub print_usage 50 50 { 51 print STDERR "Usage: $0 [-type doc|pdf] [-output html|text] filename\n"; 51 print STDERR "Usage: $0 [options] filename\n"; 52 print STDERR "Options are:\n\t-type\tdoc|pdf\n\t-output\thtml|text\n"; 53 print STDERR "\t-timeout\t<max cpu seconds>\n"; 52 54 exit(1); 53 55 } … … 57 59 { 58 60 my (@ARGV) = @_; 59 my ($input_type,$output_type,$verbose); 60 61 my ($input_type,$output_type,$verbose,$timeout); 62 63 $timeout = 0; 61 64 # read command-line arguments 62 65 if (!parsargv::parse(\@ARGV, 63 66 'type/(doc|pdf)/', \$input_type, 64 67 'output/(html|text)/', \$output_type, 68 'timeout/\d+/0',\$timeout, 65 69 'verbose/\d+/0', \$verbose)) 66 70 { … … 323 327 my $wvWare = &util::filename_cat($wv_home, "bin", "wvWare"); 324 328 return 0 unless (-e "$wvWare"); 325 $cmd = "ulimit -t 40;"; 329 $cmd = ""; 330 if ($timeout) {$cmd = "ulimit -t $timeout;";} 326 331 $cmd .= "$wvWare --charset utf-8 --config $wv_conf"; 327 332 $cmd .= " \"$input_filename\" > \"$output_filestem.html\" 2>\"$output_filestem.err\""; … … 365 370 $r_cmd = "rtf2html" unless (-e "$r_cmd"); 366 371 return 0 unless (-e "$r_cmd"); 367 $cmd = "ulimit -t 40;"; 372 $cmd = ""; 373 if ($timeout) {$cmd = "ulimit -t $timeout;";} 368 374 $cmd .= "$r_cmd"; 369 375 $cmd .= " \"$input_filename\" > \"$output_filestem.html\" 2>\"$output_filestem.err\""; … … 403 409 return 0 unless (-e "$pdftohtml"); 404 410 405 $cmd = "ulimit -t 40;"; 411 $cmd = ""; 412 if ($timeout) {$cmd = "ulimit -t $timeout;";} 406 413 $cmd .= "$pdftohtml -noframes"; 407 414 $cmd .= " \"$input_filename\" \"$output_filestem.html\""; … … 416 423 } 417 424 425 # make sure the converter made something 426 if (! -e "$output_filestem.html") 427 { 428 &util::rm("$output_filestem.out") if (-e "$output_filestem.out"); 429 # print out the converters std err, if any 430 if (-e "$output_filestem.err") { 431 open (ERRLOG, "$output_filestem.err") || die "$!"; 432 print STDERR "pdftohtml:\n"; 433 while (<ERRLOG>) { 434 print STDERR "$_"; 435 } 436 close ERRLOG; 437 } 438 return 0; 439 } 440 418 441 &util::rm("$output_filestem.out") if (-e "$output_filestem.out"); 419 442 return 1; … … 434 457 &util::rm("$output_filestem.text") if (-e "$output_filestem.text"); 435 458 &util::rm("$output_filestem.err") if (-e "$output_filestem.err"); 459 return 0; 460 } 461 462 # make sure the converter made something 463 if (! -e "$output_filestem.html") 464 { 465 &util::rm("$output_filestem.out") if (-e "$output_filestem.out"); 466 # print out the converters std err, if any 467 if (-e "$output_filestem.err") { 468 open (ERRLOG, "$output_filestem.err") || die "$!"; 469 print STDERR "pdftotext:\n"; 470 while (<ERRLOG>) { 471 print STDERR "$_"; 472 } 473 close ERRLOG; 474 } 436 475 return 0; 437 476 }
Note:
See TracChangeset
for help on using the changeset viewer.