This is the mail archive of the
cgen@sourceware.org
mailing list for the CGEN project.
Re: [patch][commit] Location of (include file)
- From: Thien-Thi Nguyen <ttn at glug dot org>
- To: brolley at redhat dot com
- Cc: cgen at sources dot redhat dot com
- Date: Tue, 09 May 2006 18:01:03 -0400
- Subject: Re: [patch][commit] Location of (include file)
- References: <4460C206.9080103@redhat.com> <4460DDCA.7080001@redhat.com>
- Reply-to: ttn at glug dot org
From: Dave Brolley <brolley@redhat.com>
Date: Tue, 09 May 2006 14:22:02 -0400
+ ; Return the directory name of the given file name
+
+ (define (dirname s)
+ (let loop ((i (string-length s)))
+ (cond ((= i 0) "")
+ ((char=? #\/ (string-ref s (- i 1))) (substring s 0 i))
+ (else (loop (- i 1)))))
+ )
+
guile> (version)
"1.4.1.107"
guile> (dirname "/etc/hosts")
"/etc"
guile> dirname
#<primitive-procedure dirname>
thi