/* $Header: help.c,v 1.1 90/04/14 14:56:44 lachesis Exp $
 * $Log:    help.c,v $
 * Revision 1.1  90/04/14  14:56:44  lachesis
 * Initial revision
 *
 */
#include "copyright.h"

/* commands for giving help */
#include "os.h"
#include "db.h"
#include "config.h"
#include "interface.h"
#include "externs.h"

void spit_file (dbref player, const char *filename)
{
  FILE *f;
  char buf[BUFFER_LEN];
  char *p;

  if ((f = fopen (filename, "rb")) == NULL) {
    sprintf (buf, "Sorry, %s is broken.  Management has been notified.",
      filename);
    notify (player, buf);
    fputs ("spit_file:", stderr);
    perror (filename);
  } else {
    while (fgets (buf, sizeof buf, f)) {
      for (p = buf; *p; p++)
        if (*p == '\n') {
          *p = '\0';
          break;
        }
      notify (player, buf);
    }
    fclose (f);
  }
}

void do_help (dbref player)
{
  spit_file (player, HELP_FILE);
}

void do_news (dbref player)
{
  spit_file (player, NEWS_FILE);
}