9 use constant FILENAME=>".cvslinks";
10 use constant ENTRIES=>"CVS/Entries";
13 our($opt_u,$opt_c,$opt_d,$opt_r,$opt_R,$opt_l,$opt_v);
16 die "-u (update), -c (commit) or -R (delete) required" if !$opt_u && !$opt_c && !$opt_d;
17 die "-r (recursive)/-R (recursive w/o CVS) and -l (local) are conflicting"
18 if ($opt_r || $opt_R) && $opt_l;
20 $opt_r=1 if !$opt_r && !$opt_R && !$opt_l; # default
39 print cwd().": $msg\n";
45 opendir D,"." or die "Cannot open directory \".\": $!";
48 verbose "Deleting local link $_";
57 open L,FILENAME or die "File ".FILENAME." cannot be opened: $!";
59 verbose "Creating links from ".FILENAME;
62 next if /^$/; # empty-file (->empty-dir) stub line
63 /^(.+)\t(.+)$/ or warn "Unrecognized line: $_";
64 verbose "Creating link $1";
65 symlink $2,$1 or warn "symlink(\"$2\"->\"$1\"): $!";
73 opendir D,"." or die "Cannot open directory \".\": $!";
74 open L,">".FILENAME or die "File ".FILENAME." cannot be created: $!";
75 verbose "Storing links to ".FILENAME;
76 print L "\n"; # empty-file (->empty-dir) stub line
79 my $target=readlink or die "Cannot read link $_: $!";
80 verbose "Storing link $_";
81 print L "$_\t$target\n";
91 warn "Cannot chdir to $dir: $!";
94 verbose "Descented to child directory";
96 chdir ".." or die "Cannot return back to ..: $!";
97 verbose "Back in parent directory";
103 if (!open C,ENTRIES) {
104 warn "Cannot open file \"".ENTRIES."\": $!";
109 next if !m#^D/([^/]*)/#;
118 opendir D,"." or die "Cannot open directory \".\": $!";
120 # Beware of symlinked-directories !
121 next if -l || ! -d || $_ eq "." || $_ eq "..";