X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=examples%2Fgetshells.lisp;fp=examples%2Fgetshells.lisp;h=1b05d1009d1e4bcc06beebd69cf5a887719f338f;hb=a95b9a217335917d96b8c0cced4f49c3e4846115;hp=0000000000000000000000000000000000000000;hpb=bcd9fb3deb580f2976e7505a7433795ed6ad1bb3;p=uffi.git diff --git a/examples/getshells.lisp b/examples/getshells.lisp new file mode 100644 index 0000000..1b05d10 --- /dev/null +++ b/examples/getshells.lisp @@ -0,0 +1,47 @@ +;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION +;;;; +;;;; Name: getshells.cl +;;;; Purpose: UFFI Example file to get lisp of legal shells +;;;; Programmer: Kevin M. Rosenberg +;;;; Date Started: Mar 2002 +;;;; +;;;; $Id: getshells.lisp,v 1.1 2002/09/30 10:02:36 kevin Exp $ +;;;; +;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg +;;;; +;;;; UFFI users are granted the rights to distribute and use this software +;;;; as governed by the terms of the Lisp Lesser GNU Public License +;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. +;;;; ************************************************************************* + +(in-package :cl-user) + + +(uffi:def-function "setusershell" + nil + :returning :void) + +(uffi:def-function "endusershell" + nil + :returning :void) + +(uffi:def-function "getusershell" + nil + :returning :cstring) + +(defun getshells () + "Returns list of valid shells" + (setusershell) + (let (shells) + (do ((shell (uffi:convert-from-cstring (getusershell)) + (uffi:convert-from-cstring (getusershell)))) + ((null shell)) + (push shell shells)) + (endusershell) + (nreverse shells))) + +#+examples-uffi +(format t "~&Shells: ~S" (getshells)) +