File: code.yaws

package info (click to toggle)
yaws 1.65-4etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 4,164 kB
  • ctags: 3,907
  • sloc: erlang: 20,138; sh: 3,675; makefile: 556; ansic: 404; lisp: 79
file content (29 lines) | stat: -rw-r--r-- 522 bytes parent folder | download | duplicates (2)
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

<erl>

out(A) -> 
    {Code, F} = case queryvar(A, "file") of
		    {ok, Fname} ->
			File = A#arg.docroot ++ 
			    yaws_api:sanitize_file_name(Fname),
			error_logger:format("File =~p~n", [File]),
			case file:read_file(File) of
			    {ok, B} ->
				C = {'div', 
				     [],
				     {pre, [], B}},
				{C, Fname};
			    _ ->
				{[], "Can't read " ++ Fname }
			end;
		    undefined ->
			{[], "Bad request"}
		end,
    {ehtml, {html, [],
	     {'div', 
	      [],
	      [{h2, [], F}, 
	       Code]}}}.


</erl>