/* Test program by jhawk@mit.edu -- comment by perry@piermont.com */
/* Hacked for SunOS bug version by seth@soscorp.com */
/* Hacked for NeXT bug version by seth@soscorp.com */
#include <syslog.h>
#define BUF 4096

void Amain ()
{
  char buffer[BUF];
  int i;

  memset(buffer,0,BUF);
  for (i=0; i<BUF-10; i++)
    buffer[i]=65;

  syslog(LOG_DEBUG, "This is a test of the Logging System");

  /*
   * Some OS's, like NeXT and IRIX, will not log some of these
   * messages because they are too busy logging the previous message.
   * So we stick the sleep in to make sure that it really does get
   * logged.  (This is so that people don't complain that ``your
   * stupid library doesn't work'' when it is just a race condition.
   * I could make some pointed comments about the problems of race
   * conditions leading to denial of log information attacks, but I'll
   * restrain myself :-)
   */
  sleep(1);

  syslog(LOG_DEBUG, buffer);

  sleep(1);

  syslog(LOG_DEBUG, "This is for SunOS %s",buffer);

  sleep(1);

  syslog(LOG_DEBUG, "This is for NeXT (16) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",buffer,buffer,buffer,buffer,buffer,buffer,buffer,buffer,buffer,buffer,buffer,buffer,buffer,buffer,buffer,buffer);

}

void main()
{
  openlog("sysbug", LOG_PID, LOG_LOCAL7);
  printf("Before\n");
  Amain();
  printf("After\n");
}
