mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Add a -c option to control caddr_t replacement (which was commented out in
the previous revision)
This commit is contained in:
parent
4ffa4230f0
commit
fea562c089
1 changed files with 24 additions and 2 deletions
|
|
@ -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($_);
|
||||
|
|
|
|||
Loading…
Reference in a new issue