diff --git a/Changelog b/Changelog
index a684d51..99e8065 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,41 @@
================================================================================
+1.2.0:
+CHANGED: using Makemaker instead of self-written code in Makefile.PL
+ for installation. No more dependency checks built-in because
+ note runs out-of-the-box without additional modules, as a matter fact.
+ADDED: if a search matches exactly on one note it will be displayed
+ directly, which avoids typing.
+CHANGED: the main if-else contruct for calling the several subs has
+ been replaced by a simple closure call.
+CHANGED: notes will now displayed in a slightly simpler fashion in interactive
+ mode, without the separator line between the title and the note.
+ADDED: note can now determine automatically the width and height of
+ the terminal window it runs in (in interactive mode only) and
+ sets the width/height of what it prints accordingly. the config
+ variable "MaxLen" must be set to "auto" (which is the default
+ from now on) to get this to work.
+ADDED: any interactive command will now clear the screen before it does
+ anything. this look much more uncluttered.
+ADDED: if multiple notes are printed at once (i.e. note 1,2) then the
+ separator line between them will no more being printed because
+ every notes title is preceded by a line anyway.
+CHANGED: by default the default operation mode is now interactive mode,
+ which is somewhat kindlier to new users.
+CHANGED: changed to order which editor note tries to find. vi got now
+ higher precedence, because it is likely installed on almost
+ any unix system.
+CHANGED: cosmetics.
+NOTE: increased minor version number from 1 to 2 to indicate that
+ development begun after 2 1/2 years pause again :-)
+
+================================================================================
+
+1.1.2:
+FIXED: Empty notes will no longer stored.
+ADDED: A new config option which allows you to specify a time format
+ other than the default one which is used by note.
+
+================================================================================
1.1.1:
FIXED: Some odd typos in README and note.pod.
diff --git a/Makefile.PL b/Makefile.PL
index d680609..3d85b1b 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,113 +1,7 @@
-# does not use ExtUtils::MakeMaker, because
-# NOTEDB::mysql and NOTEDB::binary are internals
-# of note.
-#
-# $Id: Makefile.PL,v 1.2 2000/08/10 09:21:56 zarahg Exp $
-#
-# check for the existence of optional modules:
-sub chk_mod
-{
- my($mod, $msg) = @_;
- print "<====\tchecking $mod \t====>\n";
- eval {
- $mod .= ".pm";
- $mod =~ s/::/\//g;
- require $mod;
- };
- if($@) {
- print $msg;
- }
- else {
- print " ... installed.\n";
- }
- print "\n";
-}
+use ExtUtils::MakeMaker;
-&chk_mod(
- "Getopt::Long",
- "WARNING: Getopt::Long seems not to be installed on your system!\n"
- ."But it is strongly required in order to run note!\n"
- );
-
-&chk_mod(
- "DB_File",
- "WARNING: DB_File seems not to be installed on your system!\n"
- ."It is required, if you want to use the DBM backend.\n"
- );
-
-
-&chk_mod(
- "DBI",
- " WARNING: module DBI is not installed on your system.\n"
- ." It is required, if you want to use a SQL database with\n"
- ."note.\n"
- );
-
-&chk_mod(
- "Crypt::IDEA",
- " WARNING: module Crypt::IDEA is not installed on your system.\n"
- ." It is required, if you want to encrypt your data using IDEA.\n"
- );
-
-&chk_mod(
- "Crypt::DES",
- " WARNING: module Crypt::DES is not installed on your system.\n"
- ." It is required, if you want to encrypt your data using DES.\n"
- );
-
-&chk_mod(
- "Crypt::CBC",
- " WARNING: module Crypt::CBC is not installed on your system.\n"
- ." It is required, if you want to encrypt your data using CBC.\n"
- );
-
-&chk_mod(
- "MD5",
- " WARNING: module MD5 is not installed on your system.\n"
- ." It is required by Crypt::CBC.\n"
- );
-
-foreach $dir (@INC) {
- if($dir =~ /site_perl/)
- { $LIBDIR = $dir; last; }
-}
-print "directory, where to install libs [$LIBDIR]: ";
-$input = <>;
-chomp $input;
-$LIBDIR = $input if($input ne "");
-
-$BINDIR = "/usr/local/bin";
-print "directory, where to install note [$BINDIR]: ";
-$input = <>;
-chomp $input;
-$BINDIR = $input if($input ne "");
-
-$install = `which install`;
-
-open M, "> Makefile" || die $!;
-print M qq~BIN = bin/note
-MAN = note.1
-LIBS = NOTEDB/mysql.pm NOTEDB/binary.pm NOTEDB/dbm.pm
-CORE = NOTEDB.pm
-INSTBIN = $BINDIR
-INSTLIB = $LIBDIR
-INSTMAN = /usr/man/man1
-INSTALL = $install
-all:
- \@echo "done. Type make install.\\n"
-
-install:
- \$(INSTALL) -m 755 \$(CORE) \$(INSTLIB)
- \$(INSTALL) -d -m 755 \$(INSTLIB)/NOTEDB
- \$(INSTALL) -m 755 \$(LIBS) \$(INSTLIB)/NOTEDB
- \$(INSTALL) -m 755 \$(BIN) \$(INSTBIN)
- \$(INSTALL) -m 644 \$(MAN) \$(INSTMAN)
-~;
-
-print "Type \"make install\" to install all files.\n\n";
-print "Please note: You may also copy the file \"config/noterc\" to\n"
- ."your home: \"cp config/noterc ~/.noterc\". Don't forget to edit\n"
- ."your config-file. Read the README for more informations on this\n"
- ."topic.\n"
- ."Thanks for choosing \"note\"! You are helping to keep the \n"
- ."OpenSource idea alive! Enjoy and tell me, what you think!\n\n";
+WriteMakefile(
+ 'NAME' => 'NOTEDB',
+ 'VERSION_FROM' => 'NOTEDB.pm', # finds $VERSION
+ 'EXE_FILES' => [ 'bin/note' ],
+);
diff --git a/Makefile.old b/Makefile.old
new file mode 100644
index 0000000..258eed0
--- /dev/null
+++ b/Makefile.old
@@ -0,0 +1,732 @@
+# This Makefile is for the NOTEDB extension to perl.
+#
+# It was generated automatically by MakeMaker version
+# 6.03 (Revision: 1.63) from the contents of
+# Makefile.PL. Don't edit this file, edit Makefile.PL instead.
+#
+# ANY CHANGES MADE HERE WILL BE LOST!
+#
+# MakeMaker ARGV: ()
+#
+# MakeMaker Parameters:
+
+# EXE_FILES => [q[bin/note]]
+# NAME => q[NOTEDB]
+# VERSION_FROM => q[NOTEDB.pm]
+
+# --- MakeMaker post_initialize section:
+
+
+# --- MakeMaker const_config section:
+
+# These definitions are from config.sh (via /usr/lib/perl/5.8.0/Config.pm)
+
+# They may have been overridden via Makefile.PL or on the command line
+AR = ar
+CC = cc
+CCCDLFLAGS = -fPIC
+CCDLFLAGS = -rdynamic
+DLEXT = so
+DLSRC = dl_dlopen.xs
+LD = cc
+LDDLFLAGS = -shared -L/usr/local/lib
+LDFLAGS = -L/usr/local/lib
+LIBC = /lib/libc-2.3.1.so
+LIB_EXT = .a
+OBJ_EXT = .o
+OSNAME = linux
+OSVERS = 2.4.19
+RANLIB = :
+SO = so
+EXE_EXT =
+FULL_AR = /usr/bin/ar
+
+
+# --- MakeMaker constants section:
+AR_STATIC_ARGS = cr
+NAME = NOTEDB
+DISTNAME = NOTEDB
+NAME_SYM = NOTEDB
+VERSION = 1.3
+VERSION_SYM = 1_3
+XS_VERSION = 1.3
+INST_ARCHLIB = blib/arch
+INST_SCRIPT = blib/script
+INST_BIN = blib/bin
+INST_LIB = blib/lib
+INSTALLDIRS = site
+PREFIX = /usr
+SITEPREFIX = $(PREFIX)/local
+VENDORPREFIX = $(PREFIX)
+INSTALLPRIVLIB = $(PREFIX)/share/perl/5.8.0
+INSTALLSITELIB = $(SITEPREFIX)/share/perl/5.8.0
+INSTALLVENDORLIB = $(VENDORPREFIX)/share/perl5
+INSTALLARCHLIB = $(PREFIX)/lib/perl/5.8.0
+INSTALLSITEARCH = $(SITEPREFIX)/lib/perl/5.8.0
+INSTALLVENDORARCH = $(VENDORPREFIX)/lib/perl5
+INSTALLBIN = $(PREFIX)/bin
+INSTALLSITEBIN = $(SITEPREFIX)/bin
+INSTALLVENDORBIN = $(VENDORPREFIX)/bin
+INSTALLSCRIPT = $(PREFIX)/bin
+PERL_LIB = /usr/share/perl/5.8.0
+PERL_ARCHLIB = /usr/lib/perl/5.8.0
+SITELIBEXP = /usr/local/share/perl/5.8.0
+SITEARCHEXP = /usr/local/lib/perl/5.8.0
+LIBPERL_A = libperl.a
+FIRST_MAKEFILE = Makefile
+MAKE_APERL_FILE = Makefile.aperl
+PERLMAINCC = $(CC)
+PERL_INC = /usr/lib/perl/5.8.0/CORE
+PERL = /usr/bin/perl
+FULLPERL = /usr/bin/perl
+PERLRUN = $(PERL)
+FULLPERLRUN = $(FULLPERL)
+PERLRUNINST = $(PERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
+FULLPERLRUNINST = $(FULLPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
+ABSPERL = $(PERL)
+ABSPERLRUN = $(ABSPERL)
+ABSPERLRUNINST = $(ABSPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
+FULL_AR = /usr/bin/ar
+PERL_CORE = 0
+NOOP = $(SHELL) -c true
+NOECHO = @
+
+VERSION_MACRO = VERSION
+DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\"
+XS_VERSION_MACRO = XS_VERSION
+XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"
+PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc
+
+MAKEMAKER = /usr/share/perl/5.8.0/ExtUtils/MakeMaker.pm
+MM_VERSION = 6.03
+
+# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
+# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
+# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
+# DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
+FULLEXT = NOTEDB
+BASEEXT = NOTEDB
+PARENT_NAME =
+DLBASE = $(BASEEXT)
+VERSION_FROM = NOTEDB.pm
+OBJECT =
+LDFROM = $(OBJECT)
+LINKTYPE = dynamic
+
+# Handy lists of source code files:
+XS_FILES=
+C_FILES =
+O_FILES =
+H_FILES =
+MAN1PODS =
+MAN3PODS = NOTEDB/binary.pm \
+ NOTEDB/dbm.pm \
+ NOTEDB/mysql.pm \
+ note.pod
+INST_MAN1DIR = blib/man1
+MAN1EXT = 1p
+INSTALLMAN1DIR = $(PREFIX)/share/man/man1
+INSTALLSITEMAN1DIR = $(SITEPREFIX)/man/man1
+INSTALLVENDORMAN1DIR = $(VENDORPREFIX)/share/man/man1
+INST_MAN3DIR = blib/man3
+MAN3EXT = 3pm
+INSTALLMAN3DIR = $(PREFIX)/share/man/man3
+INSTALLSITEMAN3DIR = $(SITEPREFIX)/man/man3
+INSTALLVENDORMAN3DIR = $(VENDORPREFIX)/share/man/man3
+PERM_RW = 644
+PERM_RWX = 755
+
+# work around a famous dec-osf make(1) feature(?):
+makemakerdflt: all
+
+.SUFFIXES: .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT)
+
+# Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to recall, that
+# some make implementations will delete the Makefile when we rebuild it. Because
+# we call false(1) when we rebuild it. So make(1) is not completely wrong when it
+# does so. Our milage may vary.
+# .PRECIOUS: Makefile # seems to be not necessary anymore
+
+.PHONY: all config static dynamic test linkext manifest
+
+# Where is the Config information that we are using/depend on
+CONFIGDEP = $(PERL_ARCHLIB)/Config.pm $(PERL_INC)/config.h
+
+# Where to put things:
+INST_LIBDIR = $(INST_LIB)
+INST_ARCHLIBDIR = $(INST_ARCHLIB)
+
+INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT)
+INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT)
+
+INST_STATIC =
+INST_DYNAMIC =
+INST_BOOT =
+
+EXPORT_LIST =
+
+PERL_ARCHIVE =
+
+PERL_ARCHIVE_AFTER =
+
+TO_INST_PM = NOTEDB.pm \
+ NOTEDB/README \
+ NOTEDB/binary.pm \
+ NOTEDB/dbm.pm \
+ NOTEDB/mysql.pm \
+ note.pod
+
+PM_TO_BLIB = NOTEDB/mysql.pm \
+ blib/lib/NOTEDB/mysql.pm \
+ NOTEDB/dbm.pm \
+ blib/lib/NOTEDB/dbm.pm \
+ NOTEDB/README \
+ blib/lib/NOTEDB/README \
+ NOTEDB/binary.pm \
+ blib/lib/NOTEDB/binary.pm \
+ note.pod \
+ blib/lib/note.pod \
+ NOTEDB.pm \
+ blib/lib/NOTEDB.pm
+
+
+# --- MakeMaker tool_autosplit section:
+# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
+AUTOSPLITFILE = $(PERLRUN) -e 'use AutoSplit; autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;'
+
+
+
+# --- MakeMaker tool_xsubpp section:
+
+
+# --- MakeMaker tools_other section:
+
+SHELL = /bin/sh
+CHMOD = chmod
+CP = cp
+LD = cc
+MV = mv
+NOOP = $(SHELL) -c true
+RM_F = rm -f
+RM_RF = rm -rf
+TEST_F = test -f
+TOUCH = touch
+UMASK_NULL = umask 0
+DEV_NULL = > /dev/null 2>&1
+
+# The following is a portable way to say mkdir -p
+# To see which directories are created, change the if 0 to if 1
+MKPATH = $(PERLRUN) "-MExtUtils::Command" -e mkpath
+
+# This helps us to minimize the effect of the .exists files A yet
+# better solution would be to have a stable file in the perl
+# distribution with a timestamp of zero. But this solution doesn't
+# need any changes to the core distribution and works with older perls
+EQUALIZE_TIMESTAMP = $(PERLRUN) "-MExtUtils::Command" -e eqtime
+
+# Here we warn users that an old packlist file was found somewhere,
+# and that they should call some uninstall routine
+WARN_IF_OLD_PACKLIST = $(PERL) -we 'exit unless -f $$ARGV[0];' \
+-e 'print "WARNING: I have found an old package in\n";' \
+-e 'print "\t$$ARGV[0].\n";' \
+-e 'print "Please make sure the two installations are not conflicting\n";'
+
+UNINST=0
+VERBINST=0
+
+MOD_INSTALL = $(PERL) "-I$(INST_LIB)" "-I$(PERL_LIB)" "-MExtUtils::Install" \
+-e "install({@ARGV},'$(VERBINST)',0,'$(UNINST)');"
+
+DOC_INSTALL = $(PERL) -e '$$\="\n\n";' \
+-e 'print "=head2 ", scalar(localtime), ": C<", shift, ">", " L<", $$arg=shift, "|", $$arg, ">";' \
+-e 'print "=over 4";' \
+-e 'while (defined($$key = shift) and defined($$val = shift)){print "=item *";print "C<$$key: $$val>";}' \
+-e 'print "=back";'
+
+UNINSTALL = $(PERLRUN) "-MExtUtils::Install" \
+-e 'uninstall($$ARGV[0],1,1); print "\nUninstall is deprecated. Please check the";' \
+-e 'print " packlist above carefully.\n There may be errors. Remove the";' \
+-e 'print " appropriate files manually.\n Sorry for the inconveniences.\n"'
+
+
+# --- MakeMaker dist section:
+ZIPFLAGS = -r
+TO_UNIX = @$(NOOP)
+TAR = tar
+POSTOP = @$(NOOP)
+ZIP = zip
+DIST_DEFAULT = tardist
+CI = ci -u
+SHAR = shar
+COMPRESS = gzip --best
+DIST_CP = best
+PREOP = @$(NOOP)
+TARFLAGS = cvf
+DISTVNAME = $(DISTNAME)-$(VERSION)
+SUFFIX = .gz
+RCS_LABEL = rcs -Nv$(VERSION_SYM): -q
+
+
+# --- MakeMaker macro section:
+
+
+# --- MakeMaker depend section:
+
+
+# --- MakeMaker cflags section:
+
+
+# --- MakeMaker const_loadlibs section:
+
+
+# --- MakeMaker const_cccmd section:
+
+
+# --- MakeMaker post_constants section:
+
+
+# --- MakeMaker pasthru section:
+
+PASTHRU = LIB="$(LIB)"\
+ LIBPERL_A="$(LIBPERL_A)"\
+ LINKTYPE="$(LINKTYPE)"\
+ PREFIX="$(PREFIX)"\
+ OPTIMIZE="$(OPTIMIZE)"\
+ PASTHRU_DEFINE="$(PASTHRU_DEFINE)"\
+ PASTHRU_INC="$(PASTHRU_INC)"
+
+
+# --- MakeMaker c_o section:
+
+
+# --- MakeMaker xs_c section:
+
+
+# --- MakeMaker xs_o section:
+
+
+# --- MakeMaker top_targets section:
+
+all :: pure_all manifypods
+ @$(NOOP)
+
+pure_all :: config pm_to_blib subdirs linkext
+ @$(NOOP)
+
+subdirs :: $(MYEXTLIB)
+ @$(NOOP)
+
+config :: Makefile $(INST_LIBDIR)/.exists
+ @$(NOOP)
+
+config :: $(INST_ARCHAUTODIR)/.exists
+ @$(NOOP)
+
+config :: $(INST_AUTODIR)/.exists
+ @$(NOOP)
+
+$(INST_AUTODIR)/.exists :: /usr/lib/perl/5.8.0/CORE/perl.h
+ @$(MKPATH) $(INST_AUTODIR)
+ @$(EQUALIZE_TIMESTAMP) /usr/lib/perl/5.8.0/CORE/perl.h $(INST_AUTODIR)/.exists
+
+ -@$(CHMOD) $(PERM_RWX) $(INST_AUTODIR)
+
+$(INST_LIBDIR)/.exists :: /usr/lib/perl/5.8.0/CORE/perl.h
+ @$(MKPATH) $(INST_LIBDIR)
+ @$(EQUALIZE_TIMESTAMP) /usr/lib/perl/5.8.0/CORE/perl.h $(INST_LIBDIR)/.exists
+
+ -@$(CHMOD) $(PERM_RWX) $(INST_LIBDIR)
+
+$(INST_ARCHAUTODIR)/.exists :: /usr/lib/perl/5.8.0/CORE/perl.h
+ @$(MKPATH) $(INST_ARCHAUTODIR)
+ @$(EQUALIZE_TIMESTAMP) /usr/lib/perl/5.8.0/CORE/perl.h $(INST_ARCHAUTODIR)/.exists
+
+ -@$(CHMOD) $(PERM_RWX) $(INST_ARCHAUTODIR)
+
+config :: $(INST_MAN3DIR)/.exists
+ @$(NOOP)
+
+
+$(INST_MAN3DIR)/.exists :: /usr/lib/perl/5.8.0/CORE/perl.h
+ @$(MKPATH) $(INST_MAN3DIR)
+ @$(EQUALIZE_TIMESTAMP) /usr/lib/perl/5.8.0/CORE/perl.h $(INST_MAN3DIR)/.exists
+
+ -@$(CHMOD) $(PERM_RWX) $(INST_MAN3DIR)
+
+help:
+ perldoc ExtUtils::MakeMaker
+
+
+# --- MakeMaker linkext section:
+
+linkext :: $(LINKTYPE)
+ @$(NOOP)
+
+
+# --- MakeMaker dlsyms section:
+
+
+# --- MakeMaker dynamic section:
+
+## $(INST_PM) has been moved to the all: target.
+## It remains here for awhile to allow for old usage: "make dynamic"
+#dynamic :: Makefile $(INST_DYNAMIC) $(INST_BOOT) $(INST_PM)
+dynamic :: Makefile $(INST_DYNAMIC) $(INST_BOOT)
+ @$(NOOP)
+
+
+# --- MakeMaker dynamic_bs section:
+
+BOOTSTRAP =
+
+
+# --- MakeMaker dynamic_lib section:
+
+
+# --- MakeMaker static section:
+
+## $(INST_PM) has been moved to the all: target.
+## It remains here for awhile to allow for old usage: "make static"
+#static :: Makefile $(INST_STATIC) $(INST_PM)
+static :: Makefile $(INST_STATIC)
+ @$(NOOP)
+
+
+# --- MakeMaker static_lib section:
+
+
+# --- MakeMaker manifypods section:
+POD2MAN_EXE = /usr/bin/pod2man
+POD2MAN = $(PERL) -we '%m=@ARGV;for (keys %m){' \
+-e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "Makefile";' \
+-e 'print "Manifying $$m{$$_}\n";' \
+-e 'system(q[$(PERLRUN) $(POD2MAN_EXE) ].qq[$$_>$$m{$$_}])==0 or warn "Couldn\047t install $$m{$$_}\n";' \
+-e 'chmod(oct($(PERM_RW)), $$m{$$_}) or warn "chmod $(PERM_RW) $$m{$$_}: $$!\n";}'
+
+manifypods : pure_all NOTEDB/mysql.pm \
+ NOTEDB/dbm.pm \
+ NOTEDB/binary.pm \
+ note.pod
+ @$(POD2MAN) \
+ NOTEDB/mysql.pm \
+ $(INST_MAN3DIR)/NOTEDB::mysql.$(MAN3EXT) \
+ NOTEDB/dbm.pm \
+ $(INST_MAN3DIR)/NOTEDB::dbm.$(MAN3EXT) \
+ NOTEDB/binary.pm \
+ $(INST_MAN3DIR)/NOTEDB::binary.$(MAN3EXT) \
+ note.pod \
+ $(INST_MAN3DIR)/note.$(MAN3EXT)
+
+# --- MakeMaker processPL section:
+
+
+# --- MakeMaker installbin section:
+
+$(INST_SCRIPT)/.exists :: /usr/lib/perl/5.8.0/CORE/perl.h
+ @$(MKPATH) $(INST_SCRIPT)
+ @$(EQUALIZE_TIMESTAMP) /usr/lib/perl/5.8.0/CORE/perl.h $(INST_SCRIPT)/.exists
+
+ -@$(CHMOD) $(PERM_RWX) $(INST_SCRIPT)
+
+EXE_FILES = bin/note
+
+FIXIN = $(PERLRUN) "-MExtUtils::MY" \
+ -e "MY->fixin(shift)"
+
+pure_all :: $(INST_SCRIPT)/note
+ @$(NOOP)
+
+realclean ::
+ rm -f $(INST_SCRIPT)/note
+
+$(INST_SCRIPT)/note: bin/note Makefile $(INST_SCRIPT)/.exists
+ @rm -f $(INST_SCRIPT)/note
+ cp bin/note $(INST_SCRIPT)/note
+ $(FIXIN) $(INST_SCRIPT)/note
+ -@$(CHMOD) $(PERM_RWX) $(INST_SCRIPT)/note
+
+
+# --- MakeMaker subdirs section:
+
+# none
+
+# --- MakeMaker clean section:
+
+# Delete temporary files but do not touch installed files. We don't delete
+# the Makefile here so a later make realclean still has a makefile to use.
+
+clean ::
+ -rm -rf ./blib $(MAKE_APERL_FILE) $(INST_ARCHAUTODIR)/extralibs.all perlmain.c tmon.out mon.out so_locations pm_to_blib *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT) $(BOOTSTRAP) $(BASEEXT).bso $(BASEEXT).def lib$(BASEEXT).def $(BASEEXT).exp $(BASEEXT).x core core.*perl.*.? *perl.core
+ -mv Makefile Makefile.old $(DEV_NULL)
+
+
+# --- MakeMaker realclean section:
+
+# Delete temporary files (via clean) and also delete installed files
+realclean purge :: clean
+ rm -rf $(INST_AUTODIR) $(INST_ARCHAUTODIR)
+ rm -rf $(DISTVNAME)
+ rm -f blib/lib/NOTEDB/mysql.pm blib/lib/NOTEDB/dbm.pm blib/lib/NOTEDB/README
+ rm -f blib/lib/NOTEDB/binary.pm blib/lib/note.pod blib/lib/NOTEDB.pm
+ rm -rf Makefile Makefile.old
+
+
+# --- MakeMaker dist_basics section:
+distclean :: realclean distcheck
+ $(NOECHO) $(NOOP)
+
+distcheck :
+ $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck
+
+skipcheck :
+ $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck
+
+manifest :
+ $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest
+
+veryclean : realclean
+ $(RM_F) *~ *.orig */*~ */*.orig
+
+
+
+# --- MakeMaker dist_core section:
+
+dist : $(DIST_DEFAULT)
+ @$(PERL) -le 'print "Warning: Makefile possibly out of date with $$vf" if ' \
+ -e '-e ($$vf="$(VERSION_FROM)") and -M $$vf < -M "Makefile";'
+
+tardist : $(DISTVNAME).tar$(SUFFIX)
+
+zipdist : $(DISTVNAME).zip
+
+$(DISTVNAME).tar$(SUFFIX) : distdir
+ $(PREOP)
+ $(TO_UNIX)
+ $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
+ $(RM_RF) $(DISTVNAME)
+ $(COMPRESS) $(DISTVNAME).tar
+ $(POSTOP)
+
+$(DISTVNAME).zip : distdir
+ $(PREOP)
+ $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
+ $(RM_RF) $(DISTVNAME)
+ $(POSTOP)
+
+uutardist : $(DISTVNAME).tar$(SUFFIX)
+ uuencode $(DISTVNAME).tar$(SUFFIX) \
+ $(DISTVNAME).tar$(SUFFIX) > \
+ $(DISTVNAME).tar$(SUFFIX)_uu
+
+shdist : distdir
+ $(PREOP)
+ $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
+ $(RM_RF) $(DISTVNAME)
+ $(POSTOP)
+
+
+# --- MakeMaker dist_dir section:
+distdir :
+ $(RM_RF) $(DISTVNAME)
+ $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
+ -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
+
+
+
+# --- MakeMaker dist_test section:
+
+disttest : distdir
+ cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL
+ cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
+ cd $(DISTVNAME) && $(MAKE) test $(PASTHRU)
+
+
+# --- MakeMaker dist_ci section:
+
+ci :
+ $(PERLRUN) "-MExtUtils::Manifest=maniread" \
+ -e "@all = keys %{ maniread() };" \
+ -e 'print("Executing $(CI) @all\n"); system("$(CI) @all");' \
+ -e 'print("Executing $(RCS_LABEL) ...\n"); system("$(RCS_LABEL) @all");'
+
+
+# --- MakeMaker install section:
+
+install :: all pure_install doc_install
+
+install_perl :: all pure_perl_install doc_perl_install
+
+install_site :: all pure_site_install doc_site_install
+
+install_vendor :: all pure_vendor_install doc_vendor_install
+
+pure_install :: pure_$(INSTALLDIRS)_install
+
+doc_install :: doc_$(INSTALLDIRS)_install
+
+pure__install : pure_site_install
+ @echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
+
+doc__install : doc_site_install
+ @echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
+
+pure_perl_install ::
+ @umask 022; $(MOD_INSTALL) \
+ read $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist \
+ write $(INSTALLARCHLIB)/auto/$(FULLEXT)/.packlist \
+ $(INST_LIB) $(INSTALLPRIVLIB) \
+ $(INST_ARCHLIB) $(INSTALLARCHLIB) \
+ $(INST_BIN) $(INSTALLBIN) \
+ $(INST_SCRIPT) $(INSTALLSCRIPT) \
+ $(INST_MAN1DIR) $(INSTALLMAN1DIR) \
+ $(INST_MAN3DIR) $(INSTALLMAN3DIR)
+ @$(WARN_IF_OLD_PACKLIST) \
+ $(SITEARCHEXP)/auto/$(FULLEXT)
+
+
+pure_site_install ::
+ @umask 02; $(MOD_INSTALL) \
+ read $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist \
+ write $(INSTALLSITEARCH)/auto/$(FULLEXT)/.packlist \
+ $(INST_LIB) $(INSTALLSITELIB) \
+ $(INST_ARCHLIB) $(INSTALLSITEARCH) \
+ $(INST_BIN) $(INSTALLSITEBIN) \
+ $(INST_SCRIPT) $(INSTALLSCRIPT) \
+ $(INST_MAN1DIR) $(INSTALLSITEMAN1DIR) \
+ $(INST_MAN3DIR) $(INSTALLSITEMAN3DIR)
+ @$(WARN_IF_OLD_PACKLIST) \
+ $(PERL_ARCHLIB)/auto/$(FULLEXT)
+
+pure_vendor_install ::
+ @umask 022; $(MOD_INSTALL) \
+ $(INST_LIB) $(INSTALLVENDORLIB) \
+ $(INST_ARCHLIB) $(INSTALLVENDORARCH) \
+ $(INST_BIN) $(INSTALLVENDORBIN) \
+ $(INST_SCRIPT) $(INSTALLSCRIPT) \
+ $(INST_MAN1DIR) $(INSTALLVENDORMAN1DIR) \
+ $(INST_MAN3DIR) $(INSTALLVENDORMAN3DIR)
+
+doc_perl_install ::
+ @echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
+ -@umask 022; $(MKPATH) $(INSTALLARCHLIB)
+ -@umask 022; $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLPRIVLIB)" \
+ LINKTYPE "$(LINKTYPE)" \
+ VERSION "$(VERSION)" \
+ EXE_FILES "$(EXE_FILES)" \
+ >> $(INSTALLARCHLIB)/perllocal.pod
+
+doc_site_install ::
+ @echo Appending installation info to $(INSTALLSITEARCH)/perllocal.pod
+ -@umask 02; $(MKPATH) $(INSTALLSITEARCH)
+ -@umask 02; $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLSITELIB)" \
+ LINKTYPE "$(LINKTYPE)" \
+ VERSION "$(VERSION)" \
+ EXE_FILES "$(EXE_FILES)" \
+ >> $(INSTALLSITEARCH)/perllocal.pod
+
+doc_vendor_install ::
+
+
+uninstall :: uninstall_from_$(INSTALLDIRS)dirs
+
+uninstall_from_perldirs ::
+ @$(UNINSTALL) $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist
+
+uninstall_from_sitedirs ::
+ @$(UNINSTALL) $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist
+
+
+# --- MakeMaker force section:
+# Phony target to force checking subdirectories.
+FORCE:
+ @$(NOOP)
+
+
+# --- MakeMaker perldepend section:
+
+
+# --- MakeMaker makefile section:
+
+# We take a very conservative approach here, but it\'s worth it.
+# We move Makefile to Makefile.old here to avoid gnu make looping.
+Makefile : Makefile.PL $(CONFIGDEP)
+ @echo "Makefile out-of-date with respect to $?"
+ @echo "Cleaning current config before rebuilding Makefile..."
+ -@$(RM_F) Makefile.old
+ -@$(MV) Makefile Makefile.old
+ -$(MAKE) -f Makefile.old clean $(DEV_NULL) || $(NOOP)
+ $(PERLRUN) Makefile.PL
+ @echo "==> Your Makefile has been rebuilt. <=="
+ @echo "==> Please rerun the make command. <=="
+ false
+
+
+
+# --- MakeMaker staticmake section:
+
+# --- MakeMaker makeaperl section ---
+MAP_TARGET = perl
+FULLPERL = /usr/bin/perl
+
+$(MAP_TARGET) :: static $(MAKE_APERL_FILE)
+ $(MAKE) -f $(MAKE_APERL_FILE) $@
+
+$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
+ @echo Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
+ @$(PERLRUNINST) \
+ Makefile.PL DIR= \
+ MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
+ MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=
+
+
+# --- MakeMaker test section:
+
+TEST_VERBOSE=0
+TEST_TYPE=test_$(LINKTYPE)
+TEST_FILE = test.pl
+TEST_FILES =
+TESTDB_SW = -d
+
+testdb :: testdb_$(LINKTYPE)
+
+test :: $(TEST_TYPE)
+ @echo 'No tests defined for $(NAME) extension.'
+
+test_dynamic :: pure_all
+
+testdb_dynamic :: pure_all
+ PERL_DL_NONLAZY=1 $(FULLPERLRUN) $(TESTDB_SW) "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE)
+
+test_ : test_dynamic
+
+test_static :: test_dynamic
+testdb_static :: testdb_dynamic
+
+
+# --- MakeMaker ppd section:
+# Creates a PPD (Perl Package Description) for a binary distribution.
+ppd:
+ @$(PERL) -e "print qq{\n\t$(DISTNAME)\n\t\n\t\n}" > $(DISTNAME).ppd
+ @$(PERL) -e "print qq{\t\n}" >> $(DISTNAME).ppd
+ @$(PERL) -e "print qq{\t\t\n\t\t\n\t\t\n\t\n\n}" >> $(DISTNAME).ppd
+
+# --- MakeMaker pm_to_blib section:
+
+pm_to_blib: $(TO_INST_PM)
+ @$(PERLRUNINST) "-MExtUtils::Install" \
+ -e "pm_to_blib({qw{NOTEDB/README blib/lib/NOTEDB/README NOTEDB/dbm.pm blib/lib/NOTEDB/dbm.pm NOTEDB/mysql.pm blib/lib/NOTEDB/mysql.pm NOTEDB/binary.pm blib/lib/NOTEDB/binary.pm NOTEDB.pm blib/lib/NOTEDB.pm}},'$(INST_LIB)/auto','$(PM_FILTER)')"
+ @$(PERLRUNINST) "-MExtUtils::Install" \
+ -e "pm_to_blib({qw{note.pod blib/lib/note.pod}},'$(INST_LIB)/auto','$(PM_FILTER)')"
+ @$(TOUCH) $@
+
+# --- MakeMaker selfdocument section:
+
+
+# --- MakeMaker postamble section:
+
+
+# End.
diff --git a/NOTEDB.pm b/NOTEDB.pm
index 17a2111..a8edd33 100644
--- a/NOTEDB.pm
+++ b/NOTEDB.pm
@@ -2,13 +2,13 @@
# this is a generic module, used by note database
# backend modules.
#
-# $Id: NOTEDB.pm,v 1.2 2000/08/11 00:05:58 zarahg Exp $
-#
-# Copyright (c) 2000 Thomas Linden
+# Copyright (c) 2000-2003 Thomas Linden
package NOTEDB;
+$NOTEDB::VERSION = "1.3";
+
BEGIN {
# make sure, it works, otherwise encryption
# is not supported on this system!
diff --git a/README b/README
index b4e47b9..7fc8b7b 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-note 1.1.1 by Thomas Linden, 20/08/2000
+note 1.2.0 by Thomas Linden, 28/02/2003
=======================================
Introduction
@@ -28,9 +28,7 @@ Where to get?
=============
By now at
- http://www.daemon.de/software.html
- or
- ftp://www.0c49.org/pub/scip/note/
+ http://www.daemon.de/note/
You may also try your nearest tucows mirror.
@@ -362,7 +360,7 @@ Cache
A "%" character at the top left of the screen indicates that
the cache is in use.
I consider you not to use the cache feature if you are using
- multiple instances of note using the same database.
+ multiple instances of note accessing the same database.
The cache is turned off by default.
@@ -396,7 +394,7 @@ Scripting
Another thingy you might find useful is the -r (--raw) command-line
flag. This turns note into raw mode , which means it will only print the
data without any formatting. Raw mode is available for list and display,
- since it makes no sense, interactive mode doe not support raw mode.
+ since it makes no sense, interactive mode does not support raw mode.
@@ -539,6 +537,7 @@ Security
This means an attacker could access your (unencrypted!) notes.
+
Comments
========
@@ -564,7 +563,7 @@ Recources
The command-line options and all commands of the interactive mode are
described in the supplied note(1) manpage.
- You may also refer to the note website http://www.0x49.org.
+ You may also refer to the note website http://www.daemon.de/note/.
@@ -582,7 +581,7 @@ Author and Copyright
Contributors / Credits
======================
- Shouts to those guys who helped me to enhance note: THANKS A LOT!
+ Shouts to all those guys who helped me to enhance note: THANKS A LOT!
Jens Heunemann - sub tree.
Peter Palmreuther - various additions.
@@ -596,4 +595,4 @@ Contributors / Credits
Last changed
============
- 20/08/2000
+ 28/02/2003
diff --git a/VERSION b/VERSION
index 524cb55..26aaba0 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.1
+1.2.0
diff --git a/bin/note b/bin/note
index 75704cc..2a8bb10 100755
--- a/bin/note
+++ b/bin/note
@@ -1,9 +1,7 @@
#!/usr/bin/perl
-# $Id: note,v 1.10 2000/08/19 13:38:33 zarahg Exp $
-#
#
# note - console notes management with database and encryption support.
-# Copyright (C) 1999-2000 Thomas Linden (see README for details!)
+# Copyright (C) 1999-2003 Thomas Linden (see README for details!)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -22,33 +20,33 @@
# - Thomas Linden
#
# latest version on:
-# http://www.daemon.de/software.html
-# ftp://www.0x49.org/pub/scip/note/
+# http://www.daemon.de/note/
#
use strict;
+no strict 'refs';
use Data::Dumper;
use Getopt::Long;
#
# prototypes
#
-sub usage; # print usage message for us thumb userz :-)
-sub find_editor; # returns an external editor for use
-sub output; # used by &list and &display
-sub C; # print colourized
-sub num_bereich; # returns array from "1-4" (1,2,3,4)
-sub getdate; # return pretty formatted day
-sub new; # crate new note
-sub edit; # edit a note
-sub del; # delete a note
-sub display; # display one or more notes
-sub list; # note-listing
-sub help; # interactive help screen
-sub import; # import from notedb-dump
-sub display_tree; # show nice tree-view
-sub tree; # build the tree
-sub print_tree; # print the tree, contributed by Jens Heunemann . THX!
+sub usage; # print usage message for us thumb userz :-)
+sub find_editor; # returns an external editor for use
+sub output; # used by &list and &display
+sub C; # print colourized
+sub num_bereich; # returns array from "1-4" (1,2,3,4)
+sub getdate; # return pretty formatted day
+sub new; # crate new note
+sub edit; # edit a note
+sub del; # delete a note
+sub display; # display one or more notes
+sub list; # note-listing
+sub help; # interactive help screen
+sub import; # import from notedb-dump
+sub display_tree; # show nice tree-view
+sub tree; # build the tree
+sub print_tree; # print the tree, contributed by Jens Heunemann . THX!
#
@@ -97,17 +95,18 @@ my (
# internals
#
$TYPE, $mode, $NoteKey, $TempDir, %Color, @LastTopic,
- $version, $CurTopic, $CurDepth, $WantTopic,
+ $version, $CurTopic, $CurDepth, $WantTopic,$time_format,
$sizeof, %TP, $TreeType, $ListType, $SetTitle,
@ArgTopics, $key, $typedef, @NumBlock, $has_nothing,
);
#
-# DEFAULTS, allows one to use note without a config
+# DEFAULTS, allows one to use note without a config
# don't change them, instead use the config file!
#
-$maxlen = 30;
+$maxlen = 50;
+my $keepmaxlen = "auto";
$timelen = 22;
$date = &getdate;
$USER = getlogin || getpwuid($<);
@@ -127,7 +126,7 @@ $TIME_COLOR = "blue";
$TOPIC_COLOR = "bold";
$TOPIC = 1;
$TopicSep = '/';
-$version = "1.1.1";
+$version = "1.2.0";
if ($TOPIC) {
$CurDepth = 1; # the current depth inside the topic "directory" structure...
}
@@ -138,6 +137,7 @@ $table = "note";
$fnote = "note";
$fdate = "date";
$fnum = "number";
+$ALWAYS_INT = "YES";
# colors available
# \033[1m%30s\033[0m
@@ -365,7 +365,7 @@ if ($DEFAULT_LIST eq "LONG") {
# *if* loading of the config was successful, try to load the
-# configured database backend. Currently supported:
+# configured database backend. Currently supported:
# mysql, dbm and binary.
unshift @INC, $libpath;
@@ -373,14 +373,14 @@ if ($dbdriver eq "binary") {
eval {
require NOTEDB::binary;
$db = new NOTEDB($dbdriver, $NOTEDB, $MAX_NOTE, $MAX_TIME, $dbdriver);
- }
+ };
}
elsif ($dbdriver eq "mysql") {
# do the new() later because of the encrypted password!
eval {
require "NOTEDB/mysql.pm";
};
- die $@ if($@);
+ die "mysql backend unsupported: $@\n" if($@);
}
else {
eval {
@@ -389,9 +389,7 @@ else {
};
}
if ($@) {
- print "Unsupported database backend: NOTEDB::$dbdriver!\n";
- print "The following error has occured:\n------------------------\n" . $@ . "\n------------------------\n";
- exit 1;
+ die "$dbdriver backend unsupported: $@\n";
}
@@ -487,45 +485,23 @@ $version .= " " . $db->version();
# main loop: ###############
-if ($mode eq "display") {
- &display;
-}
-elsif ($mode eq "search") {
- &search;
-}
-elsif ($mode eq "list") {
- &list;
-}
-elsif ($mode eq "tree") {
- &display_tree;
-}
-elsif ($mode eq "new") {
- &new;
-}
-elsif ($mode eq "delete") {
- del;
-}
-elsif ($mode eq "edit") {
- &edit;
-}
-elsif ($mode eq "dump") {
- &dump;
-}
-elsif ($mode eq "import") {
- &import;
-}
-elsif ($mode eq "interactive") {
- &interactive;
-}
-else {
- #undefined :-(
-}
-
-
+&$mode;
exit(0);
################## EOP ################
+
+
+
+
+
+
+
+
+
+
+
+
############ encrypt a given password ##############
sub encrypt_passwd {
my($key, $crypt_string);
@@ -559,12 +535,12 @@ sub encrypt_passwd {
############################### DISPLAY ##################################
-sub display
- {
+sub display {
my($N,$match,$note,$date,$num);
# display a certain note
print "\n";
&num_bereich; # get @NumBlock from $numer
+ my $count = scalar @NumBlock;
foreach $N (@NumBlock) {
($note, $date) = $db->get_single($N);
if ($note) {
@@ -572,11 +548,12 @@ sub display
print "$N\n$date\n$note\n\n";
}
else {
- output($N, $note, $date, "SINGLE");
+ output($N, $note, $date, "SINGLE", $count);
print "\n";
}
$match = 1;
}
+ $count--;
}
if (!$match) {
print "no note with that number found!\n";
@@ -584,8 +561,7 @@ sub display
}
############################### SEARCH ##################################
-sub search
- {
+sub search {
my($n,$match,$note,$date,$num,%res);
if ($searchstring eq "") {
print "No searchstring specified!\n";
@@ -594,9 +570,14 @@ sub search
print "searching the database $dbname for \"$searchstring\"...\n\n";
%res = $db->get_search($searchstring);
-
+ my $nummatches = scalar keys %res;
foreach $num (sort { $a <=> $b } keys %res) {
- output($num, $res{$num}->{'note'}, $res{$num}->{'date'}, "search");
+ if ($nummatches == 1) {
+ output($num, $res{$num}->{'note'}, $res{$num}->{'date'}, "SINGLE");
+ }
+ else {
+ output($num, $res{$num}->{'note'}, $res{$num}->{'date'}, "search");
+ }
$match = 1;
}
if (!$match) {
@@ -681,7 +662,6 @@ sub list {
}
else {
# it is an empty topic, no notes here
- # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$PATH = join $TopicSep, @LastTopic;
$PATH .= $TopicSep . $CurTopic . $TopicSep;
$PATH =~ s/^\Q$TopicSep$TopicSep\E/$TopicSep/;
@@ -707,8 +687,7 @@ sub list {
}
############################### NEW ##################################
-sub new
- {
+sub new {
my($TEMP,$editor, $date, $note, $WARN, $c, $line, $num, @topic);
$date = &getdate;
if ($ALWAYS_EDIT eq "YES") {
@@ -717,7 +696,7 @@ sub new
$editor = &find_editor;
if ($editor) {
# create the temp file
- open NEW, "> $TEMP" or die $!;
+ open NEW, "> $TEMP" or die "Could not write $TEMP: $!\n";
close NEW;
system "chattr", "+s", $TEMP; # ignore errors, since only on ext2 supported!
system $editor, $TEMP;
@@ -754,7 +733,7 @@ sub new
}
}
else {
- print "enter the text of the note, end with .\n";
+ print "enter the text of the note, end with a single .\n";
do
{
$line = ;
@@ -765,8 +744,12 @@ sub new
chop $note;
}
}
-
- # since we have not number, look for the next available:
+ # look if the note was empty, so don't store it!
+ if ($note =~ /^\s*$/) {
+ print "...your note was empty and will not be saved.\n";
+ return;
+ }
+ # since we have not a number, look for the next one available:
$number = $db->get_nextnum();
if ($TOPIC && $CurTopic ne "") {
@topic = split(/$TopicSep/,$note);
@@ -774,18 +757,14 @@ sub new
$note = $PATH . "\n$note";
}
}
-
-
$db->set_new($number,$note,$date);
-
# everything ok until here!
print "note stored. it has been assigned the number $number.\n\n";
}
############################### DELETE ##################################
-sub del
- {
+sub del {
my($i,@count, $setnum, $pos, $ERR);
# delete a note
&num_bereich; # get @NumBlock from $number
@@ -805,8 +784,7 @@ sub del
}
############################### EDIT ##################################
-sub edit
- {
+sub edit {
my($keeptime, $date, $editor, $TEMP, $note, $t, $num, $match);
# edit a note
$date = &getdate;
@@ -825,8 +803,9 @@ sub edit
close NOTE;
select STDOUT;
$editor = &find_editor;
+
if ($editor) {
- system $editor, $TEMP;
+ system ($editor, $TEMP) and die "Could not execute $editor: $!\n";
}
else {
print "Could not find an editor to use!\n";
@@ -856,8 +835,7 @@ sub edit
}
-sub dump
- {
+sub dump {
my(%res, $num, $DUMP);
# $dump_file
if ($dump_file eq "-") {
@@ -880,8 +858,7 @@ sub dump
select STDOUT;
}
-sub import
- {
+sub import {
my($num, $start, $complete, $dummi, $note, $date, $time, $number, $stdin, $DUMP);
# open $dump_file and import it into the notedb
$stdin = 1 if($dump_file eq "-");
@@ -931,10 +908,39 @@ sub import
}
}
+sub determine_width {
+ # determine terminal wide, if possible
+ if ($keepmaxlen eq "auto") {
+ eval {
+ my $wide = `stty -a`;
+ if ($wide =~ /columns (\d+?);/) {
+ $maxlen = $1 - 33; # (33 = timestamp + borders)
+ }
+ else {
+ # stty didn't work
+ $maxlen = 80 - 33;
+ }
+ };
+ }
+}
+sub clear {
+ # first, try to determine the terminal height
+ my $hoch;
+ eval {
+ my $height = `stty -a`;
+ if ($height =~ /rows (\d+?);/) {
+ $hoch = $1;
+ }
+ };
+ if (!$hoch) {
+ # stty didn't work
+ $hoch = 25;
+ }
+ print "\n" x $hoch;
+}
-sub interactive
- {
+sub interactive {
my($B, $BB, $menu, $char, $Channel);
$Channel = $|;
# create menu:
@@ -952,6 +958,7 @@ sub interactive
. $B . "Q" . $BB . "-Quit] "; # $CurTopic will be empty if $TOPIC is off!
# per default let's list all the stuff:
# Initially do a list command!
+ &determine_width;
$ListType = ($DEFAULT_LIST eq "LONG") ? "LONG" : "";
&list;
@@ -966,8 +973,10 @@ sub interactive
}
# endless until user press "Q" or "q"!
$char = ;
- #$char = $term->readline('');
chomp $char;
+ &determine_width;
+ &clear;
+
if ($char =~ /^\d+\s*[\di*?,*?\-*?]*$/) {
$ListType = ""; #overrun
# display notes
@@ -1132,7 +1141,7 @@ Read the note(1) manpage for more details.
}
sub find_editor {
- return $PreferredEditor || $ENV{"VISUAL"} || $ENV{"EDITOR"} || "vim" || "vi" || "pico";
+ return $PreferredEditor || $ENV{"VISUAL"} || $ENV{"EDITOR"} || "vi" || "vim" || "pico";
}
#/
@@ -1158,11 +1167,11 @@ sub format {
$note;
}
-sub output
- {
+sub output {
my($SSS, $LINE, $num, $note, $time, $TYPE, $L, $LONGSPC, $R, $PathLen, $SP, $title, $CUTSPACE,
- $len, $diff, $Space, $nlen, $txtlen);
- ($num, $note, $time, $TYPE) = @_;
+ $len, $diff, $Space, $nlen, $txtlen, $count);
+ ($num, $note, $time, $TYPE, $count) = @_;
+
$txtlen = ($ListType eq "LONG") ? $maxlen : $timelen + $maxlen;
$note = &format($note);
@@ -1178,8 +1187,8 @@ sub output
$SP = "";
# print only if it is the first line!
$SP = " " x ($maxlen - 2 - $PathLen);
- if (!$Raw) {
- # no title in raw-mode!
+ if (!$Raw) {
+ # no title in raw-mode!
print C $LINE;
print C "$L $NUMC#$_NUMC ";
if ($ListType eq "LONG") {
@@ -1250,16 +1259,15 @@ sub output
$Space = " " x (($maxlen + $timelen) - 16);
print C $LINE;
print C "$L $NUMC$num$_NUMC $R$L$TIMEC$time$_TIMEC $Space$R\n";
- print C $LINE;
+ print "\n";
print C $NOTEC . $note . $_NOTEC . "\n";
- print C $LINE;
+ print C $LINE if ($count == 1);
}
}
-sub C
- {
+sub C {
my($default, $S, $Col, $NC, $T);
$default = "\033[0m";
$S = $_[0];
@@ -1281,11 +1289,10 @@ sub C
-sub num_bereich
- {
+sub num_bereich {
my($m,@LR,@Sorted_LR,$i);
# $number is the one we want to delete!
- # But does it contain kommas?
+ # But does it contain commas?
@NumBlock = (); #reset
$m = 0;
if ($number =~ /\,/) {
@@ -1320,8 +1327,7 @@ sub num_bereich
}
-sub getdate
- {
+sub getdate {
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$mon += 1;
@@ -1330,12 +1336,22 @@ sub getdate
$min =~ s/^(\d)$/0$1/;
$sec =~ s/^(\d)$/0$1/;
$mday =~ s/^(\d)$/0$1/;
+ if ($time_format) {
+ my $back = $time_format;
+ $back =~ s/YYYY/$year/;
+ $back =~ s/YY/substr($year, 1, 2)/e;
+ $back =~ s/MM/$mon/;
+ $back =~ s/DD/$mday/;
+ $back =~ s/mm/$min/;
+ $back =~ s/hh/$hour/;
+ $back =~ s/ss/$sec/;
+ return $back;
+ }
return "$mday.$mon.$year $hour:$min:$sec";
}
-sub gettemp
- {
+sub gettemp {
my($random, @range);
@range=('0'..'9','a'..'z','A'..'Z');
srand(time||$$);
@@ -1352,8 +1368,7 @@ sub gettemp
-sub help
- {
+sub help {
my $B = "";
my $BB = "";
my($S, $L, $T, $Q, $H, $N, $D, $E);
@@ -1506,7 +1521,7 @@ sub getconfig
$COLOR = "YES" if (/^UseColors/ && $value == 1);
$COLOR = "NO" if (/^UseColors/ && $value == 0);
$TopicSep = $value if (/^TopicSeparator/);
- $maxlen = $value if (/^MaxLen/);
+ $maxlen = $keepmaxlen = $value if (/^MaxLen/);
$BORDER_COLOR = $value if (/^BorderColor/);
$NUM_COLOR = $value if (/^NumberColor/);
$NOTE_COLOR = $value if (/^NoteColor/);
@@ -1516,6 +1531,7 @@ sub getconfig
$FormatText = $value if (/^FormatText/);
$TempDir = $value if (/^TempDirectory/);
$USE_CACHE = $value if (/^Cache/);
+ $time_format = $value if (/^TimeFormat/);
}
chomp $home;
$home =~ s/\/*$//; # cut eventually / at the end
@@ -1534,6 +1550,9 @@ sub getconfig
__END__
#
# $Log: note,v $
+# Revision 1.11 2000/12/09 21:56:08 zarahg
+# cvs update to 1.1.2, but incomplete, more to come
+#
# Revision 1.10 2000/08/19 13:38:33 zarahg
# .
#
diff --git a/bin/stresstest.sh b/bin/stresstest.sh
new file mode 100755
index 0000000..4913a02
--- /dev/null
+++ b/bin/stresstest.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+# create notes with topics which then represents the corresponding
+# directory structure. Depending on how many files the directory
+# contains, the resulting note-database may become very large.
+# It will then have thousands of notes!
+STARTDIR=$1
+case $STARTDIR in
+ "")
+ echo "usage: stresstest.sh "
+ exit 1
+ ;;
+ *)
+ LOCPFAD=`echo $STARTDIR | grep "^[a-zA-Z0-9.]"`
+ case $LOCPFAD in
+ "")
+ #echo nix
+ ;;
+ *)
+ STARTDIR=`echo $STARTDIR | sed 's/^\.*//'`
+ STARTDIR="`pwd`/$STARTDIR"
+ STARTDIR=`echo $STARTDIR | sed 's/\/\//\//g'`
+ ;;
+ esac
+ ;;
+esac
+
+
+stress ()
+{
+ FILES=""
+ for file in `ls $1|sort`
+ do
+ echo "$1/$file"
+ if [ -d "$1/$file" ] ; then
+ stress "$1/$file"
+ else
+ #echo "$1/" > /tmp/$$
+ #echo $file >> /tmp/$$
+ #`cat /tmp/$$ | note -`
+ FILES="$FILES $file"
+ fi
+ done
+ echo "$1/" > /tmp/$$
+ echo "$FILES" >> /tmp/$$
+ case $FILES in
+ "")
+ ;;
+ *)
+ RES=`cat /tmp/$$ | note -`
+ ;;
+ esac
+ FILES=""
+}
+
+stress $STARTDIR
diff --git a/config/noterc b/config/noterc
index 6c77987..b06658f 100644
--- a/config/noterc
+++ b/config/noterc
@@ -1,4 +1,4 @@
-# 1.1.0 -*- sh -*-
+# 1.1.2 -*- sh -*-
# This is a sample config for the note script
# There are useful defaults set in note itself.
#
@@ -77,8 +77,8 @@ CryptMethod IDEA
# You can run note always in interactive mode by simply
# typing "note". Set this option to 1 to turn it on.
-# The default is 0 (off).
-AlwaysInteractive 0
+# The default is 1 (on).
+AlwaysInteractive 1
# In interactive mode, note issues a list command if you
@@ -115,9 +115,9 @@ TopicSeparator /
# The maximum width for displaying a note, in CHARS.
# Depends on your screen-size. You can set it to
-# "auto", if you wish that note sould determine the
-# available size, but it experimental, be aware!
-MaxLen 30
+# "auto", if you wish that note should determine the
+# available size.
+MaxLen auto
# note can use colors for output, set this option to
@@ -168,6 +168,22 @@ Cache 0
+# you can define your very own time format for time stamps
+# YY - the last 2 digits of a year
+# YYYY - year
+# MM - month
+# DD - day
+# hh - hours
+# mm - minutes
+# ss - seconds
+# This is the default: (18.10.2000 21:32:08)
+TimeFormat DD.MM.YYYY hh:mm:ss
+
+
+
+
+
+
# That's all about it for now.
# If you still have any questiosn, please feel free to contact
# me by email: Thomas Linden
diff --git a/note.pod b/note.pod
index 1054309..1382fbe 100644
--- a/note.pod
+++ b/note.pod
@@ -142,7 +142,7 @@ It will tell you all available commandline options.
To create a new note, simply run "note". You can enter
the note (the length is by default limited to 4096 bytes,
which you can change from your config file if you are using
-the binary backend, therwise there is no limitation).
+the binary backend, otherwise there is no limitation).
End by typing a . on a line itself. note will tell you the
number of the note.
@@ -154,14 +154,13 @@ You will get a list of all notes, containing the number,
the first line and the creation date. If topic-support is
turned on (which is by default), then all subtopics under the
current topic will be displayed first.
-If you want to get a listing of all
If you want to see the timestamps, use "-L" instead of "-l".
Read more about topics below in the section "Topics".
You can also specify the topic which notes you want to see:
"-l mytopic" does the trick.
Additional, you might want to get an overview of your topic-
-strcture. You can use the command "-t" in this case, which
-will display a tree-view of your tpic-structure. You can
+structure. You can use the command "-t" in this case, which
+will display a tree-view of your topic-structure. You can
use the command "-T" if you want to see the notes under each
topic too. "-T" will also show the number of each note.
@@ -203,7 +202,12 @@ display it's second line.
These rules apply for the interactive search too.
-
+You need to know, that note searches for the expression in every
+note. In other words, "moses AND lenin" searches for an occurence
+of "moses" and "lenin" in ONE note. Or, if you are looking for
+"mike OR daniel", then it searches for an occurence of "mike" or
+daniel" in ONE note. Thus a note with the text "mike oldfield" will
+match that search.
=head2 TOPICS
@@ -421,7 +425,7 @@ Another very nice feature is the possibility to format the note-text
"magic-strings" for colorizing. Those strings looks much like HTML:
"here is a green line of text no more green."
As you see, the beginning of another color starts with a tag(kinda) of
-the color and ens with an end tag .
+the color and ends with an end tag .
The following colors are available:
black, red, green, yellow, blue, magenta, cyan and white.