15 $SIG{'__WARN__'} = \&warning;
17 Getopt::Long::Configure("no_ignore_case", "bundling", "gnu_compat",
19 if (not GetOptions(\%opts,
27 if (exists($opts{'h'})) {
31 if (exists($opts{'V'})) {
37 error(4, "No input files\n");
39 if (exists($opts{'o'})) {
41 error(4, "Cannot specify -o with multiple files\n");
43 compile($ARGV[0], $opts{'o'});
47 $output =~ s/\.[^.]+$/.html/;
48 compile($input, $output);
57 printf($fh "Usage: %s [-o <output>] <input> ...\n", $0);
66 print(" -o <output> Place the output into <output>\n");
67 print(" -h, --help Display this information\n");
68 print(" -V, --version Display compiler version information\n");
75 print("ssic 0.1.0\n");
76 print("Copyright (C) 2013 Patrick \"P. J.\" McDermott\n");
77 print("License GPLv3+: GNU GPL version 3 or later " .
78 "<http://gnu.org/licenses/gpl.html>.\n");
79 print("This is free software: you are free to change and " .
80 "redistribute it.\n");
81 print("There is NO WARRANTY, to the extent permitted by law.\n");
86 my ($fmt, $args) = @_;
88 printf("ssic: Warning: " . $fmt, $args);
93 my ($status, $fmt, $args) = @_;
95 printf("ssic: Error: " . $fmt, $args);
101 my ($input, $output) = @_;
106 if ($input eq $output) {
107 error(4, "Input and output files are equal\n");
110 open($input_fh, "<", $input);
111 open($output_fh, ">", $output);
113 $CGI::SSI::DEBUG = 0;
114 $ssi = CGI::SSI->new();
116 print($output_fh $ssi->process(<$input_fh>));