File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / ntp / ntpdc / nl.pl
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, 5 months ago) by misho
Branches: ntp, MAIN
CVS tags: v4_2_6p5p0, v4_2_6p5, HEAD
ntp 4.2.6p5

    1: #! /usr/local/perl-5.8.8/bin/perl -w
    2: 
    3: $found = 0;
    4: $last = 0;
    5: $debug = 0;
    6: 
    7: while (<>) {
    8:     next if /^#/;
    9:     next if /^\s*$/;
   10:     if (/^struct req_pkt/) {
   11: 	$found = 1;
   12:     }
   13:     if (/^struct info_dns_assoc/) {
   14: 	$last = 1;
   15:     }
   16:     if ($found) {
   17: 	if (/^(struct\s*\w*)\s*{\s*$/) {
   18: 	    $type = $1;
   19: 	    print STDERR "type = '$type'\n" if $debug;
   20: 	    printf "  printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n";
   21: 	    next;
   22: 	}
   23: 	if (/\s*\w+\s+(\w*)\s*(\[.*\])?\s*;\s*$/) {
   24: 	    $field = $1;
   25: 	    print STDERR "\tfield = '$field'\n" if $debug;
   26: 	    printf "  printf(\"offsetof($field) = %%d\\n\", \n\t (int) offsetof($type, $field));\n";
   27: 	    next;
   28: 	}
   29: 	if (/^}\s*;\s*$/) {
   30: 	    printf "  printf(\"\\n\");\n\n";
   31: 	    $found = 0 if $last;
   32: 	    next;
   33: 	}
   34: 	print STDERR "Unmatched line: $_";
   35: 	exit 1;
   36:     }
   37: }

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