File:  [Apple XNU] / XNU / bsd / miscfs / devfs / reproto.sh
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:44:48 2018 UTC (8 years, 2 months ago) by root
Branches: MAIN, Apple
CVS tags: v68_4-1_1, HEAD
xnu-68.4-1.1

#!/bin/sh
#
# This used to be a shell script, but had to become more sophisticated
# to allow for KNF function definitions.  So rewrote in perl, but wrapped
# as a shell script.
#
exec /usr/bin/perl << *EOF*
open(PROTO, ">devfs_proto.h") || die "Cannot open devfs_proto.h\n";

print PROTO "/* THIS FILE HAS BEEN PRODUCED AUTOMATICALLY */\n";

while (\$file = <*.c>) {
    if(open(F, \$file) == 0) {
	warn "Cannot open \$file.\n";
	next;
    }

    while(<F>) {
	chop;
	if (m|/\*proto\*/|) {
	    \$collecting = 1;
	    \$idx = 0;
	} elsif (\$collecting) {
	    if (/^{/) {
		\$text[\$idx - 1] .= ';';
		for (\$i = 0; \$i < \$idx; \$i++) {
		    print PROTO "\$text[\$i]";
		    print PROTO \$i == 0? "\t": "\n";
		}
		\$collecting = 0;
		next;
	    }
	    \$text[\$idx++] = \$_;
	}
    }
    close F;
}

print PROTO  "/* THIS FILE PRODUCED AUTOMATICALLY */\n" .
    "/* DO NOT EDIT (see reproto.sh) */\n";

*EOF*

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.