4.3BSD/usr/contrib/spms/src/lib/libspms/src/yes.c

Compare this file to the similar file:
Show the results in this format:

/* $Header$ */

/*
 * Author: Peter J. Nicklin
 */

/*
 * yes() returns 1 if the user replies with a word starting with `y',
 * otherwise zero. yes() eats up the rest of the line.
 */
#include <stdio.h>

yes()
{
	register int c;			/* current character */
	int status = 0;			/* return status */

	while ((c = getchar()) == ' ' || c == '\t')
		continue;
	if (c == 'y')
		status = 1;
	while (c != '\n')
		c = getchar();
	return(status);
}