FIXED: there was a bug in the search expression, use now \Q and \E.

ADDED:          --config <file> allows one to use another config than the default.
This commit is contained in:
TLINDEN
2012-02-10 20:15:52 +01:00
parent 7d308cde40
commit 0c293e4b81
6 changed files with 42 additions and 13 deletions

View File

@@ -1,5 +1,11 @@
================================================================================== ==================================================================================
1.0.7:
FIXED: there was a bug in the search expression, use now \Q and \E.
ADDED: --config <file> allows one to use another config than the default.
==================================================================================
1.0.6: 1.0.6:
FIXED: there were some odd bugs in commandline parsing, some options were unavailable. FIXED: there were some odd bugs in commandline parsing, some options were unavailable.
FIXED: Forgot "PreferredEditor" config-option in the new config format. FIXED: Forgot "PreferredEditor" config-option in the new config format.

View File

@@ -1,5 +1,5 @@
#!/usr/bin/perl #!/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 # Perl module for note
# binary database backend. see docu: perldoc NOTEDB::binary # binary database backend. see docu: perldoc NOTEDB::binary
# #
@@ -25,7 +25,7 @@ BEGIN {
my ($NOTEDB, $sizeof, $typedef,$version); my ($NOTEDB, $sizeof, $typedef,$version);
my ($cipher); my ($cipher);
$version = "(NOTEDB::binary, 1.5)"; $version = "(NOTEDB::binary, 1.6)";
sub new sub new
@@ -171,7 +171,7 @@ sub get_search
($num, $note, $date) = unpack($typedef, $buffer); ($num, $note, $date) = unpack($typedef, $buffer);
$n = ude($note); $n = ude($note);
$t = ude($date); $t = ude($date);
if($n =~ /$searchstring/i) if($n =~ /\Q$searchstring\E/i)
{ {
$res{$num}->{'note'} = $n; $res{$num}->{'note'} = $n;
$res{$num}->{'date'} = $t; $res{$num}->{'date'} = $t;

View File

@@ -1,5 +1,5 @@
#!/usr/bin/perl #!/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 # Perl module for note
# DBM database backend. see docu: perldoc NOTEDB::dbm # DBM database backend. see docu: perldoc NOTEDB::dbm
# #
@@ -107,7 +107,7 @@ sub get_search
my($num, $note, $date, %res); my($num, $note, $date, %res);
foreach $num (sort {$a <=> $b} keys %date) { 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}->{'note'} = ude($note{$num});
$res{$num}->{'date'} = ude($date{$num}); $res{$num}->{'date'} = ude($date{$num});
} }

View File

@@ -1,5 +1,5 @@
#!/usr/bin/perl #!/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 # Perl module for note
# mysql database backend. see docu: perldoc NOTEDB::binary # mysql database backend. see docu: perldoc NOTEDB::binary
# #
@@ -161,7 +161,7 @@ sub get_search
foreach $num (sort { $a <=> $b } keys %res) { foreach $num (sort { $a <=> $b } keys %res) {
$note = ude($res{$num}->{'note'}); $note = ude($res{$num}->{'note'});
$date = ude($res{$num}->{'date'}); $date = ude($res{$num}->{'date'});
if($note =~ /$searchstring/i) if($note =~ /\Q$searchstring\E/i)
{ {
$res{$num}->{'note'} = $note; $res{$num}->{'note'} = $note;
$res{$num}->{'date'} = $date; $res{$num}->{'date'} = $date;

4
README
View File

@@ -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 Introduction
@@ -514,4 +514,4 @@ Contributors / Credits
Last changed Last changed
============ ============
18/05/2000 27/06/2000

View File

@@ -1,5 +1,5 @@
#!/usr/bin/perl #!/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. # note - console notes management with database and encryption support.
@@ -59,7 +59,7 @@ my (
# commandline options # commandline options
# #
$opt_, $opt_i, $opt_r, $opt_e, $opt_d, $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, $opt_D, $opt_I, $opt_o, $opt_h, $opt_n, $opt_v,
# #
@@ -126,7 +126,7 @@ $TIME_COLOR = "black";
$TOPIC_COLOR = "BLACK"; $TOPIC_COLOR = "BLACK";
$TOPIC = 1; $TOPIC = 1;
$TopicSep = '/'; $TopicSep = '/';
$version = "1.0.6"; $version = "1.0.7";
if($TOPIC) if($TOPIC)
{ {
$CurDepth = 1; # the current depth inside the topic "directory" structure... $CurDepth = 1; # the current depth inside the topic "directory" structure...
@@ -154,6 +154,7 @@ else
Getopt::Long::Configure( qw(no_ignore_case)); Getopt::Long::Configure( qw(no_ignore_case));
GetOptions ( GetOptions (
"interactive|i!" => \$opt_i, # no arg "interactive|i!" => \$opt_i, # no arg
"config|c=s" => \$opt_c, # string, required
"raw|r!" => \$opt_r, # no arg "raw|r!" => \$opt_r, # no arg
"edit|e=i" => \$opt_e, # integer, required "edit|e=i" => \$opt_e, # integer, required
"delete|d=s" => \$opt_d, # integer, required "delete|d=s" => \$opt_d, # integer, required
@@ -243,7 +244,15 @@ else
&usage; &usage;
} }
else { 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 ### determine generic options
if($opt_n =~ /^[\d+\-?\,*]+$/) { if($opt_n =~ /^[\d+\-?\,*]+$/) {
@@ -281,10 +290,16 @@ if($has_nothing && $mode eq "")
# read the configfile. # read the configfile.
$CONF = $opt_c if($opt_c); # if given by commandline, use this.
if(-e $CONF) if(-e $CONF)
{ {
&getconfig($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? # Always interactive?
@@ -1062,6 +1077,7 @@ Usage: note [ options ] [ number [,number...]]
Options: Options:
-h --help displays this help screen -h --help displays this help screen
-v --version displays the version number -v --version displays the version number
-c --config <file> use another config file than the default \~/.noterc
-l --list [<topic>] lists all existing notes If no topic were specified, -l --list [<topic>] lists all existing notes If no topic were specified,
it will display a list of all existing topics. it will display a list of all existing topics.
-L --longlist [<topic>] the same as -l but prints also the timestamp -L --longlist [<topic>] the same as -l but prints also the timestamp
@@ -1560,6 +1576,13 @@ sub getconfig
__END__ __END__
# #
# $Log: note,v $ # $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 # Revision 1.27 2000/05/16 23:51:35 thomas
# fixed many option-parsing related bugd! # fixed many option-parsing related bugd!
# #