wstats.c

dw_fluffos_v1/lib/cmds/lord/wstats.c · 679 B

From the archive dw_fluffos_v1.tar.gz

Download the archive   « Back to the archive contents

inherit "/cmds/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