Annotation of db/prgsrc/eq/chgkfiles.pm, revision 1.2

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

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