From 4c3431d98c5159cd30c6c7b70931fe6536b051a7 Mon Sep 17 00:00:00 2001 From: Ward Wouts Date: Fri, 28 Jan 2005 13:09:04 +0000 Subject: [PATCH] patch van Pieter geintegreerd --- mvwrap/mvwrap | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/mvwrap/mvwrap b/mvwrap/mvwrap index b25f01e..f1089b6 100755 --- a/mvwrap/mvwrap +++ b/mvwrap/mvwrap @@ -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)=(); + 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 invoke with this editor; ignored if -f or -p is given +-l reads list of new titles from a text file; ignored if -f or -p is given -p use a pattern to edit; ignored if -f is given -f use a pattern file to edit -v verbose; shows file moves