/usr/share/sdcc/lib/src/gets.c is in sdcc-libraries 2.9.0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include <stdio.h>
char * gets(char *s) {
char c;
unsigned int count=0;
while (1) {
c=getchar();
switch(c) {
case '\b': // backspace
if (count) {
putchar ('\b');
putchar (' ');
putchar ('\b');
s--;
count--;
}
break;
case '\n':
case '\r': // CR or LF
putchar('\r');
putchar('\n');
*s=0;
return s;
default:
*s++=c;
count++;
putchar(c);
break;
}
}
}
|