/[kvake]/kvake.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /kvake.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Fri Apr 14 06:30:19 2000 UTC (22 years, 7 months ago) by dpavlin
Branch: MAIN
Changes since 1.2: +11 -196 lines
File MIME type: text/plain
modularizacija, -v (verbose) flag

1 #!/usr/local/bin/perl -w
2 #
3 # program pretvara ch, zh, sh, cc, dh u odgovrajuce
4 # ISO 8859-2 znakove
5 # ozujak 1998.
6 # Hana Breyer Priselac
7 #
8 # poziva se s ./kvake.sh PUT
9 # gdje je PUT puni UNIX path do html dokumenata koje
10 # konvertirate
11 #
12 # 2000-02-16 Dobrica Pavlinusic <dpavlin@pliva.hr> prva perl verzija
13 # 2000-03-01 DbP poravljen ignore_dirs grep bug
14 #
15 # 2000-03-31 Hana sada ignorira sve sto ^eng$, ^eng_ , ^adresar$ u imenu direktorija
16
17 $mod_time = 10*60; # 10 minuta
18 #$mod_time = 24*60*60; # 1 day
19
20 $verbose = 1;
21
22 #@ignore_dirs=( "/data/web/public/adresar/", "/data/web/public/eng" );
23
24 while (defined($ARGV[0]) && $ARGV[0] eq "-v") {
25 $verbose++;
26 shift @ARGV;
27 }
28 print STDERR "verbosity: $verbose\n" if ($verbose);
29
30 if (! defined(@ARGV)) {
31 @dirs=( "/data/web/public",
32 "/usr/users/it/dpeterc" );
33 } else {
34 @dirs=@ARGV;
35 }
36
37 print STDERR "Scanning dirs: @dirs\n";
38
39 foreach $dir (@dirs) {
40 opendir(DIR,"$dir") || warn "can't open $dir: $!";
41 foreach $f (grep { !/^\./ } readdir(DIR)) {
42 if (-d "$dir/$f" && $f !~ /^eng$/ && $f !~ /^adresar$/ && $f !~ /^eng_/) {
43 $push_it = 1;
44 push @dirs,"$dir/$f" if ($push_it);
45 }
46 elsif (-f "$dir/$f" && ! -l "$dir/$f") {
47 @stat = stat(_);
48 if ($f =~ /\.html/ && (time() - $stat[9]) < $mod_time) {
49 print "filek za mjenjanje `$dir/$f\n" if ($verbose);
50 push @files,"$dir/$f";
51 }
52 else {
53 print "ovo je staro: $dir/$f\n" if ($verbose > 1);
54 }
55 }
56 elsif ($f =~ /^eng$/ || $f =~ /adresar/ || $f =~ /^eng_/) {
57 print "preskacem jer je eng ili adresar $dir/$f\n" if ($verbose);
58 }
59 else {
60 print "ovo je link $dir/$f\n" if ($verbose);
61 }
62 }
63 closedir DIR;
64 }
65
66 foreach $file (@files) {
67 if (open(IN,"$file")) {
68 print "$file\n" if ($verbose);
69 if (open(OUT,"> $file.$$")) {
70 while(<IN>) {
71 replace();
72 print OUT "$_";
73 }
74 } else {
75 warn "can't open $file.$$: $!";
76 }
77 close(OUT);
78 } else {
79 warn "can't open $file for reading: $!";
80 }
81 close(IN);
82 @stat = stat($file);
83 rename "$file.$$","$file";
84 chmod 0664,"$file";
85 # chmod $stat[2],"$file";
86 chown $stat[4],$stat[5],"$file";
87 }
88
89 1;
90
91 sub replace {
92 do '/root/kvake/zamjene.pl';
93 }

  ViewVC Help
Powered by ViewVC 1.1.26