#!/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
#  
#  
# Licensed Materials - Property of IBM 
#  
# (C) COPYRIGHT International Business Machines Corp. 2002,2004 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 

#############################################################################
#
# Usage:  tslistall <pathname> [<tmpdirname>]
#
#############################################################################

# Verify caller provided the pathname
if [[ $# -lt 1 ]]
then 
    print -u2 "Usage: $0 pathname [<tmpdirname>]";
    exit 1;
fi
path="$1"
tmpdir=${2:-"/tmp"}

# Generate a temporary file name

tmpFile1="$tmpdir/tssave".$$."a"

# Read the directory structure and sort it into the tmp file
tsreaddir "$path" | sort -T "$tmpdir" > "$tmpFile1" || exit

# Get the file's mtime/ctime and merge it with the file names
# note: tab character between the quotes
tstimes "$path" | join -t'	' - "$tmpFile1"

# Save return code and delete the temp file before returning
rc=$?
rm -f "$tmpFile1"
exit $rc
