r10608: update license
[uffi.git] / examples / getshells.lisp
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          getshells.cl
6 ;;;; Purpose:       UFFI Example file to get lisp of legal shells
7 ;;;; Programmer:    Kevin M. Rosenberg
8 ;;;; Date Started:  Mar 2002
9 ;;;;
10 ;;;; $Id$
11 ;;;;
12 ;;;; This file, part of UFFI, is Copyright (c) 2002-2005 by Kevin M. Rosenberg
13 ;;;;
14 ;;;; *************************************************************************
15
16 (in-package :cl-user)
17
18
19 (uffi:def-function "setusershell"
20     nil
21   :returning :void)
22
23 (uffi:def-function "endusershell"
24     nil
25   :returning :void)
26
27 (uffi:def-function "getusershell"
28     nil
29   :returning :cstring)
30
31 (defun getshells ()
32   "Returns list of valid shells"
33   (setusershell)
34   (let (shells)
35     (do ((shell (uffi:convert-from-cstring (getusershell))
36                 (uffi:convert-from-cstring (getusershell))))
37         ((null shell))
38       (push shell shells))
39     (endusershell)
40     (nreverse shells)))
41
42 #+examples-uffi
43 (format t "~&Shells: ~S" (getshells))
44