-
Notifications
You must be signed in to change notification settings - Fork 0
/
makemono.pl
31 lines (23 loc) · 837 Bytes
/
makemono.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Make monolithic program by in-line expanding all
# do includes in the development version.
use strict;
use warnings;
open(FI, "<isbniser.pl") || die("Cannot open isbniser.pl");
open(FO, ">isbniser") || die("Cannot create isbniser");
while (my $l = <FI>) {
if ($l =~ m/(\s*)do\s+"([^"]+)"\s*;/) {
my ($indent, $ifn) = ($1, $2);
open(II, "<$ifn") || die("Cannot open include file $ifn");
print(FO "$indent# Included from $ifn\n");
while (my $li = <II>) {
print(FO $li);
}
print(FO "$indent# End include from $ifn\n");
close(II);
next;
}
print(FO $l);
}
close(FO);
close(FI);
chmod(0755, "isbniser"); # Make the monolithic file executable