File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / ntp / ntpdc / nl.pl.in
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:08:38 2012 UTC (12 years ago) by misho
Branches: ntp, MAIN
CVS tags: v4_2_6p5p0, v4_2_6p5, HEAD
ntp 4.2.6p5

#! @PATH_PERL@ -w

$found = 0;
$last = 0;
$debug = 0;

while (<>) {
    next if /^#/;
    next if /^\s*$/;
    if (/^struct req_pkt/) {
	$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 (/\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*;\s*$/) {
	    printf "  printf(\"\\n\");\n\n";
	    $found = 0 if $last;
	    next;
	}
	print STDERR "Unmatched line: $_";
	exit 1;
    }
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>