#define BOARDS (["bulletin":"Anslagstavlan i Muddevalla","strandhamn":"Anslagstavlan i Strandhamn"]) /* Tittar p} svenskmuds anslagstavla. */ string read_board(int fd, mixed *fi) { string bn; int noteno; string messages; /* call_out(lambda() { update(file_name(this_object())); destruct(); }, 10); */ string *notes; string document = ""; if (sscanf(fi[0],"%s/%d",bn,noteno) || sscanf(fi[0],"%s",bn,noteno)) { string file; if (BOARDS[bn] && (file = read_file("/usr/svmud/lib/bboard/" + bn + ".o")) && sscanf(file, "%s\nmessages \"%s",messages,messages)) { string hd, body, rest; int i; int tmp; messages = messages[0..strlen(messages)-3]; if (noteno == 0) { document = "" + BOARDS[bn] + "\n" + "

" + BOARDS[bn] + "

\n
    "; } else { document = "" + sprintf("%s, not %d",BOARDS[bn],noteno) + "\n" + "

    " + sprintf("%s, not %d",BOARDS[bn],noteno) + "

    "; } rest = messages; i = 0; while(rest != 0 && rest != "") { i += 1; tmp = sscanf(rest, "%s: ** %s ** %s", hd, body, rest); if (tmp != 2 && tmp != 3) return(rest + "\n" + tmp + " Sabbad fil.\n"); if (noteno == 0) document += "
  1. " + hd + "\n"; else if (noteno == i) { document += "

    " + hd + "

    \n" + implode(explode(body/" "*"\n","\n\n"),"\n

    \n"); document += "

    \nSe "; if (rest != "") document += sprintf("nästa not\n",i + 1); if (noteno > 1) document += sprintf("föregående not\n",i - 1); document += sprintf("tavlan igen\n",bn); break; } } return document; } } return 0; } void main() { write(read_board(0,({"bulletin"}))); write(read_board(0,({"bulletin/1"}))); write(read_board(0,({"strandhamn"}))); }