patch van Pieter geintegreerd

This commit is contained in:
Ward Wouts 2005-01-28 13:09:04 +00:00
parent c1372b7ed3
commit 4c3431d98c

View file

@ -1,6 +1,6 @@
#!/usr/bin/perl -w #!/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$ # $Source$
# #
@ -28,6 +28,9 @@ if (@pattern) {
if ( &run_checks ) { if ( &run_checks ) {
die("Aborting\n"); die("Aborting\n");
} }
} elsif ($opt_l) {
@target=(&readlist($opt_l));
if (&run_checks) { die "Aborting\n"; }
} else { } else {
$temp_file = &open_temp; $temp_file = &open_temp;
&edit($temp_file); &edit($temp_file);
@ -51,7 +54,6 @@ if (@unsafe = &check_safety(\@source, \@target)) {
&move_files(\@source, \@target); &move_files(\@source, \@target);
&cleanup; &cleanup;
######################################################## ########################################################
# sub routines from here on... # 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 { sub run_checks {
my $line; my $line;
@ -325,10 +337,9 @@ sub askyn($) {
} }
} }
# parse commandline # parse commandline
sub cmdline { 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; &help if $opt_h;
if ($opt_f) { &read_pattern; } if ($opt_f) { &read_pattern; }
@ -355,6 +366,7 @@ $0 [options] [--] [files]
At the moment it takes the following options: At the moment it takes the following options:
-h this help message -h this help message
-e <editor> invoke with this editor; ignored if -f or -p is given -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 -p <pattern> use a pattern to edit; ignored if -f is given
-f <file> use a pattern file to edit -f <file> use a pattern file to edit
-v verbose; shows file moves -v verbose; shows file moves