Subversion Repositories Koakuma

Rev

Rev 3 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 nishi 1
#!/usr/bin/env tclsh
2
# $Id$
3
 
4
set KOAKUMA_VERSION "1.00"
5
set components ""
6
 
7
proc exiting {code} {
8
	exit $code
9
}
10
 
11
proc crash {reason} {
12
	global components KOAKUMA_VERSION
13
	puts stderr "----- Start Koakuma Crash dump log -----"
14
	puts stderr "Included components:"
15
	foreach {name description version} $components {
16
		puts stderr "	$name: $description, version $version"
17
	}
18
	puts stderr "Reason: $reason"
19
	puts stderr "----- End Koakuma Crash dump log -----"
20
	puts	"Content-Type: text/html"
21
	puts	"Status: 500 Internal Server Error"
22
	puts	""
23
	puts	"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">"
24
	puts	"<html>"
25
	puts	"	<head>"
26
	puts	"		<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">"
27
	puts	"		<title>Oops</title>"
28
	puts	"	</head>"
29
	puts	"	<body>"
30
	puts	"		<h1>Oops</h1>"
31
	puts	"		<hr>"
32
	puts	"		Koakuma version $KOAKUMA_VERSION crashed, reason: <code>$reason</code><br>"
33
	puts	"		See the server error log for details."
34
	puts	"	</body>"
35
	puts	"</html>"
36
	exiting 1
37
}
38
 
39
foreach path [glob @@PREFIX@@/lib/koakuma/components/*.tcl] {
40
	source "$path"
41
}
42
 
43
proc start_html {title} {
44
	puts	"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"
45
	puts	"<html>"
46
	puts	"	<head>"
47
	puts	"		<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">"
48
	puts	"		<title>$title - Koakuma</title>"
49
	puts	"	</head>"
50
	puts	"	<body>"
51
}
52
proc end_html {} {
53
	puts	"	</body>"
54
	puts	"</html>"
55
}