added shortcut to iDMC homepage to install program
[iDMC.git] / misc / headers2.pl
blob9e2e43b9e393d30209953ee6964c079ed7311934
1 #!/usr/bin/perl -i
3 # first argument is the header file
4 # second one the file to be changed
5 # use -i.orig above to make backup files
7 use strict;
8 use warnings;
10 my $copyright_file = $ARGV[0];
12 open(H, "< " . $copyright_file) || die("can't open " . $copyright_file . ": $!");
13 my @header = <H>;
15 shift(@ARGV);
17 if (eof()) {
18 die "EOF found\n";
21 # skip initial empty lines
22 while (<>)
24 # print $_;
25 if (/^\s*$/) {
26 next;
28 last;
31 if (eof()) {
32 die "EOF found\n";
35 # look for comment beginning
36 if (!/^\s*\/\*/) {
37 die "comment not found\n";
40 # look for comment end
41 while (<>) {
42 if (/^\s*\*\/$/) {
43 last;
45 next;
48 if (eof()) {
49 die "EOF found\n";
52 # output header
53 print @header;
55 # output remaining lines
56 while (<>)
58 print;