mirror of
https://github.com/hymkor/lispect.git
synced 2026-09-03 15:47:51 -04:00
README: reflect changes of example.lsp
This commit is contained in:
@@ -18,21 +18,21 @@ $ `lispect example.lsp USERNAME@DOMAIN PASSWORD`
|
|||||||
> Some variable names have been updated for compatibility with recent versions of gmnlisp, but the old names remain available for now.
|
> Some variable names have been updated for compatibility with recent versions of gmnlisp, but the old names remain available for now.
|
||||||
|
|
||||||
```example.lsp
|
```example.lsp
|
||||||
(catch 'fail
|
(block main
|
||||||
(if (< (length ARGV) 2)
|
(if (< (length *argv*) 2)
|
||||||
(progn
|
(progn
|
||||||
(format (error-output) "Usage: ~A ~A USERNAME@DOMAIN PASSWORD~%" *executable-name* *program-name*)
|
(format (error-output) "Usage: ~A ~A {SSH-OPTIONS} USERNAME@DOMAIN PASSWORD~%" *executable-name* *program-name*)
|
||||||
(throw 'fail nil)))
|
(return-from main nil)))
|
||||||
|
|
||||||
(let ((account (car *argv*))
|
(let* ((ssh-param (subseq *argv* 0 (- (length *argv*) 1)))
|
||||||
(password (cadr *argv*))
|
(password (elt *argv* (- (length *argv*) 1)))
|
||||||
(sshpid nil))
|
(sshpid nil))
|
||||||
|
|
||||||
(with-handler
|
(with-handler
|
||||||
(lambda (c)
|
(lambda (c)
|
||||||
(format (error-output) "ssh is not found~%")
|
(format (error-output) "ssh is not found~%")
|
||||||
(throw 'fail nil))
|
(return-from main nil))
|
||||||
(setq sshpid (spawn "ssh" account)))
|
(setq sshpid (apply #'spawn "ssh" ssh-param)))
|
||||||
|
|
||||||
(expect*
|
(expect*
|
||||||
("[fingerprint])?"
|
("[fingerprint])?"
|
||||||
@@ -43,17 +43,17 @@ $ `lispect example.lsp USERNAME@DOMAIN PASSWORD`
|
|||||||
(sendln password))
|
(sendln password))
|
||||||
(("Connection refused"
|
(("Connection refused"
|
||||||
"Could not resolve hostname")
|
"Could not resolve hostname")
|
||||||
(throw 'fail nil))
|
(return-from main nil))
|
||||||
(30
|
(30
|
||||||
(format (error-output) "TIME OUT~%")
|
(format (error-output) "TIME OUT~%")
|
||||||
(throw 'fail nil)))
|
(return-from main nil)))
|
||||||
|
|
||||||
(expect*
|
(expect*
|
||||||
("Permission denied"
|
("Permission denied"
|
||||||
(expect "password:")
|
(expect "password:")
|
||||||
(send #\U3)
|
(send #\U3)
|
||||||
(wait sshpid)
|
(wait sshpid)
|
||||||
(throw 'fail nil)
|
(return-from main nil)
|
||||||
)
|
)
|
||||||
("$ "))
|
("$ "))
|
||||||
(sendln "echo YOU CAN CALL SOME COMMAND HERE")
|
(sendln "echo YOU CAN CALL SOME COMMAND HERE")
|
||||||
|
|||||||
Reference in New Issue
Block a user