/*
** @(#) Revision 1.1 - 01/17/97
** mlogwrite.c
**
** ======================================================================= 
** Andrea Whitlock, Mobius Software Services
** whitlock@mobius-soft.com
** 
** Bug reports, questions, and suggestions should be emailed to:
** mobius@mobius-soft.com
**
** This software is provided under the terms of the GNU copyleft
** (ftp://prep.ai.mit.edu/pub/gnu/COPYING-2.0), without a warranty
** of any kind.  Use at your own risk.
** ======================================================================= 
**
** Description:
** Sample program to use the logwrite() function to write to the logmon 
** message log.  This example program can be called from scripts.  See the 
** fscheck script for an example.
**
** Notes:
** Set tabstops to 4.
**
*/

#include <stdio.h>
#include "semutils.h"
#include "logwrite.h"

static char mlogwriteSccsId[] = "@(#)mlogwrite.c	1.1\t01/17/97";
static char mlogwriteVerId[] = "VER 1.1";

void
main(int argc, char *argv[])
{
	int		semid;

	if (argc != 3) {
		fprintf(stderr, " usage: %s message-type \"message\"\n", argv[0]);
		fprintf(stderr,"example: %s billing17 \"17-3 statements aborted\"\n",
			argv[0]);
		fprintf(stderr, "notes:   a newline will be appended to the message\n");
		exit(1);
	}

	if (make_semaphore(&semid, LOGFILE, KEYID)) exit(1);

	if (logwrite(semid, LOGFILE, argv[1], argv[2], NEWLINE)) 
		exit (1);

	exit(0);
}

