3 #===============================================================
5 # File ID: 26d14f32-5d43-11df-8375-90e6ba3022ac
6 # Extracts the last checkin from RCS files.
7 # Reads file names of the ,v files from stdin and stores the
8 # extracted data under Extracted/ with the same file structure
10 # find -name '*,v' -type f | rcs-extract
12 # Character set: UTF-8
13 # License: GNU General Public License version 2 or later
14 # ©opyleft 2004 Øyvind A. Holm <sunny@sunbase.org>
15 #===============================================================
23 my $Pref = ".Extracted/";
29 print("Opening $File...");
30 if (open(FromFP
, "<$File")) {
33 my $dest_dir = "$Pref";
34 if ($File =~ m/^(.*)\//) {
36 $dest_dir = "$Pref$Dir";
37 D
("[\$dest_dir = \"$dest_dir\"]");
38 # -d $dest_dir || mkpath($dest_dir, 1) || warn("$dest_dir: Couldn’t create path: $!\n");
45 my $to_file = "$Pref$File";
46 $to_file =~ s/^(.*),v$/$1/;
48 my $Rand = ".rand.$$." . substr(random
(), 0, 5);
49 warn("$to_file: File already exists, adding random extension: $Rand");
52 if (open(ToFP
, ">$to_file")) {
56 if (s/([^@])(@)([^@])/$1$3/g) {
57 print(STDERR
"[Found end]");
61 $end_found && s/^\@$//;
68 warn("$to_file: Unable to open file for write: $!");
71 warn("$File: Unable to open file for read: $!\n");
85 This program is free software; you can redistribute it and/or modify it
86 under the terms of the GNU General Public License as published by the
87 Free Software Foundation; either version 2 of the License, or (at your
88 option) any later version.
90 This program is distributed in the hope that it will be useful, but
91 WITHOUT ANY WARRANTY; without even the implied warranty of
92 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
93 See the GNU General Public License for more details.
95 You should have received a copy of the GNU General Public License along
96 with this program; if not, write to the Free Software Foundation, Inc.,
97 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
101 # vim: set fileencoding=UTF-8 filetype=perl foldmethod=marker foldlevel=0 :
102 # End of file rcs-extract