File:  [Local Repository] / db / prgsrc / chgkfiles.pm
Revision 1.4: download - view: text, annotated - select for diffs - revision graph
Mon Nov 19 01:10:39 2001 UTC (22 years, 6 months ago) by roma7
Branches: MAIN
CVS tags: HEAD
nothing again

    1: #!/usr/bin/perl
    2: 
    3: =head1 NAME
    4: 
    5: chgkfiles.pm
    6: 
    7: =head1 SYNOPSIS
    8:   :(
    9: 
   10: =head1 DESCRIPTION
   11: 
   12:   :(
   13: 
   14: =head1 AUTHOR
   15: 
   16: òÏÍÁÎ óÅÍÉÚÁÒÏ×
   17: 
   18: =cut
   19: 
   20: package chgkfiles;
   21: use DBI;
   22: use Exporter;
   23: use vars qw(@ISA @EXPORT);
   24: @ISA=qw(Exporter);
   25: 
   26: @EXPORT = qw(&input_files &output_files &mywrite &auto_message 
   27:             &myprint &config_error &getstring);
   28: 
   29: 
   30: BEGIN {do "chgk.cnf"};
   31: 
   32: my %prt;
   33: 
   34: sub auto_message
   35: {
   36:   my $time=localtime;
   37:   my $f=$_[0];
   38: 
   39:   print $f "# This file is automatically generated at $time by $_[1]\n";
   40: }
   41: 
   42: sub mywrite
   43: {
   44:   (my $file, %prt)=@_;
   45:   write $file;
   46: }
   47: 
   48: sub myprint
   49: {
   50:   (my $file, @prt)=@_;
   51:   print $file @prt;
   52: }
   53: 
   54: sub setcount
   55: {
   56:   $c=shift
   57: }
   58: 
   59: sub setword
   60: {
   61:   $word=shift
   62: }
   63: 
   64: 
   65: sub getstring #áåð¸ò ïåðâóþ
   66: {
   67: 
   68:    if ($#_>=1) { $a=$_[1]; $pattern=qr/$_[0]/}
   69:    else {$a=$_[0]; $pattern=qr/\s+/};
   70:    do
   71:    {   
   72:      $b=<$a>;
   73:      $b =~ s/^\s+//g;
   74:      $b =~ s/\s+$//g;
   75:      $b =~ s/\#.*$//g;
   76:    }
   77:    until (($b ne '')||eof($a));
   78: 
   79: 
   80:   $b ? split(/$pattern/, $b):undef;
   81: }
   82: 
   83: sub config_error()
   84: {
   85:   "Can not open $_[0] file ${$_[0]}. Check your config.pl";
   86: }
   87: 
   88: 
   89: 
   90: sub input_files
   91: {
   92:     foreach $file (@_) 
   93:     {
   94:           my $f=lc $file;
   95:           open($file, "<$$f") or die "Can not open $file file $$f. Check your chgk.cnf\n";
   96:     }
   97: }
   98: 
   99: sub output_files
  100: {
  101:     foreach $file (@_) 
  102:     {
  103:           my $f=lc $file;
  104:           open($file, ">$$f") or die "Can not open $file file $$f. Check your chgk.cnf\n";
  105:     }
  106: }
  107: 
  108: format WORDLIST =
  109: @####### @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  110: $prt{c}, $prt{word}
  111: .
  112: 
  113: 	
  114: format DWORDLIST =
  115: @####### @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  116: $prt{c}, $prt{word}
  117: .
  118: 
  119: format VWORDLIST =
  120: @####### @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  121: $prt{c}, $prt{word}
  122: .
  123: 
  124: 
  125: format EWORDLIST =
  126: @####### @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  127: $prt{c}, $prt{word}
  128: .
  129: 
  130: format KWORDLIST =
  131: @####### @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  132: $prt{c}, $prt{word}
  133: .
  134: 
  135: 
  136: 
  137: format TABLE =
  138: @<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  139: $prt{word}, $prt{nf}, $prt{flag}
  140: .
  141: 
  142: format NEWTABLE =
  143: @<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  144: $prt{word}, $prt{nf}
  145: .
  146: 
  147: 
  148: 
  149: format NF =
  150: @####### @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  151: $prt{c}, $prt{word}, $prt{flag}
  152: .
  153: 
  154: format NEWNF =
  155: @####### @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  156: $prt{c}, $prt{word}
  157: .
  158: 
  159: 
  160: format ERRORS =
  161: @####### @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  162: $prt{c}, $prt{word}
  163: .
  164: 
  165: format NEWERRORS =
  166: @####### @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  167: $prt{c}, $prt{word}
  168: .
  169: 
  170: format VERSIONS =
  171: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  172: $prt{c}, $prt{word}, $prt{k}
  173: .
  174: 
  175: format EQUALS =
  176: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  177: $prt{first}, $prt{second}
  178: .
  179: 
  180: format IN2OUT =
  181: @<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  182: $prt{in}, $prt{out}
  183: .
  184: 
  185: format CTABLE =
  186: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  187: $prt{word}, $prt{number}
  188: .
  189: 
  190: format CNF =
  191: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  192: $prt{kvo}
  193: .
  194: 
  195: format ALIKE  =
  196: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  197: $prt{first}, $prt{second}
  198: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~
  199: $prt{first}, $prt{second}
  200: .
  201: 
  202: 
  203: 1;
  204: 
  205: __END__

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