+# ============= Output of "show" command for log files =============
+database_query_show_log ()
+{
+ local grandtitle title list listdb pkgnamedb isfirst origin_target pkg_target table_target list_target
+ grandtitle=$1
+ title=$2
+ list=$3
+ listdb=$4
+ pkgnamedb=$5
+ shift 5
+ message_echo "[$grandtitle]"
+ message_echo
+ isfirst=y
+ for origin_target in `pkgsys_eval_ports_glob "$@"`
+ do
+ pkg_target=
+ for table_target in $pkgnamedb
+ do
+ pkg_target=`cat "${DBDIR}/$table_target/$origin_target/pkgtag" 2> /dev/null` || :
+ [ -n "$pkg_target" ] && break
+ done
+ [ -n "$pkg_target" ] || continue
+ [ "$isfirst" = y ] || message_echo
+ isfirst=n
+ [ $opt_batch_mode = no ] && printf "$title\n" "$origin_target ($pkg_target)"
+ list_target=
+ for table_target in $listdb
+ do
+ list_target=${DBDIR}/$table_target/$origin_target/$list
+ [ -e "$list_target" ] && break
+ done
+ [ -e "$list_target" ] || continue
+ cat < $list_target
+ echo
+ done
+ if [ "$isfirst" = y ]
+ then
+ message_echo "ERROR: No inspected port matches the glob(s)." >&2
+ exit 1
+ fi
+ :
+}
+
+# ============= Output of "show" command for two column lists =============
+database_query_show_two_column_lists ()
+{
+ local grandtitle title list listdb pkgnamedb isfirst origin_target pkg_target table_target list_target
+ grandtitle=$1
+ title=$2
+ list=$3
+ listdb=$4
+ pkgnamedb=$5
+ shift 5
+ message_echo "[$grandtitle]"
+ message_echo
+ isfirst=y
+ for origin_target in `pkgsys_eval_ports_glob "$@"`
+ do
+ pkg_target=
+ for table_target in $pkgnamedb
+ do
+ pkg_target=`cat "${DBDIR}/$table_target/$origin_target/pkgtag" 2> /dev/null` || :
+ [ -n "$pkg_target" ] && break
+ done
+ [ -n "$pkg_target" ] || continue
+ [ "$isfirst" = y ] || message_echo
+ isfirst=n
+ [ $opt_batch_mode = no ] && printf "$title\n" "$origin_target ($pkg_target)"
+ list_target=
+ for table_target in $listdb
+ do
+ list_target=${DBDIR}/$table_target/$origin_target/$list
+ [ -e "$list_target" ] && break
+ done
+ [ -e "$list_target" ] || continue
+ if [ $opt_batch_mode = no ]
+ then
+ sed 's/[[:space:]]/: /' < $list_target
+ else
+ cat < $list_target
+ fi
+ done
+ if [ "$isfirst" = y ]
+ then
+ message_echo "ERROR: No inspected port matches the glob(s)." >&2
+ exit 1
+ fi
+ :
+}
+