5 Cent tip for today [ SlimLine Newlisp ]

Featuring the Dragonfly web framework
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

5 Cent tip for today [ SlimLine Newlisp ]

Post by newdep »

A small trick to SlimLine Newlisp during startup.
(thanks to "Lutz" for the 'constant tip instead of 'cpymem)

;;
;; SlimLine Newlisp.
;;
;; To be used for i.e. a more secure newlisp.
;;
;; Removes all "network" "file-io" "system" access functions from current context 'MAIN in newlisp
;; and replaces them with a warning message.
;;
;; Executed from interactive mode you'll have the "press enter to return!"
;; else remove the text line.
;;
;;
;;
;; Enjoy, Norman
;;

(define (default-message) (silent (println "Removed from newLisp, press enter to return!" )))

(dolist ( x '( "dump" "cpymem" "!" "exec" "fork" "pipe" "process" "wait-pid" "close" "command-line" "current-line"
"device" "exec" "get-url" "load" "open" "post-url" "put-url" "read-buffer" "read-char"
"read-file" "read-line" "save" "search" "seek" "write-buffer" "write-char" "write-file" "write-line"
"change-dir" "copy-file" "delete-file" "directory" "file-info" "make-dir" "remove-dir" "rename-file"
"trace" "putenv" "getenv" "import" "file?" "env" "directory?" "net-accept" "net-close" "net-connect"
"net-error" "net-listen" "net-local" "net-lookup" "net-peer" "net-peek" "net-receive" "net-receive-from"
"net-receive-udp" "net-select" "net-send" "net-send-to" "net-send-udp" "net-service" "net-sessions"))
(constant (symbol x) default-message))
-- (define? (Cornflakes))

Locked