wstats.c

skylib_fluffos_v3/mudlib/cmds/lord/wstats.c · 973 B

From the archive skylib_fluffos_v3.zip

Download the archive   « Back to the archive contents

inherit COMMAND_BASE;

int cmd(string str) {
        mapping stats;
        string obj, file;
        int total, num;
        
        stats = "/secure/master"->query_write_stats();

        if(str) {
                if(!stats[str])
                        return notify_fail("No such file\n");
                foreach(file in keys(stats[str])) {
                        if(stats[str][file] > 1)
                                printf("%-60s %5d\n", file, stats[str][file]);
                }
                return 1;
        }
        printf("%-60s %5s %5s\n", "Object", "Total", "Files");
        foreach(obj in keys(stats)) {
                total = 0;
                num = 0;
                foreach(file in keys(stats[obj])) {
                        num++;
                        total += stats[obj][file];
                }
                                if(total > 50)
                        printf("%-60s %5d %5d\n", obj, total, num);
        }
  return 1;
}

Site Stats

Snippets: 1791
Codebases: 571