aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2005-12-13 22:21:46 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2005-12-13 22:21:46 +0000
commitfea562c0893e88c0c8e1b778b826a2e473fdf760 (patch)
tree3f7107730c2f5fc3b6d8930ebeaca74c542d7d4b
parent4ffa4230f0d4f004e8891f8475c55d7ec46f6a8d (diff)
Notes
-rw-r--r--tools/tools/ansify/ansify.pl26
1 files changed, 24 insertions, 2 deletions
diff --git a/tools/tools/ansify/ansify.pl b/tools/tools/ansify/ansify.pl
index 4ae8de9c3437..801d693f30d7 100644
--- a/tools/tools/ansify/ansify.pl
+++ b/tools/tools/ansify/ansify.pl
@@ -31,6 +31,10 @@
use v5.6.0;
use strict;
+use Getopt::Long;
+
+my $caddr_t;
+
sub ansify($$$) {
my $ifh = shift;
my $ofh = shift;
@@ -75,8 +79,10 @@ sub ansify($$$) {
$line += @saved;
next OUTER;
}
-# $type{$arg} = "void *"
-# if $type{$arg} eq "caddr_t";
+ if ($caddr_t) {
+ $type{$arg} = "void *"
+ if $type{$arg} eq "caddr_t";
+ }
$repl .= $type{$arg};
$repl .= " "
unless ($type{$arg} =~ m/\*$/);
@@ -129,7 +135,23 @@ sub ansify_file($) {
}
}
+sub usage() {
+ print STDERR "usage: ansify [options] [file ...]
+
+Options:
+ -c, --caddr_t Replace caddr_t with void * in converted
+ function definitions
+";
+ exit(1);
+}
+
MAIN:{
+ Getopt::Long::Configure("auto_abbrev", "bundling");
+ GetOptions(
+ "c|caddr_t" => \$caddr_t,
+ )
+ or usage();
+
if (@ARGV) {
foreach (@ARGV) {
ansify_file($_);