summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWolfram Schneider <wosch@FreeBSD.org>1996-12-28 16:24:57 +0000
committerWolfram Schneider <wosch@FreeBSD.org>1996-12-28 16:24:57 +0000
commit08d366cf6b753e76cb42a8e9883a0cb2bbbdff80 (patch)
treef3f18a0eeaff999c72df61d70b91c7a6adae616d /tools
parentfa2cedd44abb2b4e079483f6997fd23657953ce5 (diff)
Notes
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/epfe/epfe.pl38
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/tools/epfe/epfe.pl b/tools/tools/epfe/epfe.pl
new file mode 100644
index 000000000000..4afd824d4791
--- /dev/null
+++ b/tools/tools/epfe/epfe.pl
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+# Copyright (c) 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+#
+# epfe - extract printing filter examples from printing.sgml
+#
+# usage:
+# $ cd /usr/share/examples/printing
+# $ epfe < ../../doc/handbook/printing.sgml
+#
+# $Id$
+
+$in = 0; @a = ();
+sub Print { s/\&amp\;/&/g; push(@a,$_); }
+sub out {
+ local($name, *lines) = @_;
+ open(F, "> $name") || die "open $_[0]: $!\n";
+ print F @lines;
+ close F;
+}
+
+while(<>) {
+ if (/^<code>/) {
+ $in = 1;
+ } elsif (m%</code>% && $in > 0) {
+ if ($in > 1) {
+ $name = 'unknown' if !$name;
+ while(1) { if ($d{$name}) { $name .= 'X'; } else { last } }
+ &out("$name", *a);
+ $d{$name} = $name;
+ }
+ $in = 0; $name = ''; @a = ();
+ } elsif ($in == 1 && /^\#\s*!/) {
+ $in++; &Print;
+ } elsif ($in > 1) {
+ $name = $1 if (!$name && /^\#\s+(\S+)\s+-\s+/);
+ $in++; &Print;
+ }
+}