/[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

Annotation of /kvake.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide 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 dpavlin 1.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 dpavlin 1.2 #
15     # 2000-03-31 Hana sada ignorira sve sto ^eng$, ^eng_ , ^adresar$ u imenu direktorija
16 dpavlin 1.1
17 dpavlin 1.2 $mod_time = 10*60; # 10 minuta
18     #$mod_time = 24*60*60; # 1 day
19 dpavlin 1.1
20 dpavlin 1.3 $verbose = 1;
21 dpavlin 1.1
22 dpavlin 1.2 #@ignore_dirs=( "/data/web/public/adresar/", "/data/web/public/eng" );
23 dpavlin 1.1
24 dpavlin 1.3 while (defined($ARGV[0]) && $ARGV[0] eq "-v") {
25     $verbose++;
26     shift @ARGV;
27     }
28     print STDERR "verbosity: $verbose\n" if ($verbose);
29    
30 dpavlin 1.1 if (! defined(@ARGV)) {
31     @dirs=( "/data/web/public",
32     "/usr/users/it/dpeterc" );
33     } else {
34     @dirs=@ARGV;
35     }
36    
37 dpavlin 1.3 print STDERR "Scanning dirs: @dirs\n";
38    
39 dpavlin 1.1 foreach $dir (@dirs) {
40     opendir(DIR,"$dir") || warn "can't open $dir: $!";
41     foreach $f (grep { !/^\./ } readdir(DIR)) {
42 dpavlin 1.2 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 dpavlin 1.1 @stat = stat(_);
48     if ($f =~ /\.html/ && (time() - $stat[9]) < $mod_time) {
49 dpavlin 1.2 print "filek za mjenjanje `$dir/$f\n" if ($verbose);
50 dpavlin 1.1 push @files,"$dir/$f";
51     }
52 dpavlin 1.2 else {
53 dpavlin 1.3 print "ovo je staro: $dir/$f\n" if ($verbose > 1);
54 dpavlin 1.1 }
55 dpavlin 1.2 }
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 dpavlin 1.1 }
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 dpavlin 1.3 do '/root/kvake/zamjene.pl';
93 dpavlin 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.26