yu.dong | c33b307 | 2024-08-21 23:14:49 -0700 | [diff] [blame^] | 1 |
|
| 2 | use Getopt::Long;
|
| 3 |
|
| 4 | GetOptions("cfg|configs:s", "dox|Doc-o-MaticProjectFile:s");
|
| 5 |
|
| 6 | $dom_exe = 'C:\\Program Files\\Doc-O-Matic 6 Professional\\dmcc.exe';
|
| 7 |
|
| 8 | if( $opt_cfg !~ /html|pdf|chm|all/io )
|
| 9 | { # Not a valid argument
|
| 10 | if ($opt_cfg eq "")
|
| 11 | {
|
| 12 | print "\n\nError : Configuration must be specified by -cfg option.\n";
|
| 13 | }
|
| 14 | else
|
| 15 | {
|
| 16 | print "\n\nInvalid argument : '$opt_cfg'\n";
|
| 17 | }
|
| 18 | exit;
|
| 19 | }
|
| 20 |
|
| 21 | if( !$opt_dox )
|
| 22 | { # must specify a project file
|
| 23 | print "\n\nMissing Doc-o-Matic project file. Use -dox to specify project file.\n";
|
| 24 | exit;
|
| 25 | }
|
| 26 |
|
| 27 | # change options to lowercase
|
| 28 | $opt_cfg =~ s/HTML/html/igo;
|
| 29 | $opt_cfg =~ s/PDF/pdf/igo;
|
| 30 | $opt_cfg =~ s/CHM/chm/igo;
|
| 31 | $opt_cfg =~ s/ALL/all/igo;
|
| 32 |
|
| 33 | $cmd = "" ;
|
| 34 | if ($opt_cfg eq "html")
|
| 35 | {
|
| 36 | $cmd = "\"${dom_exe}\" -config \"MTKDocConfig-HTML\" -noshow -w3";
|
| 37 | }
|
| 38 | elsif ($opt_cfg eq "pdf")
|
| 39 | {
|
| 40 | $cmd = "\"${dom_exe}\" -config \"MTKDocConfig-PDF\" -noshow -w3";
|
| 41 | }
|
| 42 | elsif ($opt_cfg eq "chm")
|
| 43 | {
|
| 44 | $cmd = "\"${dom_exe}\" -config \"MTKDocConfig-CHM\" -noshow -w3";
|
| 45 | }
|
| 46 | else
|
| 47 | {
|
| 48 | $cmd = "\"${dom_exe}\" -all -noshow -w3";
|
| 49 | }
|
| 50 | $cmd = "$cmd $opt_dox";
|
| 51 | print "$cmd\n";
|
| 52 | system($cmd);
|
| 53 |
|
| 54 | $a = &getTime;
|
| 55 | $t = time - $^T;
|
| 56 |
|
| 57 | print "\n$a, Program took $t secs\n";
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 | sub getTime()
|
| 63 | {
|
| 64 | my ($sec, $min, $hour, $mday, $mon, $year) = localtime(time);
|
| 65 | my $timeStr;
|
| 66 |
|
| 67 | if (defined($_[0]) && ($_[0] ne ""))
|
| 68 | {
|
| 69 | # return timestamp as part of filename
|
| 70 | $timeStr = sprintf("%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d", $year+1900, $mon+1, $mday, $hour, $min, $sec);
|
| 71 | }
|
| 72 | else
|
| 73 | {
|
| 74 | $timeStr = sprintf("%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d", $year+1900, $mon+1, $mday, $hour, $min, $sec);
|
| 75 | }
|
| 76 |
|
| 77 | return $timeStr;
|
| 78 | }
|