15 $SIG{'__WARN__'} = \&warning;
17 Getopt::Long::Configure("no_ignore_case", "bundling", "gnu_compat",
19 if (not GetOptions(\%opts,
28 if (exists($opts{'h'})) {
32 if (exists($opts{'V'})) {
38 error(4, "No input files\n");
40 if (exists($opts{'o'})) {
42 error(4, "Cannot specify -o with multiple files\n");
44 compile($ARGV[0], $opts{'o'});
48 $output =~ s/\.[^.]+$/.html/;
49 compile($input, $output);
58 printf($fh "Usage: %s [-o <output>] <input> ...\n", $0);
67 print(" -o <output> Place the output into <output>\n");
68 print(" -h, --help Display this information\n");
69 print(" -V, --version Display compiler version information\n");
76 print("ssic 0.1.0\n");
77 print("Copyright (C) 2013 Patrick \"P. J.\" McDermott\n");
78 print("License GPLv3+: GNU GPL version 3 or later " .
79 "<http://gnu.org/licenses/gpl.html>.\n");
80 print("This is free software: you are free to change and " .
81 "redistribute it.\n");
82 print("There is NO WARRANTY, to the extent permitted by law.\n");
87 my ($fmt, $args) = @_;
89 printf("ssic: Warning: " . $fmt, $args);
94 my ($status, $fmt, $args) = @_;
96 printf("ssic: Error: " . $fmt, $args);
102 my ($input, $output) = @_;
107 if ($input eq $output) {
108 error(4, "Input and output files are equal\n");
111 open($input_fh, "<", $input);
112 open($output_fh, ">", $output);
114 $CGI::SSI::DEBUG = 0;
115 $ssi = CGI::SSI->new();
117 print($output_fh $ssi->process(<$input_fh>));