Forbid escaping clic loading with SIGINT - clic - Clic is an command line inter… | |
git clone git://bitreich.org/clic/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
LICENSE | |
--- | |
commit 22248dc9ab2895d7bcf8b3bcfcf76eb48ecc075f | |
parent be4bf91b222d03b0de1c9c83ab2afccbfa41dc28 | |
Author: Solene Rapenne <[email protected]> | |
Date: Thu, 21 Jun 2018 11:05:17 +0200 | |
Forbid escaping clic loading with SIGINT | |
Diffstat: | |
M clic.lisp | 12 ++++++++---- | |
M make-binary.lisp | 6 +++++- | |
2 files changed, 13 insertions(+), 5 deletions(-) | |
--- | |
diff --git a/clic.lisp b/clic.lisp | |
@@ -571,10 +571,8 @@ | |
;; split and ask to scroll or to type a command | |
(when (= row rows) | |
(setf row 0) | |
- (format t "~a~a press enter or a shell command ~a : " | |
- (get-color 'bg-black) | |
- (if *kiosk-mode* "KIOSK" "") | |
- (get-color 'reset)) | |
+ (format t "~a press enter or a shell command: " | |
+ (if *kiosk-mode* "KIOSK" "")) | |
(force-output) | |
(let ((first-input (read-char *standard-input* nil nil t))) | |
(cond | |
@@ -735,7 +733,13 @@ | |
with a parameter not of type 1, so it will fetch the content, | |
display it and exit and finally, the redirected case where clic will | |
print to stdout and exit." | |
+ | |
+ ;; pledge support on OpenBSD | |
(c-pledge) | |
+ | |
+ ;; re-enable SIGINT (Ctrl+C) disabled for loading clic | |
+ (ext:set-signal-handler ext:+sigint+ 'quit) | |
+ | |
(ignore-errors ;; lisp is magic | |
(let ((destination (car (last | |
(loop for element in (get-argv) | |
diff --git a/make-binary.lisp b/make-binary.lisp | |
@@ -7,7 +7,11 @@ | |
#+ecl | |
(progn | |
(compile-file "clic.lisp" :system-p t) | |
- (c:build-program "clic" :epilogue-code '(progn (handler-case (main) (condit… | |
+ (c:build-program "clic" | |
+ :prologue-code '(ext:set-signal-handler ext:+sigint+ nil) | |
+ :epilogue-code '(progn (handler-case (main) | |
+ (condition () (quit)))) | |
+ :lisp-files '("clic.o"))) | |
(format t "INFO => Compilation done (or at least it should be)~%") | |
(quit) |