summaryrefslogtreecommitdiff
path: root/ntpdc/nl.pl.in
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-12-02 09:01:21 +0000
committer <>2014-12-04 16:11:25 +0000
commitbdab5265fcbf3f472545073a23f8999749a9f2b9 (patch)
treec6018dd03dea906f8f1fb5f105f05b71a7dc250a /ntpdc/nl.pl.in
downloadntp-bdab5265fcbf3f472545073a23f8999749a9f2b9.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.in')
-rw-r--r--ntpdc/nl.pl.in43
1 files changed, 43 insertions, 0 deletions
diff --git a/ntpdc/nl.pl.in b/ntpdc/nl.pl.in
new file mode 100644
index 0000000..8007538
--- /dev/null
+++ b/ntpdc/nl.pl.in
@@ -0,0 +1,43 @@
+#! @PATH_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;
+ }
+}