[Fai-commit] r4996 - in trunk: bin man
lange at alioth.debian.org
lange at alioth.debian.org
Thu Jun 19 07:36:52 UTC 2008
Author: lange
Date: 2008-06-19 07:36:52 +0000 (Thu, 19 Jun 2008)
New Revision: 4996
Modified:
trunk/bin/ainsl
trunk/man/ainsl.1
Log:
add options -P and -p (closes: #484722)
Modified: trunk/bin/ainsl
===================================================================
--- trunk/bin/ainsl 2008-06-19 07:35:28 UTC (rev 4995)
+++ trunk/bin/ainsl 2008-06-19 07:36:52 UTC (rev 4996)
@@ -27,10 +27,10 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#*********************************************************************
-my $version = "Version 1.1.1, 4-may-2008";
+my $version = "Version 1.2, 18-june-2008";
use Getopt::Std;
-our ($opt_a,$opt_h,$opt_D,$opt_n,$opt_s,$opt_v);
+our ($opt_a,$opt_h,$opt_D,$opt_n,$opt_s,$opt_v,$opt_q,$opt_Q);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub usage {
@@ -42,12 +42,14 @@
Usage: ainsl [OPTION] FILE LINE [PATTERN]
- -a Autocreate file if not existing.
- -D Create debug output.
- -h Show summary of options.
- -n Print the actions, but do not execute them.
- -s Convert blanks in line to '\\s+' regexp
- -v Create verbose output.
+ -a Autocreate file if not existing.
+ -D Create debug output.
+ -h Show summary of options.
+ -n Print the actions, but do not execute them.
+ -Q Quote all metacharacters in pattern. Uses perl\'s \\Q function.
+ -q Quote * and + metacharacters in pattern.
+ -s Convert blanks in line to '\\s+' regexp.
+ -v Create verbose output.
Report bugs to <lange\@informatik.uni-koeln.de>.
EOF
@@ -63,7 +65,7 @@
close (FILE);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-getopts('aDhsvn') || usage;
+getopts('aDhsvnQq') || usage;
$opt_h && usage;
$verbose = $opt_v || $ENV{verbose} || 0;
@@ -94,6 +96,9 @@
$pattern =~s/\+/\\+/g;
}
$opt_s && $pattern=~ s/\s+/\\s+/g;
+$opt_q && $pattern=~ s/\*/\\*/g;
+$opt_q && $pattern=~ s/\+/\+/g;
+$pattern="\Q$pattern\E" if $opt_Q;
print "ainsl: newpattern: $pattern\n" if $debug;
print "ainsl: newline: $line\n" if $debug;
Modified: trunk/man/ainsl.1
===================================================================
--- trunk/man/ainsl.1 2008-06-19 07:35:28 UTC (rev 4995)
+++ trunk/man/ainsl.1 2008-06-19 07:36:52 UTC (rev 4996)
@@ -1,5 +1,5 @@
.\" Hey, EMACS: -*- nroff -*-
-.TH ainsl 1 "12 august 2007" "FAI 3.2"
+.TH ainsl 1 "18 june 2008" "FAI 3.2"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@@ -42,12 +42,17 @@
.BI "\-n "
Print the actions, but do not execute them.
.TP
+.BI "\-Q "
+Quote all metacharacters in pattern. Uses perl's \\Q function.
+.TP
+.BI "\-q "
+Quote * and + metacharacters in pattern.
+.TP
.BI "\-s "
Convert blanks in LINE or PATTERN to '\\s+' regexp for matching.
.TP
.B \-v
Create verbose output.
-
.SH EXAMPLES
.br
ainsl -v /etc/fstab '/dev/fd0 /floppy auto users,noauto 0 0'
More information about the Fai-commit
mailing list