# generate prototypes for rsync
-use strict;
-my $old_protos = '';
-if (open(IN, '<', 'proto.h')) {
+$old_protos = '';
+if (open(IN, 'proto.h')) {
$old_protos = join('', <IN>);
close IN;
}
-my %FN_MAP = (
+%FN_MAP = (
BOOL => 'BOOL ',
CHAR => 'char ',
INTEGER => 'int ',
STRING => 'char *',
);
-my $inheader = 0;
-my $protos = qq|/* This file is automatically generated with "make proto". DO NOT EDIT */\n\n|;
+$inheader = 0;
+$protos = qq|/* This file is automatically generated with "make proto". DO NOT EDIT */\n\n|;
while (<>) {
if ($inheader) {
s/$/;/;
}
$protos .= $_;
- }
-
- if (/^FN_(LOCAL|GLOBAL)_([^(]+)\(([^,()]+)/) {
- my $ret = $FN_MAP{$2};
- my $func = $3;
- my $arg = $1 eq 'LOCAL' ? 'int ' : 'void';
+ } elsif (/^FN_(LOCAL|GLOBAL)_([^(]+)\(([^,()]+)/) {
+ $ret = $FN_MAP{$2};
+ $func = $3;
+ $arg = $1 eq 'LOCAL' ? 'int module_id' : 'void';
$protos .= "$ret$func($arg);\n";
- } elsif (/^static|^extern/ || /[;]/) {
- ;
- } elsif (!/^[A-Za-z][A-Za-z0-9_]* /) {
+ } elsif (/^static|^extern/ || /[;]/ || !/^[A-Za-z][A-Za-z0-9_]* /) {
;
} elsif (/[(].*[)][ \t]*$/) {
s/$/;/;
}
if ($old_protos ne $protos) {
- open(OUT, '>', 'proto.h') or die $!;
+ open(OUT, '>proto.h') or die $!;
print OUT $protos;
close OUT;
}
+
+open(OUT, '>proto.h-tstamp') and close OUT;