This file is indexed.

/usr/lib/basename.scm is in scheme9 2013.11.26-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
; Scheme 9 from Empty Space, Function Library
; By Nils M Holm, 2010
; Placed in the Public Domain
;
; (basename string)          ==>  string
; (basename string string2)  ==>  string
;
; Return the rightmost component of the path name given in STRING.
; When STRING2 is given also remove a STRING2 suffix (if any) from
; STRING.
; 
; Example:   (basename "/foo/bar/baz")     ==>  "baz"
;            (basename "/goo/bar.Z" ".Z")  ==>  "bar"

(load-from-library "string-split.scm")

(define (basename path . suffix)
  (let ((base (car (reverse! (string-split #\/ path)))))
    (if (null? suffix)
        base
        (let ((k  (string-length base))
              (ks (string-length (car suffix))))
          (if (and (> k ks)
                   (string=? (car suffix)
                             (substring base (- k ks) k)))
              (substring base 0 (- k ks))
              base)))))