summaryrefslogtreecommitdiff
path: root/elink
diff options
context:
space:
mode:
authorAaron M. Ucko <ucko@debian.org>2023-01-23 20:16:02 -0500
committerAaron M. Ucko <ucko@debian.org>2023-01-23 20:16:02 -0500
commit157b97865a74d7eb4358abe5985e250cc250a858 (patch)
treec96672d530c70eb7e505fe45b2302c09e7c91177 /elink
parent1c3b39b230f962581e6643f4577bdfb87aabe5db (diff)
New upstream version 14.8.20210324+dfsg
Diffstat (limited to 'elink')
-rwxr-xr-xelink46
1 files changed, 24 insertions, 22 deletions
diff --git a/elink b/elink
index 2e8f184..8a137da 100755
--- a/elink
+++ b/elink
@@ -206,7 +206,7 @@ do
db="$1"
shift
else
- echo "ERROR: Missing -db argument" >&2
+ echo "${red_fg}ERROR: Missing -db argument${reset_colors}" >&2
exit 1
fi
;;
@@ -217,7 +217,7 @@ do
ids="$1"
shift
else
- echo "ERROR: Missing -id argument" >&2
+ echo "${red_fg}ERROR: Missing -id argument${reset_colors}" >&2
exit 1
fi
while [ $# -gt 0 ]
@@ -244,7 +244,7 @@ do
idtype=acc
fi
else
- echo "ERROR: Missing -format argument" >&2
+ echo "${red_fg}ERROR: Missing -format argument${reset_colors}" >&2
exit 1
fi
;;
@@ -255,7 +255,7 @@ do
target="$1"
shift
else
- echo "ERROR: Missing -target argument" >&2
+ echo "${red_fg}ERROR: Missing -target argument${reset_colors}" >&2
exit 1
fi
;;
@@ -266,7 +266,7 @@ do
name="$1"
shift
else
- echo "ERROR: Missing -name argument" >&2
+ echo "${red_fg}ERROR: Missing -name argument${reset_colors}" >&2
exit 1
fi
;;
@@ -277,7 +277,7 @@ do
cmmd="$1"
shift
else
- echo "ERROR: Missing -cmd argument" >&2
+ echo "${red_fg}ERROR: Missing -cmd argument${reset_colors}" >&2
exit 1
fi
;;
@@ -288,7 +288,7 @@ do
mode="$1"
shift
else
- echo "ERROR: Missing -mode argument" >&2
+ echo "${red_fg}ERROR: Missing -mode argument${reset_colors}" >&2
exit 1
fi
;;
@@ -322,7 +322,7 @@ do
then
shift "$argsConsumed"
else
- echo "ERROR: Unrecognized option $1" >&2
+ echo "${red_fg}ERROR: Unrecognized option $1${reset_colors}" >&2
exit 1
fi
;;
@@ -363,7 +363,7 @@ fi
if [ -z "$dbase" ]
then
- echo "ERROR: Missing -db argument" >&2
+ echo "${red_fg}ERROR: Missing -db argument${reset_colors}" >&2
exit 1
fi
@@ -400,7 +400,7 @@ case "$cmmd" in
* )
if [ -z "$target" ] && [ "$related" = false ] && [ "$cited" = false ] && [ "$cites" = false ]
then
- echo "ERROR: Must supply -target or -related on command line" >&2
+ echo "${red_fg}ERROR: Must supply -target or -related on command line${reset_colors}" >&2
exit 1
fi
if [ -z "$target" ]
@@ -428,7 +428,7 @@ fi
if [ "$dbase" = "nlmcatalog" ]
then
- echo "ERROR: Entrez Direct does not support links for the nlmcatalog database" >&2
+ echo "${red_fg}ERROR: Entrez Direct does not support links for the nlmcatalog database${reset_colors}" >&2
exit 1
fi
@@ -438,22 +438,23 @@ if [ "$needHistory" = true ]
then
if [ -t 0 ]
then
- echo "ERROR: ENTREZ_DIRECT message not piped from stdin" >&2
+ echo "${red_fg}ERROR: ENTREZ_DIRECT message not piped from stdin${reset_colors}" >&2
exit 1
fi
if [ -z "$web_env" ]
then
- echo "ERROR: WebEnv value not found in elink input" >&2
+ echo "${red_fg}ERROR: WebEnv value not found in elink input${reset_colors}" >&2
exit 1
fi
if [ -z "$qry_key" ]
then
- echo "ERROR: QueryKey value not found in elink input" >&2
+ echo "${red_fg}ERROR: QueryKey value not found in elink input${reset_colors}" >&2
exit 1
fi
if [ "$num" -lt 1 ]
then
- # silently exit if no results to process
+ # print message with count of 0 if no results to process
+ WriteEDirect "$target" "$web_env" "$qry_key" "0" "$stp" "$err"
exit 0
fi
fi
@@ -462,7 +463,7 @@ if [ "$cited" = true ] || [ "$cites" = true ]
then
if [ "$dbase" != "pubmed" ]
then
- echo "ERROR: -cited or -cites can only be used with -db pubmed" >&2
+ echo "${red_fg}ERROR: -cited or -cites can only be used with -db pubmed${reset_colors}" >&2
exit 1
fi
fi
@@ -603,7 +604,7 @@ LinkInGroups() {
if [ -n "$err" ]
then
- echo "ERROR: elink failed - $err" >&2
+ echo "${red_fg}ERROR: elink failed - $err${reset_colors}" >&2
exit 1
fi
if [ -z "$web_env" ]
@@ -660,8 +661,9 @@ then
if [ -n "$num" ] && [ "$num" -lt 1 ]
then
- res=$( RunWithCommonArgs nquire -url "$base" elink.fcgi -dbfrom "$target" \
- -query_key "$qry_key" -WebEnv "$wbnv" -cmd "acheck" )
+ uids=$( GenerateUidList "$dbase" | head -n 500 | join-into-groups-of 500 )
+ res=$( RunWithCommonArgs nquire -url "$base" elink.fcgi \
+ -dbfrom "$dbase" -id "$uids" -cmd "acheck" )
if [ -n "$res" ]
then
@@ -672,10 +674,10 @@ then
tst=$( echo "$res" | xtract -pattern LinkInfo -if LinkName -equals "$name" -element LinkName )
if [ -n "$tst" ]
then
- echo "ERROR: acheck test indicates non-zero count expected" >&2
+ echo "${red_fg}ERROR: acheck test indicates non-zero count expected${reset_colors}" >&2
fi
else
- echo "ERROR: acheck test failed - $err" >&2
+ echo "${red_fg}ERROR: acheck test failed - $err${reset_colors}" >&2
fi
fi
fi
@@ -687,5 +689,5 @@ fi
# warn on error
-echo "ERROR: ELink failure" >&2
+echo "${red_fg}ERROR: ELink failure${reset_colors}" >&2
exit 1