Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:add more comments and fix some more quoting issues
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:dd4b854be95d1f23ac83c0f2cffafdb19a686d0b
User & Date: brandon 2016-04-06 20:37:28
Context
2016-04-06
20:41
whitespace cleanup check-in: 45c7ccd639 user: brandon tags: trunk
20:37
add more comments and fix some more quoting issues check-in: dd4b854be9 user: brandon tags: trunk
20:32
update copyright years in version output check-in: 7cc6438a09 user: brandon tags: trunk
Changes

Changes to paperq.in.

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
150
151
152
153
154



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
...
214
215
216
217
218
219
220

221
222
223
224
225
226
227
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
EOF
    exit 0
}

add_doc () {

    grep -q "$1" ${QFILE} || printf "%s\n" "$1" >>${QFILE}
    printf "%s ADDED %s\n" "$(date '+[%Y-%m-%d %H:%M]')" "$1" >>${LOGFILE}
}

get_doc () {

    check_pos
    sed -n "${pos}p" ${QFILE}
}

rem_doc () {

    check_pos
    printf "%s REMOVED %s\n" "$(date '+[%Y-%m-%d %H:%M]')" \
           "$(sed -n "${pos}p" ${QFILE})" >>${LOGFILE}
    sed -i "${pos}d" ${QFILE}
}

open_doc () {

    check_pos
    $(printf "$OPENCMD" "$(get_doc $pos)")
    printf "%s READ %s\n" "$(date '+[%Y-%m-%d %H:%M]')" \
           "$(sed -n "${pos}p" ${QFILE})" >>${LOGFILE}
    rem_doc
}

print_bib () {



    if ! grep -q $1 $2; then
        return
    fi
    if [ -f ${BIBCACHE} ]; then
        wrapped_bib="$(echo "$1" | zdbf ${BIBCACHE} 2>/dev/null)"
    fi
    if [[ "x$wrapped_bib" == "x" ]]; then
        wrapped_bib="$(paperbib -a${MAXAUTHORS} -w${WRAP} -i'	' $1 <$2 2>/dev/null)"
    fi
    printf "%s:%s\n\n" "$pos" "$wrapped_bib"
}

doc_info () {
    # Print information on the document: bibliographic data unless the -f
    # option was used.
................................................................................
    done <${QFILE}
    dir=$(pwd)
    cd /tmp && tar -czf $dir/paperq-papers.tar.gz paperq-papers
    rm -rf /tmp/paperq-papers
}

check_pos () {

    if [ ! -e ${QFILE} ]; then
        printf "The queue has not yet been created.  Add some documents to it "
        printf "first.\n"
        exit 1
    fi
    len=$(sed '/^ *$/d' ${QFILE} | wc -l | cut -f1 -d' ')
    if (( len == 0 )); then







>





>





>







>








>
>
>
|



|


|







 







>







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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
...
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
EOF
    exit 0
}

add_doc () {
    # Add a document to the queue
    grep -q "$1" ${QFILE} || printf "%s\n" "$1" >>${QFILE}
    printf "%s ADDED %s\n" "$(date '+[%Y-%m-%d %H:%M]')" "$1" >>${LOGFILE}
}

get_doc () {
    # Get a document file path
    check_pos
    sed -n "${pos}p" ${QFILE}
}

rem_doc () {
    # Remove a document from the queue
    check_pos
    printf "%s REMOVED %s\n" "$(date '+[%Y-%m-%d %H:%M]')" \
           "$(sed -n "${pos}p" ${QFILE})" >>${LOGFILE}
    sed -i "${pos}d" ${QFILE}
}

open_doc () {
    # Open a document using OPENCMD
    check_pos
    $(printf "$OPENCMD" "$(get_doc $pos)")
    printf "%s READ %s\n" "$(date '+[%Y-%m-%d %H:%M]')" \
           "$(sed -n "${pos}p" ${QFILE})" >>${LOGFILE}
    rem_doc
}

print_bib () {
    # Print the bibliographic information for a document if available
    local key="$1"
    local bibfile="$2"
    if ! grep -q "$key" "$bibfile"; then
        return
    fi
    if [ -f ${BIBCACHE} ]; then
        wrapped_bib="$(echo "$key" | zdbf ${BIBCACHE} 2>/dev/null)"
    fi
    if [[ "x$wrapped_bib" == "x" ]]; then
        wrapped_bib="$(paperbib -a${MAXAUTHORS} -w${WRAP} -i'	' $key <$2 2>/dev/null)"
    fi
    printf "%s:%s\n\n" "$pos" "$wrapped_bib"
}

doc_info () {
    # Print information on the document: bibliographic data unless the -f
    # option was used.
................................................................................
    done <${QFILE}
    dir=$(pwd)
    cd /tmp && tar -czf $dir/paperq-papers.tar.gz paperq-papers
    rm -rf /tmp/paperq-papers
}

check_pos () {
    # Do some sanity checks on a given queue position
    if [ ! -e ${QFILE} ]; then
        printf "The queue has not yet been created.  Add some documents to it "
        printf "first.\n"
        exit 1
    fi
    len=$(sed '/^ *$/d' ${QFILE} | wc -l | cut -f1 -d' ')
    if (( len == 0 )); then