com/help.c - example for course 13

[previous example] [course 13] [Table of contents] [next example]
/* Filename      : help.c
 * Description   : the guild help 'help'
 *
 * written       : 30-05-1998 - Gunner
 * last modified : 31-05-1998 - Gunner
 * HTML-Version  : 13-02-2000 - Ghorwin
 */

#include "/doc/crashcourse/course13/include/guild.h"
#include <bits.h>
inherit I_COMMAND;

#define MORE "/com/s/more"

string
query_action()
{
    return "help";
}

string
short_help()
{
    return "Help for the Mage Of Darkness guild.\n";
}

/*
 * paging : Is the player using more to view text?
 */
int
paging(object player)
{
    return !player->test_bit(PLAYER_PAGING);
}

int
main(string arg)
{
    if (!arg)
        return 0;

    if (file_size(GUILD_HELPDIR + arg) > 0)
    {
        if (paging(TP))
            MORE->main(GUILD_HELPDIR + arg);
        else
            cat(GUILD_HELPDIR + arg);
        return 1;
    }
    else return 0; // Fallthrough.
}