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

/*
 * numstr.c
 *
 * turn a number into a word
 *
 * from PSL Empire, 1985
 */

#include "misc.h"

s_char *
numstr(buf, n)
	s_char	buf[128];
	int	n;
{
	extern	s_char *numnames[];
	extern	s_char *tennames[];

	if (n > 100) {
		(void) strcpy(buf, "several");
	} else if (n < 0) {
		(void) strcpy(buf, "a negative number of");
	} else {
		if (n >= 20) {
			(void) strcpy(buf, tennames[n / 10]);
			if (n % 10) {
				(void) strcat(buf, "-");
				(void) strcat(buf, numnames[n % 10]);
			}
		} else {
			(void) strcpy(buf, numnames[n % 20]);
		}
	}
	return buf;
}

s_char *
effadv(n)
	int	n;
{
	extern	s_char *effadv_list[];

	if (n < 0)
		n = 0;
	if (n >= 100)
		n = 99;
	return effadv_list[n/25];
}
