Esempio n. 1
0
void putsym(char c)
{
    switch(c) {
    case '\b':
        backsp();
        
        return;
    case '\n':
        curx = 1;
        ++cury;

        if(cury > tly) {
            tly = cury;
        }

        break;
    default:
        ++curx;
        
        if(curx == COLNO) {
            putsym('\n');
        }
    }

    putchar(c);
}
Esempio n. 2
0
/*
 * plname is filled either by an option (-u Player  or  -uPlayer) or
 * explicitly (by being the wizard) or by askname.
 * It may still contain a suffix denoting pl_character.
 * Always called after init_nhwindows() and before display_gamewindows().
 */
void
tty_askname()
{
	register int c, ct;

	tty_putstr(BASE_WINDOW, 0, "");
	tty_putstr(BASE_WINDOW, 0, "Who are you? ");
	tty_curs(BASE_WINDOW, 14, wins[BASE_WINDOW]->cury-1);
	ct = 0;
	while((c = tty_nhgetch()) != '\n') {
		if(c == EOF) error("End of input\n");
		/* some people get confused when their erase char is not ^H */
		if (c == '\b' || c == '\177') {
			if(ct) {
				ct--;
#ifdef MICRO
# if defined(WIN32CON)
				backsp();       /* \b is visible on NT */
# else
				msmsg("\b \b");
# endif
#else
				(void) putchar('\b');
				(void) putchar(' ');
				(void) putchar('\b');
#endif
			}
			continue;
		}
#if defined(UNIX) || defined(VMS)
		if(c != '-' && c != '@')
		if(c < 'A' || (c > 'Z' && c < 'a') || c > 'z') c = '_';
#endif
		if(ct < sizeof(plname)-1) {
#if defined(MICRO)
			msmsg("%c", c);
#else
			(void) putchar(c);
#endif
			plname[ct++] = c;
		}
	}
	plname[ct] = 0;
	tty_curs(BASE_WINDOW, 1, wins[BASE_WINDOW]->cury+1);
	if(ct == 0) tty_askname();
}
Esempio n. 3
0
void
putsym(char c)
{
	switch(c) {
	case '\b':
		backsp();
		return;
	case '\n':
		curx = 1;
		cury++;
		if(cury > tly) tly = cury;
		break;
	default:
		if(curx == CO)
			putsym('\n');	/* 1 <= curx <= CO; avoid CO */
		else
			curx++;
	}
	putchar(c);
}