rm bashisms, applied port patch

This commit is contained in:
git@daemon.de
2015-05-16 00:14:14 +02:00
parent 30e1cdf87a
commit ad8681f0d1
6 changed files with 20 additions and 27 deletions

View File

@@ -77,7 +77,7 @@ int main(int argc, char *argv[]) {
engine.dump(); engine.dump();
break; break;
case 'I': case 'I':
engine.from_stdin(); engine.from_input();
break; break;
case 's': case 's':
/* select */ /* select */

View File

@@ -260,7 +260,7 @@ void Engine::regexp() {
/* /*
* Insert data into the db * Insert data into the db
*/ */
void Engine::from_stdin() { void Engine::from_input() {
init(); init();
#ifdef HAVE_BERKELEY #ifdef HAVE_BERKELEY
int err; int err;

View File

@@ -117,7 +117,7 @@ class Engine {
void update(); void update();
void remove(); void remove();
void select(); void select();
void from_stdin(); void from_input();
void dump(); void dump();
void regexp(); void regexp();
}; };

View File

@@ -20,9 +20,8 @@ db=~/.accdb
# #
# check if dbtool version is 1.4 or higher # check if dbtool version is 1.4 or higher
version=`dbtool -V 2>&1 | sed 's/[a-zA-Z .]*//g'` version=`dbtool -V 2>&1 | sed 's/[a-zA-Z .]*//g'`
if [ "x$version" != "x" ]; then if test -n "$version"; then
let res="$version < 14" if test $version -lt 14; then
if [ "x$res" = "x1" ]; then
echo "This version of dbtool does not support encryption!" echo "This version of dbtool does not support encryption!"
exit 1 exit 1
fi fi
@@ -36,7 +35,7 @@ fi
echo -n "Enter passphrase: " echo -n "Enter passphrase: "
read PW read PW
if [ "x$PW" = "x" ]; then if test -z "$PW"; then
echo "empty passphrase!" echo "empty passphrase!"
exit -1 exit -1
fi fi
@@ -65,7 +64,8 @@ while :
do do
read command read command
if [ "x$command" = "xL" -o "x$command" = "xl" ]; then case $command in
l|L)
echo echo
if [ -e $db ]; then if [ -e $db ]; then
# #
@@ -73,7 +73,7 @@ do
# separator for better formatting with sed :-) # separator for better formatting with sed :-)
dbtool -d $db -p -D -F "<22>" | sed 's/<2F>/ => /' dbtool -d $db -p -D -F "<22>" | sed 's/<2F>/ => /'
fi fi
elif [ "x$command" = "xN" -o "x$command" = "xn" ]; then n|N)
echo echo
echo -n "Enter entry name: " echo -n "Enter entry name: "
read name read name
@@ -91,18 +91,18 @@ do
| dbtool -p -i -f -d $db -F "|" | dbtool -p -i -f -d $db -F "|"
echo "entry $name inserted." echo "entry $name inserted."
fi fi
elif [ "x$command" = "xS" -o "x$command" = "xs" ]; then s|S)
echo -n "Enter search string: " echo -n "Enter search string: "
read string read string
# #
# search for the given key # search for the given key
dbtool -p -d $db -s -k $string dbtool -p -d $db -s -k $string
elif [ "x$command" = "xQ" -o "x$command" = "xq" ]; then q|Q)
echo echo
echo "Thanks for the fish." echo "Thanks for the fish."
echo echo
exit 0 exit 0
fi esac
menu menu
done done

View File

@@ -11,14 +11,11 @@
# compliant regular expression. # compliant regular expression.
# #
dbtool="/usr/bin/dbtool"; db="/var/db/locate.db"
find="/usr/bin/find"; regex=$1
db="/var/local/locate.db";
sort="/bin/sort";
regex=$1;
if [ "x$regex" != "x" ]; then if test -n "$regex"; then
$dbtool -d $db -S -k $regex -w -R; dbtool -d $db -S -k $regex -w -R
else else
echo "Usage: locate <expression>"; echo "Usage: locate <expression>"
fi fi

View File

@@ -9,11 +9,7 @@
# to search for a certain string. # to search for a certain string.
# #
dbtool="/usr/bin/dbtool"; db="/var/db/locate.db";
find="/usr/bin/find";
db="/var/local/locate.db";
egrep="/bin/egrep";
cp="/bin/cp"
$cp /dev/null $db; echo -n > $db
$find / -ls | $egrep -v "^\/proc|dev|tmp" | $dbtool -d $db -i -f -R -t "^(.+?) (\/.*)$"; find / -ls | egrep -v "^\/proc|dev|tmp" | dbtool -d $db -i -f -R -t "^(.+?) (\/.*)$";