-/* Gets a line from the terminal */
-/* Where on the screen to start */
-/* Pointer to string buffer */
-/* Maximum length - if negative, no-show */
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-void getlin(int yp, int xp, char *string, int lim) {
- int a, b;
- char flag;
-
- flag = 0;
- if (lim < 0) {
- lim = (0 - lim);
- flag = 1;
- }
- move(yp, xp);
- standout();
- for (a = 0; a < lim; ++a)
- addch('-');
- refresh();
- move(yp, xp);
- for (a = 0; a < lim; ++a)
- addch(' ');
- move(yp, xp);
- printw("%s", string);
- GLA:move(yp, xp + strlen(string));
- refresh();
- a = getch();
- if (a == 127)
- a = 8;
- a = (a & 127);
- if (a == 10)
- a = 13;
- if ((a == 8) && (strlen(string) == 0))
- goto GLA;
- if ((a != 13) && (a != 8) && (strlen(string) == lim))
- goto GLA;
- if ((a == 8) && (string[0] != 0)) {
- string[strlen(string) - 1] = 0;
- move(yp, xp + strlen(string));
- addch(' ');
- goto GLA;
- }
- if ((a == 13) || (a == 10)) {
- standend();
- move(yp, xp);
- for (a = 0; a < lim; ++a)
- addch(' ');
- mvprintw(yp, xp, "%s", string);
- refresh();
- return;
- }
- b = strlen(string);
- string[b] = a;
- string[b + 1] = 0;
- if (flag == 0)
- addch(a);
- if (flag == 1)
- addch('*');
- goto GLA;
-}
-#endif
-
-