Remove old CVS $Id$ keyword
[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 ;;;; This file, part of UFFI, is Copyright (c) 2002-2010 by Kevin M. Rosenberg
11 ;;;;
12 ;;;; *************************************************************************
13
14 (in-package :cl-user)
15
16
17 (uffi:def-function "setusershell"
18     nil
19   :returning :void)
20
21 (uffi:def-function "endusershell"
22     nil
23   :returning :void)
24
25 (uffi:def-function "getusershell"
26     nil
27   :returning :cstring)
28
29 (defun getshells ()
30   "Returns list of valid shells"
31   (setusershell)
32   (let (shells)
33     (do ((shell (uffi:convert-from-cstring (getusershell))
34                 (uffi:convert-from-cstring (getusershell))))
35         ((null shell))
36       (push shell shells))
37     (endusershell)
38     (nreverse shells)))
39
40 #+examples-uffi
41 (format t "~&Shells: ~S" (getshells))
42