aboutsummaryrefslogtreecommitdiff
path: root/index.scml
blob: 0201d5b5114d54d351c96c8c72b2b45e61698380 (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
67
68
69
70
<?guile
;;;; Greek Dictionary Web Engine
;;;; Copyright (C) 2006 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 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-1307, USA.
;;;;

(define ellinika-document-root "/home/gray/public_html/ellinika")
(define ellinika-default-language "ru")

(define (get-dir-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
	     ((catch 'system-error
		     (lambda ()
		       (eq? (stat:type (stat dir)) 'directory))
		     (lambda args
		       #f))
	      (return dir))
	     ((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 
	(table:get (request-rec:subprocess-env Request) "HTTP_ACCEPT_LANGUAGE")
	#\,)))
     (string-append ellinika-document-root "/" ellinika-default-language))))

(with-input-from-file
    (string-append (get-dir-name) "/intro.html")
  (lambda ()
    (do ((line (read-line) (read-line)))
	((eof-object? line))
      (display line)
      (newline))))

?>

Return to:

Send suggestions and report system problems to the System administrator.