Introduction
Introduction Statistics Contact Development Disclaimer Help
Fix a crash when downloading binary - clic - Clic is an command line interactiv…
git clone git://bitreich.org/clic/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65…
Log
Files
Refs
Tags
README
LICENSE
---
commit d07922a2554fc78ba5efe7e9818e4cb7fbfd6938
parent 02fda5b5bc6564db46dde5a1a2e2f5e71a75321d
Author: Solene Rapenne <[email protected]>
Date: Tue, 2 Jan 2018 10:22:35 +0100
Fix a crash when downloading binary
Diffstat:
M clic.lisp | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/clic.lisp b/clic.lisp
@@ -274,15 +274,19 @@
;; not terminal = write to stdio
(if (ttyp)
;; save into a file in /tmp
- (let ((filename (subseq uri (1+ (position #\/ uri :from-end t)))…
- (with-open-file (output (concatenate 'string "/tmp/" filename)
+ (let* ((filename (subseq uri (1+ (position #\/ uri :from-end t))…
+ (path (concatenate 'string "/tmp/" filename)))
+ (with-open-file (output path
:element-type '(unsigned-byte 8)
:direction :output :if-exists :superse…
(let ((buf (make-array 4096 :element-type '(unsigned-byte 8)…
(loop for pos = (read-sequence buf stream)
while (plusp pos)
do
- (write-sequence buf output :end pos)))))
+ (format t ".")
+ (force-output)
+ (write-sequence buf output :end pos)))
+ (format t "~%File downloaded into ~a (~a bytes)~%" path (fil…
;; write to the standard output
(let ((buf (make-array 4096 :element-type '(unsigned-byte 8))))
@@ -474,9 +478,10 @@
:output :interactive))
;; display last menu
(pop *history*)
- (setf *buffer* (copy-array *previous-buffer*))
- (setf *links* (make-hash-table))
- (display-buffer "1")))
+ (when *previous-buffer*
+ (setf *buffer* (copy-array *previous-buffer*))
+ (setf *links* (make-hash-table))
+ (display-buffer "1"))))
;; image
((or
@@ -492,9 +497,10 @@
(location-uri l…
:from-end t))))…
(pop *history*)
- (setf *buffer* (copy-array *previous-buffer*))
- (setf *links* (make-hash-table))
- (display-buffer "1"))
+ (when *previous-buffer*
+ (setf *buffer* (copy-array *previous-buffer*))
+ (setf *links* (make-hash-table))
+ (display-buffer "1")))
;;;; output is a menu ?
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.