#!/bin/echo Source me: .
#
# Copyright (c) 2002-2004 by Frederick Bruckman
# All rights reserved.

# Fill out inter-dependencies, as requested, of contents of first
# argument, no recursion. Emits <category>/<subdirectory> pairs to
# standard out.
#
fill_out_Dd () {
	if [ -n "$Flag_D" ]
		then D_FILE="${PKGORDERDIR}"/dir_to_dependents
	fi
	if [ -n "$Flag_d" ]
		then d_FILE="${PKGORDERDIR}"/dir_to_dependencies
	fi
	awk '
		FNR == NR {
			startdirs[$1] = 0
			alldirs[$1] = 0
			next
		}
		{
			if ($1 in startdirs)
				for (i = 2; i <= NF; i++)
					alldirs[$i] = 0
		}
		END {
			for (p in alldirs)
				print p
		}
	' "$1" "$D_FILE" "$d_FILE"
}
