home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
ckscripts
/
netedit
< prev
next >
Wrap
Text File
|
2020-01-01
|
2KB
|
47 lines
; n e t e d i t
;
; Edit a remote file on the local computer. Automatically downloads the file,
; loads into your preferred editor, and uploads the edited result. Use SET
; EDITOR to configure your preferred editor, SHOW EDITOR to show it.
;
; Use NETEDIT when already logged into another computer with Kermit. TAKE
; this file to define the NETEDIT macro (or add the NETEDIT definition to your
; Kermit customization file), and then type "netedit filename" at the local
; Kermit prompt whenever you want to edit a remote file.
;
; Requires C-Kermit 7.0 or Kermit 95 1.1.19 or later.
;
; F. da Cruz, Columbia University, May 2000.
;
def NETEDIT {
local current status
if not \v(local) end 1 No connection ; Works only in local mode
while not defined \%1 { ; Prompt for filename if not given.
ask \%1 { Filename? }
}
asg current \v(directory) ; Save current directory
if def \v(download) cd \v(download) ; CD to download directory
set transfer display brief ; No flourishes
lineout kermit -x ; Start Kermit server on remote
get /text \%1 ; Get the file text mode
if fail end 1 Download failed ; Make sure it worked
edit \%1 ; Edit the file
if fail end 1 Edit failed ; Make sure it worked
if not exist \%1 {
end 1 File "\%1" missing after edit - Did you change its name?
}
send /text \%1 ; Send the edited file back
asg status \v(status) ; Remember SEND return code
finish ; Shut down the remote Kermit server
if = \v(status) 0 { ; If OK delete the file
echo UPLOAD OK.
delete \%1
if success echo Local copy deleted.
} else {
echo UPLOAD FAILED.
echo Edited file retained: \fpathname(\%1)
}
cd \m(current) ; Return to previous directory
end \m(status) ; Done
}