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

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

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