Category : C Source Code
Archive   : VF.ZIP
Filename : GETSTR.C
* getstr -- get a string from the keyboard
*/
#include
#include
#include
#include
#include
char *
getstr(buf, width)
char *buf;
int width;
{
int row, col;
char *cp;
/* function prototypes */
extern int putcur(int, int, int);
extern int readcur(int *, int *, int);
extern int writec(char, int, int);
extern int getkey();
/* gather keyboard input into a string buffer */
cp = buf;
while ((*cp = getkey()) != K_RETURN && cp - buf < width) {
switch (*cp) {
case K_CTRLH:
/* destructive backspace */
if (cp > buf) {
readcur(&row, &col, Vpage);
putcur(row, col - 1, Vpage);
writec(' ', 1, Vpage);
--cp;
}
continue;
case K_ESC:
/* cancel string input operation */
return (char *)NULL;
}
put_ch(*cp, Vpage);
++cp;
}
*cp = '\0';
return (buf);
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/