patch van Pieter geintegreerd
This commit is contained in:
parent
c1372b7ed3
commit
4c3431d98c
1 changed files with 16 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# $Dwarf: mvwrap,v 1.41 2002/12/18 12:14:02 ward Exp $
|
||||
# $Dwarf: mvwrap,v 1.42 2002/12/18 12:34:22 ward Exp $
|
||||
# $Source$
|
||||
|
||||
#
|
||||
|
|
@ -28,6 +28,9 @@ if (@pattern) {
|
|||
if ( &run_checks ) {
|
||||
die("Aborting\n");
|
||||
}
|
||||
} elsif ($opt_l) {
|
||||
@target=(&readlist($opt_l));
|
||||
if (&run_checks) { die "Aborting\n"; }
|
||||
} else {
|
||||
$temp_file = &open_temp;
|
||||
&edit($temp_file);
|
||||
|
|
@ -51,7 +54,6 @@ if (@unsafe = &check_safety(\@source, \@target)) {
|
|||
&move_files(\@source, \@target);
|
||||
&cleanup;
|
||||
|
||||
|
||||
########################################################
|
||||
# sub routines from here on...
|
||||
#
|
||||
|
|
@ -145,6 +147,16 @@ sub pattern_edit {
|
|||
}
|
||||
}
|
||||
|
||||
# reads list of new titles from a text file with -l
|
||||
sub readlist($) {
|
||||
my $file = shift;
|
||||
open(TITLES, $file) or die "could not read list file: $!\n";
|
||||
my (@titles)=(<TITLES>);
|
||||
close(TITLES);
|
||||
map (chomp($_),@titles);
|
||||
return @titles;
|
||||
}
|
||||
|
||||
sub run_checks {
|
||||
my $line;
|
||||
|
||||
|
|
@ -325,10 +337,9 @@ sub askyn($) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
# parse commandline
|
||||
sub cmdline {
|
||||
&GetOptions("e=s", "h", "p=s", \@pattern, "f=s", "v", "n");
|
||||
&GetOptions("e=s", "h", "p=s", \@pattern, "f=s", "v", "n", "l=s");
|
||||
|
||||
&help if $opt_h;
|
||||
if ($opt_f) { &read_pattern; }
|
||||
|
|
@ -355,6 +366,7 @@ $0 [options] [--] [files]
|
|||
At the moment it takes the following options:
|
||||
-h this help message
|
||||
-e <editor> invoke with this editor; ignored if -f or -p is given
|
||||
-l <file> reads list of new titles from a text file; ignored if -f or -p is given
|
||||
-p <pattern> use a pattern to edit; ignored if -f is given
|
||||
-f <file> use a pattern file to edit
|
||||
-v verbose; shows file moves
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue