! script name: contrib/ascript/tsm.d/editfile
! topic: edit a file
! Version_270423.a

!A
!A NAME:
!A
!A      Edit File
!A
!A DESCRIPTION:
!A
!A      This script allows a file to be edited.  The file name can be
!A      passed into the script or just an editor can be brought up

stat=ChangeLabelStr("ScriptNameStatus","Function: edit file ")

DIM Destination$[256]
DIM Answer$[256]
DIM File_name$[256]
DIM Editor$[256]

Stat= NamedVarStr("file editor",WsSystemVars,"notepad.exe",Editor$)
Flip_file= NamedVarVal("flip crlf",WsSystemVars,0)

IF ARGC>1 THEN
        File_name$= ARGV(1)
ELSE
        File_name$= ""
END IF

Stat=EditFile(Editor$,File_name$,Flip_file,WsFalse)

Leave:!
IF NOT LEN(Destination$) THEN
         LOAD "typecontrol"
ELSE
         LOAD Destination$
END IF
END
