(file) Return to make-examples.pl CVS log (file) Jump to this file's LXR Page (dir) Up to [CENS] / emstar / fusd / doc

File: [CENS] / emstar / fusd / doc / make-examples.pl (download) / (as text)
Revision: 1.4, Tue Sep 25 14:46:39 2001 UTC (8 years, 2 months ago) by jelson
Branch: MAIN
CVS Tags: scale_radio_channel, rdd_alpha_version_1, pregeonet, nims-lab-Sep07-2004, nims-jr-Sep05-04, mote, lessgps_release, kiss_release, fusd_with_no_daemon, fusd_1-1_devel, fusd-1_10, fusd-1_04, fusd-1_03, fusd-1_02, fusd-1_00, copyright-07-11-03, bp_scale_radio_channel, audio_server, acoustic-05-18-06, ROUTING_EXPERIMENTAL, PRE_TOSNIC_FIX, PRE_NOMEGA_MOTENIC, PRE_MOTENIC_CLEANUP, PRE_CEILING_FIX, PRE_64BIT, MOTENIC_PRE_BUGFIX_20050415, LESSGPS_1_00, LAURA_CALIBRATION_EXPERIMENTS, KISS_1_0, HOSTMOTE_V_6_EXPERIMENTAL, HOSTMOTE_PROTOCOL_VERSION_7, HOSTMOTE_PROTOCOL_VERSION_6_WITH_HOSTMOAP, HOSTMOTE_PROTOCOL_VERSION_5_WITH_HOSTMOAP, HOSTMOTE_PROTOCOL_VERSION_5, HOSTMOTE_PROTOCOL_VERSION_4, HOSTMOTE_PROTOCOL_VERSION_3, HEAD, ESS_RELEASE_3_5, ESS_RELEASE_3_4, ESS_RELEASE_3_3, ESS_RELEASE_3_2, ESS_RELEASE_3_1, ESS_RELEASE_3_0, ESS_RELEASE_2_0, ESS_CONNECTIVITY, ESS_CENTROUTE_TESTING, ESS2-CMS-V1_5_pretest, ESS2-CMS-V1_4cMergeSympathy_2, ESS2-CMS-V1_4c, ESS2-CMS-V1_4b, ESS2-CMS-V1_4a, ESS2-CMS-V1_3, ESS2-CMS-V1_2, ESS2-CMS-V1_1, ESS2-CMS-V1_0, EMSTAR_RELEASE_2_5, EMSTAR_RELEASE_2_1_BRANCH, EMSTAR_RELEASE_2_1, EMSTAR_RELEASE_2_0_beta1, EMSTAR_RELEASE_2_0, EMSTAR_RELEASE_1_3_2, EMSTAR_RELEASE_1_3_1, EMSTAR_RELEASE_1_3, EMSTAR_RELEASE_1_2, EMSTAR_RELEASE_1_1, EMSTAR_RELEASE_1_0, EMSTAR_PRE_HTML, CYCLOPS_RELEASE_CANDIDATE_2_0, CYCLOPS_PRERELEASE_STABLE, CENTROUTE_EMSTAR_SOCKETS, BG_1_0, BANGLADESH_ARSENIC_1_2, BANGLADESH_ARSENIC_1_1, AMARSS_JR_DEPLOYMENT_6_05_07
Branch point for: EVENT_DEVEL
Changes since 1.3: +1 -1 lines
Changed make-examples so that /* SKIPLINE */ lets you omit an individual
line from an example, more easily than a STOP-START pair.  Used this to
clean up the ioctl example.  Started excerpting parts of the pager
into the docs.

#!/usr/bin/perl -w


foreach $path (@ARGV) {
    $writing = 0;

    if (!open(IN, $path)) {
	print "trying to open $path: $!\n";
	next;
    }

    while ($line = <IN>) {
	if ($line =~ /EXAMPLE (\w*) ([\w\-\.]*)/) {
	    $command = $1;
	    $filename = $2 . ".example";

	    if ($command eq 'START') {
		if ($writing == 0) {
		    if (!open(OUT, ">>$filename")) {
			print "trying to write to $filename: $!\n";
		    } else {
			print "$path: writing to $filename\n";
			$writing = 1;
		    }
		} else {
		    print "$path: got $line while already writing!\n";
		}
	    }

	    if ($command eq 'STOP') {
		if ($writing == 1) {
		    close(OUT);
		    $writing = 0;
		} else {
		    chomp($line);
		    die "$path line $.: got $line when not writing!\n";
		}
	    }
	} else {
	    if ($writing && $line !~ /SKIPLINE/) {
		print OUT $line;
	    }
	}
    }
    if ($writing) {
	close(OUT);
    }
    close(IN);
}


CENS CVS Mailing List
Powered by
ViewCVS 0.9.2