diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-12-02 09:01:21 +0000 |
---|---|---|
committer | <> | 2014-12-04 16:11:25 +0000 |
commit | bdab5265fcbf3f472545073a23f8999749a9f2b9 (patch) | |
tree | c6018dd03dea906f8f1fb5f105f05b71a7dc250a /ntpdc/nl.pl | |
download | ntp-d4b7cd9723cce9561fa15f74b90b85a3a61b5ef8.tar.gz |
Imported from /home/lorry/working-area/delta_ntp/ntp-dev-4.2.7p482.tar.gz.ntp-dev-4.2.7p482
Diffstat (limited to 'ntpdc/nl.pl')
-rwxr-xr-x | ntpdc/nl.pl | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/ntpdc/nl.pl b/ntpdc/nl.pl new file mode 100755 index 0000000..4a418fb --- /dev/null +++ b/ntpdc/nl.pl @@ -0,0 +1,43 @@ +#! /usr/local/perl-5.8.8/bin/perl -w + +$found = 0; +$last = 0; +$debug = 0; + +while (<>) { + next if /^#/; + next if /^\s*$/; + if (/^typedef union req_data_u_tag/) { + $found = 1; + } + if (/^struct info_dns_assoc/) { + $last = 1; + } + if ($found) { + if (/^(struct\s*\w*)\s*{\s*$/) { + $type = $1; + print STDERR "type = '$type'\n" if $debug; + printf " printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n"; + next; + } + if (/^typedef (union\s*\w*)\s*{\s*$/) { + $type = $1; + print STDERR "union = '$type'\n" if $debug; + printf " printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n"; + next; + } + if (/\s*\w+\s+(\w*)\s*(\[.*\])?\s*;\s*$/) { + $field = $1; + print STDERR "\tfield = '$field'\n" if $debug; + printf " printf(\"offsetof($field) = %%d\\n\", \n\t (int) offsetof($type, $field));\n"; + next; + } + if (/^}\s*\w*\s*;\s*$/) { + printf " printf(\"\\n\");\n\n"; + $found = 0 if $last; + next; + } + print STDERR "Unmatched line: $_"; + exit 1; + } +} |