コード例 #1
0
void cmd_inspect(char *s)
{
    int i;
  
    output("\tPawns : ");
    output("W : "); 
    for (i=1;i<9;i++) output("%d",board->pawns[0][i]);
    output(" B : ");
    for (i=1;i<9;i++) output("%d",board->pawns[1][i]);
    output("\n");

    output("\tFlags : %s\n", formatflags());

    if (ply)
    {
	undo u = undostack[ply-1];
	int v = board->flags;
      
	board->flags = u.flags;
	output("\tprevious move : %c took %c = %s : %s\n",
	       rep(u.moved), rep(u.captured), movestring(u.m), formatflags());
	board->flags = v;
    }
  
    if (fullincheckp(tomove()))
    {
	output("\tYou are currently in check : %d\n", fullincheckp(tomove()));
    }
}
コード例 #2
0
ファイル: trusts_commands.c プロジェクト: quakenet/newserv
static void displaygroup(nick *sender, trustgroup *tg, int showchildren) {
  trusthost *th, **p2;
  unsigned int marker;
  array parents;
  int i;
  time_t t = getnettime();

  /* abusing the ternary operator a bit :( */
  controlreply(sender, "Name             : %s", tg->name->content);
  controlreply(sender, "Trusted for      : %s", formatlimit(tg->trustedfor));
  controlreply(sender, "Currently using  : %d", tg->count);
  controlreply(sender, "Clients per user : %s", formatlimit(tg->maxperident));
  controlreply(sender, "Flags            : %s", formatflags(tg->flags));
  controlreply(sender, "Contact          : %s", tg->contact->content);
  controlreply(sender, "Expires in       : %s", (tg->expires)?((tg->expires>t)?longtoduration(tg->expires - t, 2):"the past (will be removed during next cleanup)"):"never");
  controlreply(sender, "Created by       : %s", tg->createdby->content);
  controlreply(sender, "Comment          : %s", tg->comment->content);
  controlreply(sender, "ID               : %u", tg->id);
  controlreply(sender, "Last used        : %s", (tg->count>0)?"(now)":((tg->lastseen>0)?trusts_timetostr(tg->lastseen):"(never)"));
  controlreply(sender, "Max usage        : %d", tg->maxusage);
  controlreply(sender, "Last max reset   : %s", tg->lastmaxusereset?trusts_timetostr(tg->lastmaxusereset):"(never)");

  controlreply(sender, "---");
  controlreply(sender, "Attributes: * (has hidden children, show with -v), > (belongs to this trust group)");
  controlreply(sender, "Host                            Current    Max        Last seen             Max per Node    Node Mask      Group ID   Group name");

  marker = nextthmarker();
  array_init(&parents, sizeof(trusthost *));

  for(th=tg->hosts;th;th=th->next)
    marktree(&parents, marker, th, showchildren);

  p2 = (trusthost **)(parents.content);
  for(i=0;i<parents.cursi;i++)
    outputtree(sender, marker, tg, p2[i], 0, showchildren);

  array_free(&parents);
}