/*
** List-Dir.ced
**
** $VER: List-Dir.ced 1.0.2 (2.6.93)
**
** This script lists the contents of a given directory.
**
** This script requires CygnusEd Professional v3.5 (or later) to run.
**
** Copyright © 1990-1993 ASDG, Incorporated  All Rights Reserved
*/


OPTIONS RESULTS

NL = '0A'X
TempFile = "T:TempCEDFile.1"
SortFile = "T:TempCEDFile.2"

STATUS CURRENTDIR
GETDIRNAME RESULT '"List What Directory?"'
Directory = RESULT
IF (Directory = "") | (Directory = "RESULT") THEN
	EXIT 0

String = "List >" TempFile Directory
ADDRESS COMMAND String

JUMP TO FILE TempFile
IF (RESULT = 1) THEN
	QUIT 1

OPEN NEW
OPEN TempFile
DELETE LINE
"END OF FILE"
UP
DELETE LINE
SAVE

ADDRESS COMMAND "Sort" TempFile SortFile
ADDRESS COMMAND "Delete" ">nil:" TempFile

JUMP TO FILE SortFile
IF (RESULT = 1) THEN
	QUIT 1

OPEN SortFile

STATUS EDITABLE
IF (RESULT = 1) THEN
	EDITABLE FILE

ADDRESS COMMAND "Delete" ">nil:" SortFile

EXIT 0
