diff options
Diffstat (limited to 'payloads/libpayload/curses/PDCurses-3.4/pdcurses/getstr.c')
-rw-r--r-- | payloads/libpayload/curses/PDCurses-3.4/pdcurses/getstr.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/payloads/libpayload/curses/PDCurses-3.4/pdcurses/getstr.c b/payloads/libpayload/curses/PDCurses-3.4/pdcurses/getstr.c index c6386d3158..744e5e65fe 100644 --- a/payloads/libpayload/curses/PDCurses-3.4/pdcurses/getstr.c +++ b/payloads/libpayload/curses/PDCurses-3.4/pdcurses/getstr.c @@ -28,20 +28,20 @@ RCSID("$Id: getstr.c,v 1.51 2008/07/14 04:24:51 wmcbrine Exp $") int mvwgetn_wstr(WINDOW *win, int y, int x, wint_t *wstr, int n); Description: - These routines call wgetch() repeatedly to build a string, - interpreting erase and kill characters along the way, until a - newline or carriage return is received. When PDCurses is built - with wide-character support enabled, the narrow-character - functions convert the wgetch()'d values into a multibyte string - in the current locale before returning it. The resulting string - is placed in the area pointed to by *str. The routines with n as + These routines call wgetch() repeatedly to build a string, + interpreting erase and kill characters along the way, until a + newline or carriage return is received. When PDCurses is built + with wide-character support enabled, the narrow-character + functions convert the wgetch()'d values into a multibyte string + in the current locale before returning it. The resulting string + is placed in the area pointed to by *str. The routines with n as the last argument read at most n characters. - Note that there's no way to know how long the buffer passed to + Note that there's no way to know how long the buffer passed to wgetstr() is, so use wgetnstr() to avoid buffer overflows. Return Value: - This functions return ERR on failure or any other value on + This functions return ERR on failure or any other value on success. Portability X/Open BSD SYS V @@ -118,7 +118,7 @@ int wgetnstr(WINDOW *win, char *str, int n) { if (chars < n) { - if (oldecho) + if (oldecho) waddch(win, ch); *p++ = ch; ++chars; @@ -131,7 +131,7 @@ int wgetnstr(WINDOW *win, char *str, int n) case _ECHAR: /* CTRL-H -- Delete character */ if (p > str) { - if (oldecho) + if (oldecho) waddstr(win, "\b \b"); ch = (unsigned char)(*--p); if ((ch < ' ') && (oldecho)) @@ -143,7 +143,7 @@ int wgetnstr(WINDOW *win, char *str, int n) case _DLCHAR: /* CTRL-U -- Delete line */ while (p > str) { - if (oldecho) + if (oldecho) waddstr(win, "\b \b"); ch = (unsigned char)(*--p); if ((ch < ' ') && (oldecho)) @@ -156,7 +156,7 @@ int wgetnstr(WINDOW *win, char *str, int n) while ((p > str) && (*(p - 1) == ' ')) { - if (oldecho) + if (oldecho) waddstr(win, "\b \b"); --p; /* remove space */ @@ -164,7 +164,7 @@ int wgetnstr(WINDOW *win, char *str, int n) } while ((p > str) && (*(p - 1) != ' ')) { - if (oldecho) + if (oldecho) waddstr(win, "\b \b"); ch = (unsigned char)(*--p); @@ -177,7 +177,7 @@ int wgetnstr(WINDOW *win, char *str, int n) case '\n': case '\r': stop = TRUE; - if (oldecho) + if (oldecho) waddch(win, '\n'); break; @@ -187,7 +187,7 @@ int wgetnstr(WINDOW *win, char *str, int n) if (!SP->key_code && ch < 0x100) { *p++ = ch; - if (oldecho) + if (oldecho) waddch(win, ch); chars++; } @@ -196,7 +196,7 @@ int wgetnstr(WINDOW *win, char *str, int n) beep(); break; - + } wrefresh(win); @@ -315,7 +315,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n) { if (chars < n) { - if (oldecho) + if (oldecho) waddch(win, ch); *p++ = ch; ++chars; @@ -328,7 +328,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n) case _ECHAR: /* CTRL-H -- Delete character */ if (p > wstr) { - if (oldecho) + if (oldecho) waddstr(win, "\b \b"); ch = *--p; if ((ch < ' ') && (oldecho)) @@ -340,7 +340,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n) case _DLCHAR: /* CTRL-U -- Delete line */ while (p > wstr) { - if (oldecho) + if (oldecho) waddstr(win, "\b \b"); ch = *--p; if ((ch < ' ') && (oldecho)) @@ -353,7 +353,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n) while ((p > wstr) && (*(p - 1) == ' ')) { - if (oldecho) + if (oldecho) waddstr(win, "\b \b"); --p; /* remove space */ @@ -361,7 +361,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n) } while ((p > wstr) && (*(p - 1) != ' ')) { - if (oldecho) + if (oldecho) waddstr(win, "\b \b"); ch = *--p; @@ -374,7 +374,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n) case '\n': case '\r': stop = TRUE; - if (oldecho) + if (oldecho) waddch(win, '\n'); break; @@ -393,7 +393,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n) beep(); break; - + } wrefresh(win); |