From 0c293e4b81dcb6d6e12e6ab2c657985cb57ad42a Mon Sep 17 00:00:00 2001 From: TLINDEN Date: Fri, 10 Feb 2012 20:15:52 +0100 Subject: [PATCH] FIXED: there was a bug in the search expression, use now \Q and \E. ADDED: --config allows one to use another config than the default. --- Changelog | 6 ++++++ NOTEDB/binary.pm | 6 +++--- NOTEDB/dbm.pm | 4 ++-- NOTEDB/mysql.pm | 4 ++-- README | 4 ++-- bin/note | 31 +++++++++++++++++++++++++++---- 6 files changed, 42 insertions(+), 13 deletions(-) diff --git a/Changelog b/Changelog index f8fafa5..abc280d 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,11 @@ ================================================================================== +1.0.7: +FIXED: there was a bug in the search expression, use now \Q and \E. +ADDED: --config allows one to use another config than the default. + +================================================================================== + 1.0.6: FIXED: there were some odd bugs in commandline parsing, some options were unavailable. FIXED: Forgot "PreferredEditor" config-option in the new config format. diff --git a/NOTEDB/binary.pm b/NOTEDB/binary.pm index 8c43b0c..fac520b 100644 --- a/NOTEDB/binary.pm +++ b/NOTEDB/binary.pm @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: binary.pm,v 1.5 2000/04/26 22:57:38 thomas Exp thomas $ +# $Id: binary.pm,v 1.6 2000/06/25 19:48:00 scip Exp scip $ # Perl module for note # binary database backend. see docu: perldoc NOTEDB::binary # @@ -25,7 +25,7 @@ BEGIN { my ($NOTEDB, $sizeof, $typedef,$version); my ($cipher); -$version = "(NOTEDB::binary, 1.5)"; +$version = "(NOTEDB::binary, 1.6)"; sub new @@ -171,7 +171,7 @@ sub get_search ($num, $note, $date) = unpack($typedef, $buffer); $n = ude($note); $t = ude($date); - if($n =~ /$searchstring/i) + if($n =~ /\Q$searchstring\E/i) { $res{$num}->{'note'} = $n; $res{$num}->{'date'} = $t; diff --git a/NOTEDB/dbm.pm b/NOTEDB/dbm.pm index 6dbab20..cfdc0ba 100644 --- a/NOTEDB/dbm.pm +++ b/NOTEDB/dbm.pm @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: dbm.pm,v 1.1 2000/05/14 00:55:28 thomas Exp thomas $ +# $Id: dbm.pm,v 1.2 2000/06/25 19:51:11 scip Exp scip $ # Perl module for note # DBM database backend. see docu: perldoc NOTEDB::dbm # @@ -107,7 +107,7 @@ sub get_search my($num, $note, $date, %res); foreach $num (sort {$a <=> $b} keys %date) { - if (ude($note{$num}) =~ /$searchstring/i) { + if (ude($note{$num}) =~ /\Q$searchstring\E/i) { $res{$num}->{'note'} = ude($note{$num}); $res{$num}->{'date'} = ude($date{$num}); } diff --git a/NOTEDB/mysql.pm b/NOTEDB/mysql.pm index 4eb7ee3..9c47509 100644 --- a/NOTEDB/mysql.pm +++ b/NOTEDB/mysql.pm @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: mysql.pm,v 1.4 2000/04/26 22:57:50 thomas Exp thomas $ +# $Id: mysql.pm,v 1.5 2000/06/25 19:50:43 scip Exp scip $ # Perl module for note # mysql database backend. see docu: perldoc NOTEDB::binary # @@ -161,7 +161,7 @@ sub get_search foreach $num (sort { $a <=> $b } keys %res) { $note = ude($res{$num}->{'note'}); $date = ude($res{$num}->{'date'}); - if($note =~ /$searchstring/i) + if($note =~ /\Q$searchstring\E/i) { $res{$num}->{'note'} = $note; $res{$num}->{'date'} = $date; diff --git a/README b/README index d8884c2..06a62fb 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -note 1.0.6 by Thomas Linden, 18/05/2000 +note 1.0.7 by Thomas Linden, 27/06/2000 ======================================= Introduction @@ -514,4 +514,4 @@ Contributors / Credits Last changed ============ - 18/05/2000 + 27/06/2000 diff --git a/bin/note b/bin/note index 80c1ca3..1c2e56a 100755 --- a/bin/note +++ b/bin/note @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: note,v 1.27 2000/05/16 23:51:35 thomas Exp thomas $ +# $Id: note,v 1.29 2000/06/25 20:13:23 scip Exp scip $ # # # note - console notes management with database and encryption support. @@ -59,7 +59,7 @@ my ( # commandline options # $opt_, $opt_i, $opt_r, $opt_e, $opt_d, - $opt_s, $opt_t, $opt_T, $opt_l, $opt_L, + $opt_s, $opt_t, $opt_T, $opt_l, $opt_L, $opt_c, $opt_D, $opt_I, $opt_o, $opt_h, $opt_n, $opt_v, # @@ -126,7 +126,7 @@ $TIME_COLOR = "black"; $TOPIC_COLOR = "BLACK"; $TOPIC = 1; $TopicSep = '/'; -$version = "1.0.6"; +$version = "1.0.7"; if($TOPIC) { $CurDepth = 1; # the current depth inside the topic "directory" structure... @@ -154,6 +154,7 @@ else Getopt::Long::Configure( qw(no_ignore_case)); GetOptions ( "interactive|i!" => \$opt_i, # no arg + "config|c=s" => \$opt_c, # string, required "raw|r!" => \$opt_r, # no arg "edit|e=i" => \$opt_e, # integer, required "delete|d=s" => \$opt_d, # integer, required @@ -243,7 +244,15 @@ else &usage; } else { - $has_nothing = 1; + if($opt_c && $mode eq "" && !$opt_n) { + $mode = "new"; + } + elsif($opt_c && $mode eq "") { + $mode = ""; # huh?! + } + else { + $has_nothing = 1; + } } ### determine generic options if($opt_n =~ /^[\d+\-?\,*]+$/) { @@ -281,10 +290,16 @@ if($has_nothing && $mode eq "") # read the configfile. +$CONF = $opt_c if($opt_c); # if given by commandline, use this. if(-e $CONF) { &getconfig($CONF); } +elsif($opt_c) { + # only wrong, if specified by commandline! else use default values! + print STDERR "Could not open \"$CONF\": file does not exist or permission denied!\n"; + exit(1); +} # Always interactive? @@ -1062,6 +1077,7 @@ Usage: note [ options ] [ number [,number...]] Options: -h --help displays this help screen -v --version displays the version number +-c --config use another config file than the default \~/.noterc -l --list [] lists all existing notes If no topic were specified, it will display a list of all existing topics. -L --longlist [] the same as -l but prints also the timestamp @@ -1560,6 +1576,13 @@ sub getconfig __END__ # # $Log: note,v $ +# Revision 1.29 2000/06/25 20:13:23 scip +# *** empty log message *** +# +# Revision 1.28 2000/06/25 19:51:51 scip +# changed pattern matching of seraching(\@ ... \E) +# added --config option +# # Revision 1.27 2000/05/16 23:51:35 thomas # fixed many option-parsing related bugd! #