blob: d18368de95ef4b13f21e10b00e11e6f07ba719f5 (
plain)
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
|
<?guile
;;;; Greek Dictionary Web Engine
;;;; Copyright (C) 2006, 2007 Sergey Poznyakoff
;;;;
;;;; 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 3 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, see <http://www.gnu.org/licenses/>.
;;;;
(define ellinika-document-root "/home/gray/public_html/ellinika")
(define ellinika-dispatcher "disp.html")
(define (get-file-name)
(call-with-current-continuation
(lambda (return)
(for-each
(lambda (lang)
(let loop ((slang lang)
(suff (list #\. #\_)))
(let ((dir (string-append ellinika-document-root "/" slang)))
(cond
((access? (string-append dir "/index.html") R_OK)
(return (string-append dir "/index.html")))
((not (null? suff))
(let ((p (let itr ((sl suff))
(if (null? sl)
#f
(let ((x (string-split slang (car sl))))
(if (null? (cdr x))
(itr (cdr sl))
(cons (car x) (cdr sl))))))))
(if p
(loop (car p) (cdr p)))))))))
(map
(lambda (s)
(cond
((string-split s #\;) =>
(lambda (l)
(car l)))
(else
s)))
(string-split
(or (table:get (request-rec:subprocess-env Request) "HTTP_ACCEPT_LANGUAGE")
"")
#\,)))
(string-append ellinika-document-root "/" ellinika-dispatcher))))
(with-input-from-file
(get-file-name)
(lambda ()
(do ((line (read-line) (read-line)))
((eof-object? line))
(display line)
(newline))))
?>
|