
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <proto/dos.h>
#include "defines.h"
#include "cus.h"
#include "rev.h"

void giveversioninfo(char *progname)
{
	char *buffer = NULL;
	char *ptr;

	if ((buffer = (char *)malloc(RANGE_12BIT)) == NULL)
		CU2();
	ptr = buffer;
	strupr(progname);
	ptr += sprintf(ptr, "[1m%s Release %s.%02d (%s) -- the UUCP polling server[0m\n"
						"%s(c) Copyright 1991,92 Ralf S. Engelschall, All Rights Reserved.\n"
						"%s(c) Copyright 1991,92 Cyvaned Systems, All Rights Reserved.\n\n",
						progname, Version, Revision, Date, progname, progname );

	ptr += sprintf(ptr, "  This material is distributed under the conditions specified in\n"
						"UUPoll.man! Using this program implies that you have accepted these\n"
						"licence statements and/or conditions.\n" );

	ptr += sprintf(ptr, "                        ___  _______\n"
                        "Ralf S. Engelschall,    /__)(_  /_\n"
                        " Cyvaned Systems       / \\____)(___\n"
                        "                      /                         rse@angle.muc.sub.org\n"
                        "                         ...!smurf.sub.org!brumuc!{angle,cyvaned}!rse\n" );
	strlwr(progname);
	Write(Output(), buffer, (int)(ptr-buffer));
	CUS:
	if (buffer)
		free(buffer);
	return;
}


void giveusage(char *progname)
{
	char *buffer = NULL;
	char *ptr;
	char padstr[RANGE_5BIT];
	int i;
	char *cp;

	if ((buffer = (char *)malloc(RANGE_12BIT)) == NULL)
		CU2();
	ptr = buffer;
	strlwr(progname);
	for (i = strlen(progname), cp = padstr; i > 0; i--)
		*cp++ = SP;
	*cp = NUL;
	ptr += sprintf(ptr, "Usage: %s [-s [System]] [-S [System]] [-r Num] [-d Sec] [-t Min] [-u Arg]\n"
						"       %s [-m] [-e [Cmnd]] [-E [Cmnd]] [-a] [-x Num] [-i] [-v] [-?]\n"
						"\n"
						"  s  poll the specified system           e  execute after polling session\n"
						"  S  as 's' but ignore time restriction  E  as 'e' but execute always\n"
						"  r  number of retries before giving up  a  always poll - ignore status\n"
						"  d  seconds of retry delay time         x  number of debuglevel\n"
						"  t  minutes of restriction time         i  restriction time info\n"
						"  u  additional uucico arguments         v  version info\n"
						"  m  setup modem before startup          ?  usage info\n"
						"\n",
						progname, padstr);
	Write(Output(), buffer, (int)(ptr-buffer));
	CUS:
	if (buffer)
		free(buffer);
	return;
}

