Introduction
Introduction Statistics Contact Development Disclaimer Help
add pledge support - clic - Clic is an command line interactive client for goph…
git clone git://bitreich.org/clic/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65…
Log
Files
Refs
Tags
README
LICENSE
---
commit 2f63cd38c68eee0baa1493d432a295f4009136af
parent fd42b4e1718565c5bc2f411e3fd4e120ca2dbd97
Author: Solene Rapenne <[email protected]>
Date: Thu, 21 Jun 2018 10:41:00 +0200
add pledge support
Diffstat:
M clic.lisp | 33 +++++++++++++++++++++--------…
1 file changed, 22 insertions(+), 11 deletions(-)
---
diff --git a/clic.lisp b/clic.lisp
@@ -11,12 +11,22 @@
#include <sys/ioctl.h>
#include <limits.h>
#include <unistd.h>
+
+ #ifdef __OpenBSD__
+ void gotoPledge() {
+ pledge(\"dns inet stdio rpath tty wpath cpath proc exec\",NULL);
+ }
+ #endif
+
int ttyPredicate() {
return isatty(fileno(stdout)); }
unsigned int getTerminalHeight() {
struct winsize w;
return ioctl(1,TIOCGWINSZ,&w)<0?UINT_MAX:w.ws_row;}")
(ffi:def-function
+ ("gotoPledge" c-pledge)
+ () :returning :void)
+ (ffi:def-function
("getTerminalHeight" c-termsize)
() :returning :unsigned-int)
(ffi:def-function
@@ -717,8 +727,7 @@
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."
-
- (clear)
+ (c-pledge)
(ignore-errors ;; lisp is magic
(let ((destination (car (last
(loop for element in (get-argv)
@@ -730,15 +739,17 @@
;; is there an output redirection ?
(if (ttyp)
- ;; if we don't ask a menu, not going interactive
- (if (not (string= "1" (location-type destination)))
- ;; not interactive
- (visit destination)
- ;; if user want to drop from first page we need
- ;; to look it here
- (when (not (eq 'end (visit destination)))
- ;; we continue to the shell if we are in a terminal
- (shell)))
+ (progn
+ (clear)
+ ;; if we don't ask a menu, not going interactive
+ (if (not (string= "1" (location-type destination)))
+ ;; not interactive
+ (visit destination)
+ ;; if user want to drop from first page we need
+ ;; to look it here
+ (when (not (eq 'end (visit destination)))
+ ;; we continue to the shell if we are in a terminal
+ (shell))))
(pipe-to-stdout destination)))))
;; we allow ecl to use a new kind of argument
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.