summaryrefslogtreecommitdiffstats
path: root/contrib/perl5/eg/van
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/perl5/eg/van')
-rw-r--r--contrib/perl5/eg/van/empty45
-rw-r--r--contrib/perl5/eg/van/unvanish66
-rw-r--r--contrib/perl5/eg/van/vanexp21
-rw-r--r--contrib/perl5/eg/van/vanish65
4 files changed, 0 insertions, 197 deletions
diff --git a/contrib/perl5/eg/van/empty b/contrib/perl5/eg/van/empty
deleted file mode 100644
index d699319..0000000
--- a/contrib/perl5/eg/van/empty
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/perl
-
-# $RCSfile: empty,v $$Revision: 4.1 $$Date: 92/08/07 17:20:50 $
-
-# This script empties a trashcan.
-
-$recursive = shift if $ARGV[0] eq '-r';
-
-@ARGV = '.' if $#ARGV < 0;
-
-chop($pwd = `pwd`);
-
-dir: foreach $dir (@ARGV) {
- unless (chdir $dir) {
- print stderr "Can't find directory $dir: $!\n";
- next dir;
- }
- if ($recursive) {
- do cmd('find . -name .deleted -exec /bin/rm -rf {} ;');
- }
- else {
- if (-d '.deleted') {
- do cmd('rm -rf .deleted');
- }
- else {
- if ($dir eq '.' && $pwd =~ m|/\.deleted$|) {
- chdir '..';
- do cmd('rm -rf .deleted');
- }
- else {
- print stderr "No trashcan found in directory $dir\n";
- }
- }
- }
-}
-continue {
- chdir $pwd;
-}
-
-# force direct execution with no shell
-
-sub cmd {
- system split(' ',join(' ',@_));
-}
-
diff --git a/contrib/perl5/eg/van/unvanish b/contrib/perl5/eg/van/unvanish
deleted file mode 100644
index acb1603..0000000
--- a/contrib/perl5/eg/van/unvanish
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/perl
-
-# $RCSfile: unvanish,v $$Revision: 4.1 $$Date: 92/08/07 17:20:52 $
-
-sub it {
- if ($olddir ne '.') {
- chop($pwd = `pwd`) if $pwd eq '';
- (chdir $olddir) || die "Directory $olddir is not accesible";
- }
- unless ($olddir eq '.deleted') {
- if (-d '.deleted') {
- chdir '.deleted' || die "Directory .deleted is not accesible";
- }
- else {
- chop($pwd = `pwd`) if $pwd eq '';
- die "Directory .deleted does not exist" unless $pwd =~ /\.deleted$/;
- }
- }
- print `mv $startfiles$filelist..$force`;
- if ($olddir ne '.') {
- (chdir $pwd) || die "Can't get back to original directory $pwd: $!\n";
- }
-}
-
-if ($#ARGV < 0) {
- open(lastcmd,'.deleted/.lastcmd') ||
- open(lastcmd,'.lastcmd') ||
- die "No previous vanish in this dir";
- $ARGV = <lastcmd>;
- close(lastcmd);
- @ARGV = split(/[\n ]+/,$ARGV);
-}
-
-while ($ARGV[0] =~ /^-/) {
- $_ = shift;
- /^-f/ && ($force = ' >/dev/null 2>&1');
- /^-i/ && ($interactive = 1);
- if (/^-+$/) {
- $startfiles = '- ';
- last;
- }
-}
-
-while ($file = shift) {
- if ($file =~ s|^(.*)/||) {
- $dir = $1;
- }
- else {
- $dir = '.';
- }
-
- if ($dir ne $olddir) {
- do it() if $olddir;
- $olddir = $dir;
- }
-
- if ($interactive) {
- print "unvanish: restore $dir/$file? ";
- next unless <stdin> =~ /^y/i;
- }
-
- $filelist .= $file; $filelist .= ' ';
-
-}
-
-do it() if $olddir;
diff --git a/contrib/perl5/eg/van/vanexp b/contrib/perl5/eg/van/vanexp
deleted file mode 100644
index 415b73b..0000000
--- a/contrib/perl5/eg/van/vanexp
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/perl
-
-# $RCSfile: vanexp,v $$Revision: 4.1 $$Date: 92/08/07 17:20:53 $
-
-# This is for running from a find at night to expire old .deleteds
-
-$can = $ARGV[0];
-
-exit 1 unless $can =~ /.deleted$/;
-
-($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
- $blksize,$blocks) = stat($can);
-
-exit 0 unless $size;
-
-if (time - $mtime > 2 * 24 * 60 * 60) {
- `/bin/rm -rf $can`;
-}
-else {
- `find $can -ctime +2 -exec rm -f {} \;`;
-}
diff --git a/contrib/perl5/eg/van/vanish b/contrib/perl5/eg/van/vanish
deleted file mode 100644
index 09b9679..0000000
--- a/contrib/perl5/eg/van/vanish
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/perl
-
-# $RCSfile: vanish,v $$Revision: 4.1 $$Date: 92/08/07 17:20:54 $
-
-sub it {
- if ($olddir ne '.') {
- chop($pwd = `pwd`) if $pwd eq '';
- (chdir $olddir) || die "Directory $olddir is not accesible";
- }
- if (!-d .deleted) {
- print `mkdir .deleted; chmod 775 .deleted`;
- die "You can't remove files from $olddir" if $?;
- }
- $filelist =~ s/ $//;
- $filelist =~ s/#/\\#/g;
- if ($filelist !~ /^[ \t]*$/) {
- open(lastcmd,'>.deleted/.lastcmd');
- print lastcmd $filelist,"\n";
- close(lastcmd);
- print `/bin/mv $startfiles$filelist .deleted$force`;
- }
- if ($olddir ne '.') {
- (chdir $pwd) || die "Can't get back to original directory $pwd: $!\n";
- }
-}
-
-while ($ARGV[0] =~ /^-/) {
- $_ = shift;
- /^-f/ && ($force = ' >/dev/null 2>&1');
- /^-i/ && ($interactive = 1);
- if (/^-+$/) {
- $startfiles = '- ';
- last;
- }
-}
-
-chop($pwd = `pwd`);
-
-while ($file = shift) {
- if ($file =~ s|^(.*)/||) {
- $dir = $1;
- }
- else {
- $dir = '.';
- }
-
- if ($interactive) {
- print "vanish: remove $dir/$file? ";
- next unless <stdin> =~ /^y/i;
- }
-
- if ($file eq '.deleted') {
- print stderr "To delete .deleted (the trashcan) use the 'empty' command.\n";
- next;
- }
-
- if ($dir ne $olddir) {
- do it() if $olddir;
- $olddir = $dir;
- }
-
- $filelist .= $file; $filelist .= ' ';
-}
-
-do it() if $olddir;
OpenPOWER on IntegriCloud