mirror of
https://codeberg.org/scip/note.git
synced 2025-12-17 04:31:02 +01:00
FIXED: removed any file/path actions using '/'. replaced by portable
functions by using File::Spec. This makes it possible to run
note unchanged on win32 (and possibly any other) environments.
FIXED: added a whitespace to the prompt in interactive mode to
circumvent a bug in the win32 Term::ReadLine module which causes
the cursor to be displayed on the left side (column 0) of
the screen.
FIXED: added "or die" code to some commands which are running inside
an eval{} block to fetch errors. Without the "or die"s no
error could ever catched.
CHANGED: removed HOME variable support of the noterc. in fact, if it
exists, no error will occur, but it will no longer be used.
It didn't work in older versions anyway.
ADDED: It is now possible to quit note using CTRL-D (or: EOF)
This commit is contained in:
21
Changelog
21
Changelog
@@ -1,3 +1,24 @@
|
||||
================================================================================
|
||||
1.2.5:
|
||||
FIXED: removed any file/path actions using '/'. replaced by portable
|
||||
functions by using File::Spec. This makes it possible to run
|
||||
note unchanged on win32 (and possibly any other) environments.
|
||||
|
||||
FIXED: added a whitespace to the prompt in interactive mode to
|
||||
circumvent a bug in the win32 Term::ReadLine module which causes
|
||||
the cursor to be displayed on the left side (column 0) of
|
||||
the screen.
|
||||
|
||||
FIXED: added "or die" code to some commands which are running inside
|
||||
an eval{} block to fetch errors. Without the "or die"s no
|
||||
error could ever catched.
|
||||
|
||||
CHANGED: removed HOME variable support of the noterc. in fact, if it
|
||||
exists, no error will occur, but it will no longer be used.
|
||||
It didn't work in older versions anyway.
|
||||
|
||||
ADDED: It is now possible to quit note using CTRL-D (or: EOF)
|
||||
|
||||
================================================================================
|
||||
1.2.4:
|
||||
CHANGED: in the function find_editor() the alternatives vim and pico
|
||||
|
||||
4
README
4
README
@@ -1,4 +1,4 @@
|
||||
note 1.2.4 by Thomas Linden, 22/03/2003
|
||||
note 1.2.5 by Thomas Linden, 19/01/2004
|
||||
=======================================
|
||||
|
||||
Introduction
|
||||
@@ -205,4 +205,4 @@ and I'll add you.
|
||||
Last changed
|
||||
============
|
||||
|
||||
22/03/2003
|
||||
19/01/2004
|
||||
50
bin/note
50
bin/note
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# note - console notes management with database and encryption support.
|
||||
# Copyright (C) 1999-2003 Thomas Linden (see README for details!)
|
||||
# Copyright (C) 1999-2004 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
|
||||
@@ -27,6 +27,9 @@ use strict;
|
||||
no strict 'refs';
|
||||
#use Data::Dumper;
|
||||
use Getopt::Long;
|
||||
use FileHandle;
|
||||
use File::Spec;
|
||||
|
||||
|
||||
#
|
||||
# prototypes
|
||||
@@ -112,10 +115,9 @@ $date = &getdate;
|
||||
$USER = getlogin || getpwuid($<);
|
||||
chomp $USER;
|
||||
$HOME = $ENV{'HOME'};
|
||||
$CONF = $HOME . "/.noterc";
|
||||
$CONF = File::Spec->catfile($HOME, ".noterc");
|
||||
$dbdriver = "binary";
|
||||
$libpath = "/usr/local/lib";
|
||||
$NOTEDB = $HOME . "/.notedb";
|
||||
$NOTEDB = File::Spec->catfile($HOME, ".notedb");
|
||||
$MAX_NOTE = 4096;
|
||||
$MAX_TIME = 84;
|
||||
$COLOR = "YES";
|
||||
@@ -126,12 +128,12 @@ $TIME_COLOR = "blue";
|
||||
$TOPIC_COLOR = "bold";
|
||||
$TOPIC = 1;
|
||||
$TopicSep = '/';
|
||||
$version = "1.2.4";
|
||||
$version = "1.2.5";
|
||||
if ($TOPIC) {
|
||||
$CurDepth = 1; # the current depth inside the topic "directory" structure...
|
||||
}
|
||||
$USE_CRYPT = "NO";
|
||||
$TempDir = "/tmp";
|
||||
$TempDir = File::Spec->tmpdir();
|
||||
# mysql stuff
|
||||
$table = "note";
|
||||
$fnote = "note";
|
||||
@@ -370,7 +372,9 @@ if ($DEFAULT_LIST eq "LONG") {
|
||||
# *if* loading of the config was successful, try to load the
|
||||
# configured database backend. Currently supported:
|
||||
# mysql, dbm and binary.
|
||||
if ($libpath) {
|
||||
unshift @INC, $libpath;
|
||||
}
|
||||
|
||||
if ($dbdriver eq "binary") {
|
||||
eval {
|
||||
@@ -381,13 +385,13 @@ if ($dbdriver eq "binary") {
|
||||
elsif ($dbdriver eq "mysql") {
|
||||
# do the new() later because of the encrypted password!
|
||||
eval {
|
||||
require "NOTEDB/mysql.pm";
|
||||
require NOTEDB::mysql;
|
||||
};
|
||||
die "mysql backend unsupported: $@\n" if($@);
|
||||
}
|
||||
else {
|
||||
eval {
|
||||
require "NOTEDB/$dbdriver.pm";
|
||||
require "NOTEDB::$dbdriver";
|
||||
$db = new NOTEDB($dbdriver, $dbname, $dbhost, $dbuser, $dbpasswd, $table, $fnum, $fnote, $fdate);
|
||||
};
|
||||
}
|
||||
@@ -423,11 +427,11 @@ if ($USE_CRYPT eq "YES" && $NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
local($|) = 1;
|
||||
local(*TTY);
|
||||
open(TTY,"/dev/tty");
|
||||
system ("stty -echo </dev/tty");
|
||||
open(TTY,"/dev/tty") or die "No /dev/tty!";
|
||||
system ("stty -echo </dev/tty") and die "stty failed!";
|
||||
chomp($key = <TTY>);
|
||||
print STDERR "\r\n";
|
||||
system ("stty echo </dev/tty");
|
||||
system ("stty echo </dev/tty") and die "stty failed!";
|
||||
close(TTY);
|
||||
};
|
||||
if ($@) {
|
||||
@@ -512,11 +516,11 @@ sub encrypt_passwd {
|
||||
eval {
|
||||
local($|) = 1;
|
||||
local(*TTY);
|
||||
open(TTY,"/dev/tty");
|
||||
system ("stty -echo </dev/tty");
|
||||
open(TTY,"/dev/tty") or die "No /dev/tty!";
|
||||
system ("stty -echo </dev/tty") and die "stty failed!";
|
||||
chomp($key = <TTY>);
|
||||
print STDERR "\r\n";
|
||||
system ("stty echo </dev/tty");
|
||||
system ("stty echo </dev/tty") and die "stty failed!";
|
||||
close(TTY);
|
||||
};
|
||||
if ($@) {
|
||||
@@ -1001,10 +1005,17 @@ sub interactive {
|
||||
|
||||
# endless until user press "Q" or "q"!
|
||||
if ($term) {
|
||||
$char = $term->readline("");
|
||||
if (defined ($char = $term->readline(" "))) {
|
||||
$term->addhistory($char) if $char =~ /\S/;
|
||||
$char =~ s/\s*$//; # remove trailing whitespace (could come from auto-completion)
|
||||
}
|
||||
else {
|
||||
# shutdown
|
||||
$| = $Channel;
|
||||
print "\n\ngood bye!\n";
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$char = <STDIN>;
|
||||
chomp $char;
|
||||
@@ -1606,13 +1617,12 @@ sub getconfig {
|
||||
$time_format = $value if (/^TimeFormat/);
|
||||
$AUTO_CLEAR = $value if (/^AutoClear/);
|
||||
}
|
||||
chomp $home;
|
||||
$home =~ s/\/*$//; # cut eventually / at the end
|
||||
$HOME = eval($home);
|
||||
|
||||
if ($NOTEDB =~ /^(~\/)(.*)$/) {
|
||||
$NOTEDB = "/home/" . $USER . "/" . $2;
|
||||
$NOTEDB = File::Spec->catfile($HOME, $2);
|
||||
}
|
||||
$libpath =~ s/\/*$//;
|
||||
|
||||
$libpath = (File::Spec->splitpath($libpath))[1];
|
||||
|
||||
close CONFIG;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# 1.2.4 -*- sh -*-
|
||||
# 1.2.5 -*- sh -*-
|
||||
# This is a sample config for the note script
|
||||
# There are useful defaults set in note itself.
|
||||
#
|
||||
# Copy it to your $HOME as .noterc
|
||||
#
|
||||
# note is Copyright (c) 1999-2003 Thomas Linden.
|
||||
# note is Copyright (c) 1999-2004 Thomas Linden.
|
||||
# You can contact me per email: <tom@daemon.de>
|
||||
#
|
||||
# comments start with #, empty lines will be ignored.
|
||||
@@ -13,15 +13,10 @@
|
||||
# by minimum one space (more spaces and/or tabs are allowed)
|
||||
|
||||
|
||||
# Your home directory, better do not change it!
|
||||
# can be an environment variable or a path
|
||||
Home $ENV{'HOME'}
|
||||
|
||||
|
||||
# specify the path, where the NOTEDB lib directory
|
||||
# resides. This will only used if it is not
|
||||
# installed inside the perl-lib directory structure!
|
||||
LibPath /usr/local/lib
|
||||
#LibPath /usr/local/lib
|
||||
|
||||
|
||||
# you need to decide which database backend you want
|
||||
|
||||
Reference in New Issue
Block a user