#ifndef lint
static char *RCSid = "$Header: /usr/brule/guest/empire/empire/emprcs/lib/gen/onearg.c,v 2.0 1995/07/27 05:56:17 empire Exp $";
#endif

/*
 * onearg.c
 *
 * returns non-negative integer, or -1 on error.
 *
 * from PSL Empire, 1985
 */

#include "misc.h"

int
onearg(arg, prompt)
	s_char	*arg;
	s_char	*prompt;
{
	extern	s_char *getstring();
	int	n;
	s_char	buf[1024];

	if (arg == 0 || *arg == 0) {
		if ((arg = getstring(prompt, buf)) == 0)
			return -1;
	}
	n = atoi(arg);
	if (n < 0)
		return -1;
	return n;
}
