array (string) nanny_dirs = ({
"/usr/lpmud/lib/doc/",
"/usr/lpmud/lib/doc/std/",
"/usr/lpmud/lib/doc/efun/",
"/usr/lpmud/lib/doc/efun/23++",
"/usr/lpmud/lib/doc/efun/23++",
"/usr/lpmud/lib/doc/sfun/",
"/usr/lpmud/lib/doc/lfun/",
"/usr/lpmud/lib/doc/w",
"/usr/lpmud/lib/std/",
"/usr/lpmud/lib/obj/",
"/usr/lpmud/lib/std/rfc/",
"/usr/lpmud/lib/std/rfc/",
});
array efuns = filter_array(sum(@map_array(nanny_dirs, lambda(string s)
{
return get_dir(s);
})), lambda(string s) {
if(lower_case(s) != s) return 0;
if(s[0]=='.') return 0;
if(s[-1]=='~') return 0;
if(s[0]=='#') return 0;
if(reverse(s)[0..1] == "c.")
return 0;
return 1;
});
string find_nanny_file(string name)
{
string d;
foreach(nanny_dirs, d)
if(d=read_bytes(d+name))
return d;
}
string make_index()
{
return map_array(sort_array(efuns), lambda(string s){
return ""+s+"";
}) *"
";
}
string parse(object id)
{
string data;
if(!id->query)
return make_index();
data = find_nanny_file(id->query);
if(!data)
return "
"; return "\n"+ data+"