Example #1
0
int
quit(struct move *mm)
{

	if (tflag) {
		curmove(20, 0);
		clend();
	} else
		writec('\n');
	writel("Are you sure you want to quit?");
	if (yorn(0)) {
		if (rfl) {
			writel("Would you like to save this game?");
			if (yorn(0))
				save(mm, 0);
		}
		cturn = 0;
		return (1);
	}
	return (0);
}
Example #2
0
int
text(const char *const *txt)
{
	const char *a;
	char b;
	const char *c;
	int i;

	fixtty(noech);
	while (*txt) {
		a = *(txt++);
		if (*a != '\0') {
			c = a;
			for (i = 0; *(c++) != '\0'; i--)
			    ; /* nothing */
			writel(a);
			writec('\n');
		} else {
			fixtty(raw);
			writel(prompt);
			for (;;) {
				if ((b = readc()) == '?') {
					if (tflag) {
						if (begscr) {
							curmove(18, 0);
							clend();
						} else
							clear();
					} else
						writec('\n');
					text(list);
					writel(prompt);
					continue;
				}
				i = 0;
				if (b == '\n')
					break;
				while (i < 11) {
					if (b == opts[i])
						break;
					i++;
				}
				if (i == 11)
					writec('\007');
				else
					break;
			}
			if (tflag) {
				if (begscr) {
					curmove(18, 0);
					clend();
				} else
					clear();
			} else
				writec('\n');
			if (i)
				return (i);
			fixtty(noech);
			if (tflag)
				curmove(curr, 0);
		}
	}
	fixtty(raw);
	return (0);
}