#!/bin/sh 
#
#   vnames [path]
#
#   lists all files in path (or cwd) with all directory components
#

trap "exit 2" 2		# interrupts cause us to exit quickly

#
# check arguments
#

if [ $# -gt 1 ]
then
	echo wrong number of arguments\(${#}\) to $0
	echo usage: $0 [ path ]
	exit 1
else
	if [ $# -eq 1 ]
	then
		dir=$1
	else
		dir=.
	fi
fi

if [ "`ls "$dir"`" = "" ]	# empty directory?
then
	echo "$dir"
else
	for file in "$dir"/*
	do
		if [ -L "$file" -o ! -d "$file" ]	# link, or file?
		then
			echo "$file"
		else								# it's a directory
			"$0" "$file"
		fi
	done
fi
exit 0

