"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "samples/account-db/accdb" between
dbtool-1.9.tar.gz and dbtool-1.9.1.tar.gz

About: dbtool stores and retrieves data in a key/value format in a hash database.

accdb  (dbtool-1.9):accdb  (dbtool-1.9.1)
skipping to change at line 22 skipping to change at line 22
# #
# T.v. Dein <tlinden@cpan.org> # T.v. Dein <tlinden@cpan.org>
# #
# the account database # the account database
db=~/.accdb 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
else else
echo "dbtool is not installed!" echo "dbtool is not installed!"
exit 1 exit 1
fi fi
# #
# get the passphrase # get the passphrase
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
# #
# store it in a local environment variable, # store it in a local environment variable,
# so it will not appear in the process list and # so it will not appear in the process list and
# dbtool itself will not ask for it # dbtool itself will not ask for it
export DB_PASSPHRASE=$PW export DB_PASSPHRASE=$PW
skipping to change at line 65 skipping to change at line 64
# #
# go # go
echo echo
menu menu
while : 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
# #
# just dump all entries out. Use a custom output # just dump all entries out. Use a custom output
# separator for better formatting with sed :-) # separator for better formatting with sed :-)
dbtool -d $db -p -D -F "" | sed 's// => /' dbtool -d $db -p -D -F "" | sed 's// => /'
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
if [ "x$name" = "x" ]; then if [ "x$name" = "x" ]; then
echo "empty name!" echo "empty name!"
else else
echo -n "Enter username: " echo -n "Enter username: "
read user read user
echo -n "Enter password: " echo -n "Enter password: "
read pass read pass
# #
# create a new entry, separate the key and the value # create a new entry, separate the key and the value
# using the pipe character, overwrite existing entry # using the pipe character, overwrite existing entry
echo "$name| Username: $user, Password: $pass" \ echo "$name| Username: $user, Password: $pass" \
| 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
# #
# clear the environment variable. just in case... # clear the environment variable. just in case...
unset DB_PASSPHRASE unset DB_PASSPHRASE
 End of changes. 7 change blocks. 
9 lines changed or deleted 9 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS