Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

59 lines (48 sloc) 1.6 kb
<erl>
prebox(Str) ->
{'div',[{class,"man"}],
{pre,[], yaws_api:htmlize(Str)}}.
out(A) ->
H = {ssi, "TAB.inc", [],[]},
L = case queryvar(A,"page") of
{ok, Page} ->
%% only allow regular chars in Page
case lists:all(fun(C) ->
if
$a =< C, C =< $z ->
true;
$A =< C, C =< $Z ->
true;
C == $_ ->
true;
C == $. ->
true;
true ->
false
end
end, Page) of
true ->
%os:cmd("man " ++ Page ++ " | col -b -p -x");
unesc(os:cmd("man " ++ Page));
false ->
"illegal character detected in query arg"
end;
undefined ->
"no man page found in query arg "
end,
Man = {ehtml, {'div', [{id, "entry"}], prebox(L)}},
Trail = {ssi, "END2",[],[]},
[H, Man, Trail].
unesc([27 | T]) ->
unesc(uptom(T));
unesc([H|T]) ->
[H|unesc(T)];
unesc([]) ->
[].
uptom([$m|T]) ->
T;
uptom([H|T]) ->
uptom(T);
uptom([]) ->
[].
</erl>
Jump to Line
Something went wrong with that request. Please try again.