summaryrefslogtreecommitdiffstats
path: root/source4/script
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-05 21:29:25 -0600
committerStefan Metzmacher <metze@samba.org>2008-01-05 15:36:01 -0600
commite644673c09aa8a0c42a5b3beb7c438ae2b1c68c5 (patch)
treee02d56297c42d1c1e730d02f081d07e49dd8e08d /source4/script
parentb7e34eb62580565d1526f793b5df8b26cdd65aa4 (diff)
downloadsamba-e644673c09aa8a0c42a5b3beb7c438ae2b1c68c5.tar.gz
samba-e644673c09aa8a0c42a5b3beb7c438ae2b1c68c5.tar.xz
samba-e644673c09aa8a0c42a5b3beb7c438ae2b1c68c5.zip
r26675: mkproto: Add --all argument, fix some perl warnings.
(This used to be commit a175ee6594046c44572e3314ab7c3b61dcd7422f)
Diffstat (limited to 'source4/script')
-rwxr-xr-xsource4/script/mkproto.pl19
1 files changed, 9 insertions, 10 deletions
diff --git a/source4/script/mkproto.pl b/source4/script/mkproto.pl
index f1c2cf9d0e8..3ed845e2bb5 100755
--- a/source4/script/mkproto.pl
+++ b/source4/script/mkproto.pl
@@ -17,14 +17,15 @@ use File::Path;
my $public_file = undef;
my $private_file = undef;
+my $all_file = undef;
my $public_define = undef;
my $private_define = undef;
my $_public = "";
my $_private = "";
my $public_data = \$_public;
my $private_data = \$_private;
-my $builddir = undef;
-my $srcdir = undef;
+my $builddir = ".";
+my $srcdir = ".";
sub public($)
{
@@ -55,6 +56,7 @@ sub usage()
GetOptions(
'public=s' => sub { my ($f,$v) = @_; $public_file = $v; },
+ 'all=s' => sub { my ($f,$v) = @_; $public_file = $v; $private_file = $v; },
'private=s' => sub { my ($f,$v) = @_; $private_file = $v; },
'define=s' => sub {
my ($f,$v) = @_;
@@ -93,9 +95,9 @@ if ((defined($private_file) and defined($public_file) and ($private_file eq $pub
sub file_load($)
{
- my($filename) = shift;
+ my($filename) = @_;
local(*INPUTFILE);
- open(INPUTFILE, $filename) || return undef;
+ open(INPUTFILE, $filename) or return undef;
my($saved_delim) = $/;
undef $/;
my($data) = <INPUTFILE>;
@@ -231,7 +233,7 @@ sub process_file($$$)
print_header(\&public, $public_define);
-if ($public_file ne $private_file) {
+if (defined($private_file) and defined($public_file) and $public_file ne $private_file) {
print_header(\&private, $private_define);
private("/* this file contains prototypes for functions that " .
@@ -251,7 +253,7 @@ public("#ifndef _WARN_UNUSED_RESULT_\n#define _WARN_UNUSED_RESULT_\n#endif\n\n")
process_file(\&public, \&private, $_) foreach (@ARGV);
print_footer(\&public, $public_define);
-if ($public_file ne $private_file) {
+if (defined($private_file) and $public_file ne $private_file) {
print_footer(\&private, $private_define);
}
@@ -263,15 +265,12 @@ if (not defined($private_file) and defined($public_file)) {
print STDOUT $$private_data;
}
-my $old_public_data = file_load($public_file);
-my $old_private_data = file_load($private_file);
-
mkpath(dirname($public_file), 0, 0755);
open(PUBLIC, ">$public_file") or die("Can't open `$public_file': $!");
print PUBLIC "$$public_data";
close(PUBLIC);
-if ($public_file ne $private_file) {
+if (defined($private_file) and $public_file ne $private_file) {
mkpath(dirname($private_file), 0, 0755);
open(PRIVATE, ">$private_file") or die("Can't open `$private_file': $!");
print PRIVATE "$$private_data";