This file is indexed.

/usr/share/gEDA/scheme/geda/os.scm is in libgeda-common 1:1.8.2-4.

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
;; gEDA - GPL Electronic Design Automation
;; libgeda - gEDA's library - Scheme API
;; Copyright (C) 2011 Peter Brett <peter@peter-b.co.uk>
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
;;

(define-module (geda os)

  ; Import C procedures and variables
  #:use-module (geda core os)

  #:use-module (srfi srfi-1)

  #:use-module (ice-9 regex))

(define-public platform %platform)

(define-public (platform? x)
  (member x (platform)))

(define-public separator-char
  (if (platform? 'win32-native) #\\ #\/))

(define-public separator (string separator-char))

(define-public path-separator-char
  (if (platform? 'win32-native) #\; #\:))

(define-public path-separator (string path-separator-char))

(define-public separator-char?
  (if (platform? 'win32-native)
      (let ((cls (char-set #\\ #\/)))
        (lambda (x) (char-set-contains? cls x)))
      (lambda (x) (eq? separator-char x))))

(define-public (sys-data-dirs)
  (list (getenv "GEDADATA")))

(define-public (sys-config-dirs)
  (list (getenv "GEDADATARC")))

(define-public (user-data-dir)
  (string-join (list (getenv "HOME") ".gEDA") separator))

(define-public user-config-dir user-data-dir)

(define-public expand-env-variables
  ;; Only compile regular expression once
  (let ((rx (make-regexp "\\$\\{(\\w*)\\}")))
    ;; This is the actual expand-env-variables function -- it's a
    ;; closure around rx.
    (lambda (str)
      ;; Returns result of expanding the environment variable name
      ;; found in match, or "".
      (define (match-getenv m)
        (or (getenv (match:substring m 1)) ""))
      ;; Carries out a single round of environment variable expansion
      ;; on str
      (define (expand-once str)
        (regexp-substitute/global #f rx str 'pre match-getenv 'post))
      ;; Tail-recursively expands str until no more environment variables
      ;; can be expanded.
      (let ((result (expand-once str)))
        (if (string=? str result)
            result
            (expand-env-variables result))))))