/usr/bin/db2ris is in refdb-clients 1.0.2-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | #!/bin/sh
# db2ris - converts DocBook BiblioEntry elements into RIS datasets
# Markus Hoenicka <markus@mhoenicka.de> 010927
# $Id: db2ris.in,v 1.4 2003/02/26 23:27:09 mhoenicka Exp $
# OPTIONS: -a (long firstnames) -h (invoke help) -o outfile -O outfile
# -r (default reference type)
# relies on these external programs: (open)jade sed
# tries to use these environment variables: $REFDBLIB $HOME
### start user-customizable section
# path to the db2ris stylesheet
db2risdsssl="/usr/share/refdb/dsssl/db2ris.dsl"
# the Jade/OpenJade command. You should use OpenJade whenever possible. Jade
# cannot read arbitrary variable values from the command line so you cannot
# use configuration files or the -a and -r command line switches. To configure
# this script for use with Jade, edit the initialization for authorlong
# and defaultreftype accordingly
myjade="/usr/bin/openjade"
# the SGML declaration
sgmldecl="/usr/share/refdb/declarations/docbook.dcl"
# the default destination for log output. 0 means stderr, 2 means
# a custom log file defined in $logfile
logdest=0
# the path of the custom log file. To use this, set $logdest to 2
logfile="/var/log/db2ris"
# the path of the global configuration file
globalconfig="/etc/refdb"
### end user-customizable section
# initialize variables
outfile=""
truncate='f'
authorlong=""
defaultreftype=""
allconfigs=""
globalconfig=""
varstring=""
# determine configuration files
if [ ! -r "$globalconfig" ] && [ -n "$REFDBLIB" ]; then
globalconfig=$REFDBLIB/db2risrc
fi
userconfig=$HOME/.db2risrc
# first try the hidden file, then the plain file
if [ ! -r "$userconfig" ]; then
userconfig=$HOME/db2risrc
fi
if [ -n "$globalconfig" ] && [ -r "$globalconfig" ]; then
allconfigs=$globalconfig
fi
if [ -r "$userconfig" ]; then
allconfigs=$allconfigs" "$userconfig
fi
# read the settings in the configure file(s)
for config in $allconfigs; do
while read refdbvar refdbval; do
if [ -n "$refdbvar" ]; then
if [ $refdbvar = authorlong ]; then
authorlong=$refdbval
fi
if [ $refdbvar = defaultreftype ]; then
defaultreftype=$refdbval
fi
if [ $refdbvar = logdest ]; then
logdest=$refdbval
fi
if [ $refdbvar = logfile ]; then
logfile=$refdbval
fi
fi
done < $config
done
# read the command line options
while getopts ":ae:hL:o:O:r:" opt; do
case $opt in
a ) authorlong="t";;
e ) logdest=$OPTARG;;
h ) echo "converts DocBook BiblioEntry elements into RIS datasets"
echo 'usage: db2ris [-a] [-e dest] [-h] [-L logfile] [-o outfile] [-O outfile] [-r type] file1 [file2...]'
echo "Options: -a use long author firstnames"
echo " -e log destination. 0 means stderr, 2 means custom file"
echo " -h print this help and exit"
echo " -L path of a custom log file"
echo " -o send output to file"
echo " -O append output to file"
echo " -r set default reference type"
exit 0 ;;
L ) logfile=$OPTARG;;
o ) outfile=$OPTARG
truncate='t';;
O ) outfile=$OPTARG;;
r ) defaultreftype=$OPTARG;;
\? ) echo 'usage: db2ris [-a] [-e dest] [-h] [-L logfile] [-o outfile] [-O outfile] [-r type] file1 [file2...]'
echo 'type db2ris -h to invoke help'
exit 1;;
esac
done
# correct the index so the filename argument is always $1
shift $(($OPTIND - 1))
# assemble the OpenJade variable string
if [ -n "$authorlong" ]; then
varstring=" -V AUTHORLONG="$authorlong
fi
if [ -n "$defaultreftype" ]; then
varstring=$varstring" -V DEFAULTREFTYPE="$defaultreftype
fi
# truncate the output file if requested. We cannot use the redirect and append
# operators in the command below because the former would not make much sense
# if several files are specified on the command line. The difference between
# overwriting and appending in this script is that the output of all files is
# appended to an empty file in the first case and to a possibly existing file
# in the second case.
if [ -n "$outfile" ] && [ $truncate = "t" ]; then
# poor man's truncate(1)
echo "" > $outfile
fi
for filename in $*; do
if [ -n "$outfile" ]; then
if [ $logdest = 2 ] && [ -n "$logfile" ]; then
$myjade -t sgml -d $db2risdsssl $varstring $sgmldecl $filename 2>>$logfile | sed 'N;s%^>*<db2ris\n>\(.*\)</db2ris$%\1%g' | sed 's%^>$%%g' >> $outfile
else
$myjade -t sgml -d $db2risdsssl $varstring $sgmldecl $filename | sed 'N;s%^>*<db2ris\n>\(.*\)</db2ris$%\1%g' | sed 's%^>$%%g' >> $outfile
fi
else
if [ $logdest = 2 ] && [ -n "$logfile" ]; then
$myjade -t sgml -d $db2risdsssl $varstring $sgmldecl $filename 2>>$logfile | sed 'N;s%^>*<db2ris\n>\(.*\)</db2ris$%\1%g' | sed 's%^>$%%g'
else
$myjade -t sgml -d $db2risdsssl $varstring $sgmldecl $filename | sed 'N;s%^>*<db2ris\n>\(.*\)</db2ris$%\1%g' | sed 's%^>$%%g'
fi
fi
done
exit 0
|