mudlist.c

nightmare3_fluffos_v2/lib/www/gateways/mudlist.c · 1.3 KB

From the archive nightmare3_fluffos_v2.zip

Download the archive   « Back to the archive contents

/*    /www/gateways/mudlist.c
 *    from Nightmare IV
 *    a gateway to produce a mudlist for connecting to muds
 *    created by Descartes of Borg 940524
 */

#include <std.h>
#include <daemons.h>

inherit DAEMON;

string gateway(string unused) {
    mapping borg;
    string *muds;
    string str;
    int i, maxi;

    maxi = sizeof(muds=sort_array(keys(borg=(mapping)NETWORK_D->query_known_muds()),
      "alphabetize_muds", this_object()));
    str = sprintf("<TITLE>%s Mudlist Gateway</TITLE><h1>"
      "%s is aware of the following %d muds.</h1><OL>", mud_name(),
      mud_name(), maxi);
    for(i=0; i<maxi; i++)
      str += sprintf("<LI><a href=telnet://%s:%s>%s</a> (%s %s), Driver: %s, "
        "Mudlib: %s %s\n", borg[muds[i]]["HOSTADDRESS"], borg[muds[i]]["PORT"],
        borg[muds[i]]["NAME"], borg[muds[i]]["HOSTADDRESS"],
        (borg[muds[i]]["PORT"]), 
        (borg[muds[i]]["DRIVER"] ? borg[muds[i]]["DRIVER"] : "Unknown"),
        (borg[muds[i]]["MUDLIB"] ? borg[muds[i]]["MUDLIB"] : "Unknown"),
        (borg[muds[i]]["VERSION"] ? borg[muds[i]]["VERSION"] : ""));
    str += "</OL>This mudlist is maintained dynamically through the "
      "Nightmare Mudlib intermud network system.";
    return str;
}

int alphabetize_muds(string a, string b) { return strcmp(a, b); }

Site Stats

Snippets: 1791
Codebases: 571