iadd pledge support - clic - Clic is an command line interactive client for gopher written in Common LISP Err bitreich.org 70 hgit clone git://bitreich.org/clic/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/clic/ URL:git://bitreich.org/clic/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/clic/ bitreich.org 70 1Log /scm/clic/log.gph bitreich.org 70 1Files /scm/clic/files.gph bitreich.org 70 1Refs /scm/clic/refs.gph bitreich.org 70 1Tags /scm/clic/tag bitreich.org 70 1README /scm/clic/file/README.md.gph bitreich.org 70 1LICENSE /scm/clic/file/LICENSE.gph bitreich.org 70 i--- Err bitreich.org 70 1commit 2f63cd38c68eee0baa1493d432a295f4009136af /scm/clic/commit/2f63cd38c68eee0baa1493d432a295f4009136af.gph bitreich.org 70 1parent fd42b4e1718565c5bc2f411e3fd4e120ca2dbd97 /scm/clic/commit/fd42b4e1718565c5bc2f411e3fd4e120ca2dbd97.gph bitreich.org 70 hAuthor: Solene Rapenne URL:mailto:solene@perso.pw bitreich.org 70 iDate: Thu, 21 Jun 2018 10:41:00 +0200 Err bitreich.org 70 i Err bitreich.org 70 iadd pledge support Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M clic.lisp | 33 +++++++++++++++++++++----------- Err bitreich.org 70 i Err bitreich.org 70 i1 file changed, 22 insertions(+), 11 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/clic.lisp b/clic.lisp /scm/clic/file/clic.lisp.gph bitreich.org 70 i@@ -11,12 +11,22 @@ Err bitreich.org 70 i #include Err bitreich.org 70 i #include Err bitreich.org 70 i #include Err bitreich.org 70 i+ Err bitreich.org 70 i+ #ifdef __OpenBSD__ Err bitreich.org 70 i+ void gotoPledge() { Err bitreich.org 70 i+ pledge(\"dns inet stdio rpath tty wpath cpath proc exec\",NULL); Err bitreich.org 70 i+ } Err bitreich.org 70 i+ #endif Err bitreich.org 70 i+ Err bitreich.org 70 i int ttyPredicate() { Err bitreich.org 70 i return isatty(fileno(stdout)); } Err bitreich.org 70 i unsigned int getTerminalHeight() { Err bitreich.org 70 i struct winsize w; Err bitreich.org 70 i return ioctl(1,TIOCGWINSZ,&w)<0?UINT_MAX:w.ws_row;}") Err bitreich.org 70 i (ffi:def-function Err bitreich.org 70 i+ ("gotoPledge" c-pledge) Err bitreich.org 70 i+ () :returning :void) Err bitreich.org 70 i+ (ffi:def-function Err bitreich.org 70 i ("getTerminalHeight" c-termsize) Err bitreich.org 70 i () :returning :unsigned-int) Err bitreich.org 70 i (ffi:def-function Err bitreich.org 70 i@@ -717,8 +727,7 @@ Err bitreich.org 70 i with a parameter not of type 1, so it will fetch the content, Err bitreich.org 70 i display it and exit and finally, the redirected case where clic will Err bitreich.org 70 i print to stdout and exit." Err bitreich.org 70 i- Err bitreich.org 70 i- (clear) Err bitreich.org 70 i+ (c-pledge) Err bitreich.org 70 i (ignore-errors ;; lisp is magic Err bitreich.org 70 i (let ((destination (car (last Err bitreich.org 70 i (loop for element in (get-argv) Err bitreich.org 70 i@@ -730,15 +739,17 @@ Err bitreich.org 70 i Err bitreich.org 70 i ;; is there an output redirection ? Err bitreich.org 70 i (if (ttyp) Err bitreich.org 70 i- ;; if we don't ask a menu, not going interactive Err bitreich.org 70 i- (if (not (string= "1" (location-type destination))) Err bitreich.org 70 i- ;; not interactive Err bitreich.org 70 i- (visit destination) Err bitreich.org 70 i- ;; if user want to drop from first page we need Err bitreich.org 70 i- ;; to look it here Err bitreich.org 70 i- (when (not (eq 'end (visit destination))) Err bitreich.org 70 i- ;; we continue to the shell if we are in a terminal Err bitreich.org 70 i- (shell))) Err bitreich.org 70 i+ (progn Err bitreich.org 70 i+ (clear) Err bitreich.org 70 i+ ;; if we don't ask a menu, not going interactive Err bitreich.org 70 i+ (if (not (string= "1" (location-type destination))) Err bitreich.org 70 i+ ;; not interactive Err bitreich.org 70 i+ (visit destination) Err bitreich.org 70 i+ ;; if user want to drop from first page we need Err bitreich.org 70 i+ ;; to look it here Err bitreich.org 70 i+ (when (not (eq 'end (visit destination))) Err bitreich.org 70 i+ ;; we continue to the shell if we are in a terminal Err bitreich.org 70 i+ (shell)))) Err bitreich.org 70 i (pipe-to-stdout destination))))) Err bitreich.org 70 i Err bitreich.org 70 i ;; we allow ecl to use a new kind of argument Err bitreich.org 70 .