A helpcheck command

From: James Turner (turnerjh@XTN.NET)
Date: 04/19/98

In an effort to pay back the Circle community for some of the snippets
I've used in the past (in particular, dg scripts and Oasis OLC), I've
decided to post some useful snippets from the current code I'm working
on.  I'm purposely not doing these as patch files, because, while
useful, I feel that having patch files very much reduces the amount of
knowledge necessary to run a mud, which IMO is the wrong direction
for Circle coders.  I'll try to post more over the next few days.

Below is a command, helpcheck, and the functions it relies on.
helpcheck is a very useful command that can be quite nice when you're
trying to document your mud.  Basically it goes through and finds all
commands that don't have help entries.  It should work on stock code
just fine.  I've not included this as a patch for two reasons.  One,
I've not installed it in stock, so I can't generate a patch file.
Two, I think this is simple enough and self-contained enough that
anyone should be able to add it.  All you have to do is make an entry
in your main command table.  There is one bug -- the code says you
need help for the last social in your social table, even though it
should filter socials out.  No big deal and I've not worked to fix it,
but it's something to keep in mind.  If anyone has major troubles
compiling it, then it is because my code has changed significantly
from stock; however, besides perhaps a variable name, I don't think
this will be an issue.

No warranties implied, use at your own risk, etc etc :)


do_helpcheck(CHAR_DATA *ch, char *argument, int cmd, int subcmd)
  struct command_info *i;
  int w=0;

  send_to_char("Commands without help entries:\r\n", ch);
  send_to_char("------------------------------\r\n", ch);

  for (i = (struct command_info *)cmd_main_list; i && (*(i->command) != '\n'); i++)
    if (help_lookup(i->command) == -1) {
      if (is_social(i->command) != -1) continue;
      if (is_fake_cmd(i->command)) continue;
      w = w % 6;
      send_to_char(fill_to_n(i->command, ' ', 11), ch);
      if (w) send_to_char(" ", ch);
      else send_to_char("\r\n", ch);

is_social(char *s)
  int i;

  for(i = 0; i < list_top; i++)
    if(!str_cmp(s, soc_mess_list[i].command)) return i;

  return -1;

is_fake_cmd(char *s)
  const char *fake_cmds[] = {

  int i;

  for(i = 0; fake_cmds[i]; i++)
    if (!str_cmp(s, (char *)fake_cmds[i])) return i+1;

  return 0;

  This function places a string s into a buffer of length n, with the
  excess space at the end filled with the character c.  For instance,

  fill_to_n("Hi there!", ".", 20);


  "Hi there!..........."

  Useful for formatting output, particularly for, say, skill listings.

char *
fill_to_n(char *s, char c, int n)
  static char sbuf[MAX_STRING_LENGTH+1];

  if (n <= strlen(s)) {
    strcpy(sbuf, s);
    return sbuf;
  memset(sbuf, c, MAX_STRING_LENGTH);
  strcpy(sbuf, s);
  sbuf[n] = 0;
  sbuf[strlen(s)] = c;

  return sbuf;

James Turner               turnerjh@xtn.net

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |

This archive was generated by hypermail 2b30 : 12/15/00 PST