break; case (int) '\n': case (int) '\r': case KEY_ENTER: { waddch(win, '\n'); buf[bytes++] = (char) '\n'; wrefresh(win); buf[bytes] = 0; } break; default: { waddch(win, (char) c); buf[bytes++] = (char) c; } } wrefresh(win);
int getstring(wint * wintab, char text[], char buf[]){    int c;    int ypos = 0, xpos = 0;    int bytes = 0;    WINDOW *win = winopen(wintab, 3, COLS, 10, 0, TRUE);    wmove(win, 1, 2);    waddstr(win, text);    wrefresh(win);    do {	c = getch();	if (c != ERR) {	    switch (c) {	    case KEY_BACKSPACE:	    case 127:		{		    getyx(win, ypos, xpos);		    if (xpos > 0 && bytes > 0) {			wmove(win, ypos, --xpos);			waddch(win, ' ');			wmove(win, ypos, xpos);			bytes--;		    }		}		break;	    case (int) '\n':	    case (int) '\r':	    case KEY_ENTER:		{		    waddch(win, '\n');		    buf[bytes++] = (char) '\n';		    wrefresh(win);		    buf[bytes] = 0;		}		break;	    default:		{		    waddch(win, (char) c);		    buf[bytes++] = (char) c;		}	    }	    wrefresh(win);	}    }    while (c != '\n' && c != '\r' && c != KEY_ENTER);    delwin(win);    winclose(wintab);    return 0;}