mirror of
https://codeberg.org/scip/note.git
synced 2025-12-17 12:41:10 +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:
|
1.2.4:
|
||||||
CHANGED: in the function find_editor() the alternatives vim and pico
|
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
|
Introduction
|
||||||
@@ -205,4 +205,4 @@ and I'll add you.
|
|||||||
Last changed
|
Last changed
|
||||||
============
|
============
|
||||||
|
|
||||||
22/03/2003
|
19/01/2004
|
||||||
60
bin/note
60
bin/note
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
#
|
#
|
||||||
# note - console notes management with database and encryption support.
|
# 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
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
@@ -27,6 +27,9 @@ use strict;
|
|||||||
no strict 'refs';
|
no strict 'refs';
|
||||||
#use Data::Dumper;
|
#use Data::Dumper;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
|
use FileHandle;
|
||||||
|
use File::Spec;
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# prototypes
|
# prototypes
|
||||||
@@ -112,10 +115,9 @@ $date = &getdate;
|
|||||||
$USER = getlogin || getpwuid($<);
|
$USER = getlogin || getpwuid($<);
|
||||||
chomp $USER;
|
chomp $USER;
|
||||||
$HOME = $ENV{'HOME'};
|
$HOME = $ENV{'HOME'};
|
||||||
$CONF = $HOME . "/.noterc";
|
$CONF = File::Spec->catfile($HOME, ".noterc");
|
||||||
$dbdriver = "binary";
|
$dbdriver = "binary";
|
||||||
$libpath = "/usr/local/lib";
|
$NOTEDB = File::Spec->catfile($HOME, ".notedb");
|
||||||
$NOTEDB = $HOME . "/.notedb";
|
|
||||||
$MAX_NOTE = 4096;
|
$MAX_NOTE = 4096;
|
||||||
$MAX_TIME = 84;
|
$MAX_TIME = 84;
|
||||||
$COLOR = "YES";
|
$COLOR = "YES";
|
||||||
@@ -126,12 +128,12 @@ $TIME_COLOR = "blue";
|
|||||||
$TOPIC_COLOR = "bold";
|
$TOPIC_COLOR = "bold";
|
||||||
$TOPIC = 1;
|
$TOPIC = 1;
|
||||||
$TopicSep = '/';
|
$TopicSep = '/';
|
||||||
$version = "1.2.4";
|
$version = "1.2.5";
|
||||||
if ($TOPIC) {
|
if ($TOPIC) {
|
||||||
$CurDepth = 1; # the current depth inside the topic "directory" structure...
|
$CurDepth = 1; # the current depth inside the topic "directory" structure...
|
||||||
}
|
}
|
||||||
$USE_CRYPT = "NO";
|
$USE_CRYPT = "NO";
|
||||||
$TempDir = "/tmp";
|
$TempDir = File::Spec->tmpdir();
|
||||||
# mysql stuff
|
# mysql stuff
|
||||||
$table = "note";
|
$table = "note";
|
||||||
$fnote = "note";
|
$fnote = "note";
|
||||||
@@ -370,7 +372,9 @@ if ($DEFAULT_LIST eq "LONG") {
|
|||||||
# *if* loading of the config was successful, try to load the
|
# *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.
|
# mysql, dbm and binary.
|
||||||
unshift @INC, $libpath;
|
if ($libpath) {
|
||||||
|
unshift @INC, $libpath;
|
||||||
|
}
|
||||||
|
|
||||||
if ($dbdriver eq "binary") {
|
if ($dbdriver eq "binary") {
|
||||||
eval {
|
eval {
|
||||||
@@ -381,13 +385,13 @@ if ($dbdriver eq "binary") {
|
|||||||
elsif ($dbdriver eq "mysql") {
|
elsif ($dbdriver eq "mysql") {
|
||||||
# do the new() later because of the encrypted password!
|
# do the new() later because of the encrypted password!
|
||||||
eval {
|
eval {
|
||||||
require "NOTEDB/mysql.pm";
|
require NOTEDB::mysql;
|
||||||
};
|
};
|
||||||
die "mysql backend unsupported: $@\n" if($@);
|
die "mysql backend unsupported: $@\n" if($@);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
eval {
|
eval {
|
||||||
require "NOTEDB/$dbdriver.pm";
|
require "NOTEDB::$dbdriver";
|
||||||
$db = new NOTEDB($dbdriver, $dbname, $dbhost, $dbuser, $dbpasswd, $table, $fnum, $fnote, $fdate);
|
$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 {
|
eval {
|
||||||
local($|) = 1;
|
local($|) = 1;
|
||||||
local(*TTY);
|
local(*TTY);
|
||||||
open(TTY,"/dev/tty");
|
open(TTY,"/dev/tty") or die "No /dev/tty!";
|
||||||
system ("stty -echo </dev/tty");
|
system ("stty -echo </dev/tty") and die "stty failed!";
|
||||||
chomp($key = <TTY>);
|
chomp($key = <TTY>);
|
||||||
print STDERR "\r\n";
|
print STDERR "\r\n";
|
||||||
system ("stty echo </dev/tty");
|
system ("stty echo </dev/tty") and die "stty failed!";
|
||||||
close(TTY);
|
close(TTY);
|
||||||
};
|
};
|
||||||
if ($@) {
|
if ($@) {
|
||||||
@@ -512,11 +516,11 @@ sub encrypt_passwd {
|
|||||||
eval {
|
eval {
|
||||||
local($|) = 1;
|
local($|) = 1;
|
||||||
local(*TTY);
|
local(*TTY);
|
||||||
open(TTY,"/dev/tty");
|
open(TTY,"/dev/tty") or die "No /dev/tty!";
|
||||||
system ("stty -echo </dev/tty");
|
system ("stty -echo </dev/tty") and die "stty failed!";
|
||||||
chomp($key = <TTY>);
|
chomp($key = <TTY>);
|
||||||
print STDERR "\r\n";
|
print STDERR "\r\n";
|
||||||
system ("stty echo </dev/tty");
|
system ("stty echo </dev/tty") and die "stty failed!";
|
||||||
close(TTY);
|
close(TTY);
|
||||||
};
|
};
|
||||||
if ($@) {
|
if ($@) {
|
||||||
@@ -993,17 +997,24 @@ sub interactive {
|
|||||||
$ListType = ($DEFAULT_LIST eq "LONG") ? "LONG" : "";
|
$ListType = ($DEFAULT_LIST eq "LONG") ? "LONG" : "";
|
||||||
undef $SetTitle;
|
undef $SetTitle;
|
||||||
if ($CurDepth > 2) {
|
if ($CurDepth > 2) {
|
||||||
print C $menu . $TOPICC . "../" . $CurTopic . $_TOPICC . "> ";
|
print C $menu . $TOPICC . "../" . $CurTopic . $_TOPICC . ">";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print C $menu . $TOPICC . $CurTopic . $_TOPICC . "> ";
|
print C $menu . $TOPICC . $CurTopic . $_TOPICC . ">";
|
||||||
}
|
}
|
||||||
|
|
||||||
# endless until user press "Q" or "q"!
|
# endless until user press "Q" or "q"!
|
||||||
if ($term) {
|
if ($term) {
|
||||||
$char = $term->readline("");
|
if (defined ($char = $term->readline(" "))) {
|
||||||
$term->addhistory($char) if $char =~ /\S/;
|
$term->addhistory($char) if $char =~ /\S/;
|
||||||
$char =~ s/\s*$//; # remove trailing whitespace (could come from auto-completion)
|
$char =~ s/\s*$//; # remove trailing whitespace (could come from auto-completion)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# shutdown
|
||||||
|
$| = $Channel;
|
||||||
|
print "\n\ngood bye!\n";
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$char = <STDIN>;
|
$char = <STDIN>;
|
||||||
@@ -1606,13 +1617,12 @@ sub getconfig {
|
|||||||
$time_format = $value if (/^TimeFormat/);
|
$time_format = $value if (/^TimeFormat/);
|
||||||
$AUTO_CLEAR = $value if (/^AutoClear/);
|
$AUTO_CLEAR = $value if (/^AutoClear/);
|
||||||
}
|
}
|
||||||
chomp $home;
|
|
||||||
$home =~ s/\/*$//; # cut eventually / at the end
|
|
||||||
$HOME = eval($home);
|
|
||||||
if ($NOTEDB =~ /^(~\/)(.*)$/) {
|
if ($NOTEDB =~ /^(~\/)(.*)$/) {
|
||||||
$NOTEDB = "/home/" . $USER . "/" . $2;
|
$NOTEDB = File::Spec->catfile($HOME, $2);
|
||||||
}
|
}
|
||||||
$libpath =~ s/\/*$//;
|
|
||||||
|
$libpath = (File::Spec->splitpath($libpath))[1];
|
||||||
|
|
||||||
close CONFIG;
|
close CONFIG;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
# 1.2.4 -*- sh -*-
|
# 1.2.5 -*- sh -*-
|
||||||
# This is a sample config for the note script
|
# This is a sample config for the note script
|
||||||
# There are useful defaults set in note itself.
|
# There are useful defaults set in note itself.
|
||||||
#
|
#
|
||||||
# Copy it to your $HOME as .noterc
|
# 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>
|
# You can contact me per email: <tom@daemon.de>
|
||||||
#
|
#
|
||||||
# comments start with #, empty lines will be ignored.
|
# comments start with #, empty lines will be ignored.
|
||||||
@@ -13,15 +13,10 @@
|
|||||||
# by minimum one space (more spaces and/or tabs are allowed)
|
# 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
|
# specify the path, where the NOTEDB lib directory
|
||||||
# resides. This will only used if it is not
|
# resides. This will only used if it is not
|
||||||
# installed inside the perl-lib directory structure!
|
# installed inside the perl-lib directory structure!
|
||||||
LibPath /usr/local/lib
|
#LibPath /usr/local/lib
|
||||||
|
|
||||||
|
|
||||||
# you need to decide which database backend you want
|
# you need to decide which database backend you want
|
||||||
|
|||||||
Reference in New Issue
Block a user