Example #1
0
int
v_credit(struct command *c)
{
  int target = c->a;
  int amount = c->b;
  int item = c->c;
  int pl;
  extern int gold_times;

  if (amount) {
    if (kind(target) != T_char && kind(target) != T_player) {
      wout(c->who, "%s not a character or player.", c->parse[1]);
      return FALSE;
    }

    if (numargs(c) >= 3 && i_strcmp(c->parse[3], "np") == 0) {
      if (kind(target) != T_player) {
        wout(c->who, "%s not a player.", box_code(target));
        return FALSE;
      }

      add_np(target, amount);
      wout(c->who, "Credited %s %d NP.", box_name(target), amount);
      wout(target, "Received GM credit of %d NP.", amount);
      return TRUE;
    }

    if (item == 0)
      item = 1;

    gen_item(target, item, amount);
    wout(c->who, "Credited %s %s.", box_name(target),
         box_name_qty(item, amount));
    wout(target, "Received CLAIM credit of %s.", box_name_qty(item, amount));
    return TRUE;
  }

  if (kind(target) != T_char) {
    wout(c->who, "%s not a character.", c->parse[1]);
    return FALSE;
  }

  pl = player(target);

  if (times_paid(pl)) {
    wout(c->who, "Already paid faction %s.", box_name(pl));
    return FALSE;
  }

  p_player(pl)->times_paid = TRUE;

  wout(target, "The Times pays %s %s.", box_name(target), gold_s(25));

  gen_item(target, item_gold, 25);
  gold_times += 25;

  return TRUE;
}
int main()
{
    printf("%20s  %20s  %d\n", "AA@B", "AA b", i_strcmp("AA@B", "AA b"));
    printf("%20s  %20s  %d\n", "HELLO", "hello", i_strcmp("HELLO", "hello"));
    printf("%20s  %20s  %d\n", "HeLLo", "hEllO", i_strcmp("HeLLo", "hEllO"));
    printf("%20s  %20s  %d\n", "HELLO123", "hello1", i_strcmp("HELLO123", "hello1"));
    printf("%20s  %20s  %d\n", "HELLO", "hello123", i_strcmp("HELLO", "hello123"));
    printf("%20s  %20s  %d\n", "", "hello", i_strcmp("", "hello"));
    printf("%20s  %20s  %d\n", "HELLO", "", i_strcmp("HELLO", ""));
    return 0;
}
Example #3
0
int
find_command(char *s)
{
  int i;

  fuzzy_find = FALSE;

  if (!*s)
    return -1;

  for (i = 1; cmd_tbl[i].name; i++)
    if (i_strcmp(cmd_tbl[i].name, s) == 0)
      return i;

  for (i = 1; cmd_tbl[i].name; i++)
    if (fuzzy_strcmp(cmd_tbl[i].name, s)) {
      fuzzy_find = TRUE;
      return i;
    }

  return -1;
}