#!/usr/bin/perl -w # # dbfilesplit # Copyright (C) 2000 by John Heidemann # $Id: dbfilesplit,v 1.4 2003/05/23 04:15:46 johnh Exp $ # # This program is distributed under terms of the GNU general # public license, version 2. See the file COPYING # in $dblibdir for details. # sub usage { print <getopt) { $ch = $dbopts->opt; if ($ch eq 'd') { $debug++; } elsif ($ch eq 'p') { $prefix = $dbopts->optarg; } elsif ($ch eq 's') { $suffix = $dbopts->optarg; } else { &usage; }; }; # &usage if ($#ARGV < -1); my($count) = -1; while () { if (/^$headertag_regexp/) { &process_header($_); &close_file; &open_file; &write_header(); } else { die "$0: lines before first tag\n" if ($count < 0); print $_; }; }; &close_file; exit 0; sub open_file { $count++; open(STDOUT, ">$prefix$count$suffix") || die "$0: cannot write $prefix$count$suffix\n"; } sub close_file { return if ($count < 0); # die "$0: close_file before open_file\n" if ($count < 0); print "# | $prog ", join(" ", @orig_argv), "\n"; close STDOUT; } # warning suppression my($dummy) = $dbbindir; $dummy = $headertag_regexp;