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();
break;
case 'I':
engine.from_stdin();
engine.from_input();
break;
case 's':
/* select */

View File

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

View File

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

View File

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

View File

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

View File

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