9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
;; PURPOSE.
;;======================================================================
;;======================================================================
;; Config file handling
;;======================================================================
(use regex regex-case)
(declare (unit configf))
(declare (uses common))
(declare (uses process))
(include "common_records.scm")
;; return list (path fullpath configname)
|
|
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
;; PURPOSE.
;;======================================================================
;;======================================================================
;; Config file handling
;;======================================================================
(use regex regex-case directory-utils)
(declare (unit configf))
(declare (uses common))
(declare (uses process))
(include "common_records.scm")
;; return list (path fullpath configname)
|
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
(close-input-port inp)
(hash-table-delete! res "") ;; we are using "" as a dumping ground and must remove it before returning the ht
res)
(regex-case
inl
(configf:comment-rx _ (loop (configf:read-line inp res allow-system) curr-section-name #f #f))
(configf:blank-l-rx _ (loop (configf:read-line inp res allow-system) curr-section-name #f #f))
(configf:include-rx ( x include-file ) (let ((curr-dir (current-directory))
(conf-dir (pathname-directory path)))
(if conf-dir (change-directory conf-dir))
(read-config include-file res allow-system environ-patt: environ-patt curr-section: curr-section-name sections: sections)
(change-directory curr-dir)
(loop (configf:read-line inp res allow-system) curr-section-name #f #f)))
(configf:section-rx ( x section-name ) (loop (configf:read-line inp res allow-system)
;; if we have the sections list then force all settings into "" and delete it later?
(if (or (not sections)
(member section-name sections))
section-name "") ;; stick everything into ""
#f #f))
(configf:key-sys-pr ( x key cmd ) (if allow-system
|
|
>
|
>
|
|
|
|
>
>
>
|
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
(close-input-port inp)
(hash-table-delete! res "") ;; we are using "" as a dumping ground and must remove it before returning the ht
res)
(regex-case
inl
(configf:comment-rx _ (loop (configf:read-line inp res allow-system) curr-section-name #f #f))
(configf:blank-l-rx _ (loop (configf:read-line inp res allow-system) curr-section-name #f #f))
(configf:include-rx ( x include-file ) (if (file-exists? include-file)
(let ((curr-dir (current-directory))
(conf-dir (pathname-directory include-file))
(incfname (pathname-strip-directory include-file)))
(push-directory conf-dir)
(read-config incfname res allow-system environ-patt: environ-patt curr-section: curr-section-name sections: sections)
(pop-directory)
(loop (configf:read-line inp res allow-system) curr-section-name #f #f))
(begin
(debug:print 0 "INFO: include file " include-file " not found (called from " path ")")
(loop (configf:read-line inp res allow-system) curr-section-name #f #f))))
(configf:section-rx ( x section-name ) (loop (configf:read-line inp res allow-system)
;; if we have the sections list then force all settings into "" and delete it later?
(if (or (not sections)
(member section-name sections))
section-name "") ;; stick everything into ""
#f #f))
(configf:key-sys-pr ( x key cmd ) (if allow-system
|