summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2015-02-22 19:45:31 +0300
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2015-02-22 19:45:31 +0300
commit96304b4e0b27ad31cba3ec59763b5b17daf86185 (patch)
tree564948ea620a13248c59ceb2eabeb574d8c0d228
parentexamples/echo/client.scm.in (print-help): Rename (diff)
downloadguile-ssh-96304b4e0b27ad31cba3ec59763b5b17daf86185.tar.gz
examples/echo/client.scm.in (get-prvkey, main): Simplify checks
-rw-r--r--ChangeLog2
-rw-r--r--examples/echo/client.scm.in13
2 files changed, 7 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 8fe438a..ce0b365 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2015-02-22 Artyom Poptsov <poptsov.artyom@gmail.com>
+ * examples/echo/client.scm.in (get-prvkey, main): Simplify checks.
+
* examples/echo/client.scm.in (print-help): Rename to
`print-help-and-exit'.
(main): Use it. Remove extra checks.
diff --git a/examples/echo/client.scm.in b/examples/echo/client.scm.in
index 761e016..eb4b3f1 100644
--- a/examples/echo/client.scm.in
+++ b/examples/echo/client.scm.in
@@ -86,7 +86,7 @@ Options:
(define (get-prvkey session identity-file)
"Get a private SSH key. Handle possible errors."
(let ((prvkey (private-key-from-file identity-file)))
- (if (not prvkey)
+ (or prvkey
(handle-error session))
prvkey))
@@ -109,10 +109,7 @@ Options:
(help-needed? (option-ref options 'help #f))
(args (option-ref options '() #f)))
- (and (null? args)
- (print-help-and-exit))
-
- (and help-needed?
+ (and (or (null? args) help-needed?)
(print-help-and-exit))
(let* ((host (car args))
@@ -133,12 +130,12 @@ Options:
(let ((private-key (get-prvkey session identity-file)))
- (if (eqv? (userauth-public-key! session private-key) 'error)
- (handle-error session))
+ (and (eqv? (userauth-public-key! session private-key) 'error)
+ (handle-error session))
(let ((channel (make-channel session)))
- (if (not channel)
+ (or channel
(handle-error session))
(channel-open-session channel)