6c25041f467e44f37a0cd1d30ab727d3a286b4f0
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: msvcrt/conio/cgets.c
6 * PROGRAMMER: Eric Kohl (Imported from DJGPP)
15 char *_cgets(char *string
)
18 unsigned int maxlen_wanted
;
22 * Be smart and check for NULL pointer.
23 * Don't know wether TURBOC does this.
27 maxlen_wanted
= (unsigned int)((unsigned char)string
[0]);
30 * Should the string be shorter maxlen_wanted including or excluding
31 * the trailing '\0' ? We don't take any risk.
33 while(len
< maxlen_wanted
-1)
37 * shold we check for backspace here?
38 * TURBOC does (just checked) but doesn't in cscanf (thats harder
39 * or even impossible). We do the same.
45 _cputs("\b \b"); /* go back, clear char on screen with space
48 sp
[len
] = '\0'; /* clear the character in the string */
58 /* special character ends input */
60 _ungetch(c
); /* keep the char for later processing */
69 sp
[maxlen_wanted
-1] = '\0';
70 string
[1] = (char)((unsigned char)len
);