David R.S. Robinson
public text v1 · immutableunsigned int gets (char *s, unsigned int len){ unsigned int saved_len = len; while (len--) { *s = getc (); putc(*s); if (*s == '\r') { putc('\n'); break; } else if (*s == '\b') { puts(" \b"); s--; len++; } s++; } *s = '\0'; /* Emulate that the person went to the next line, if we run out of space. */ if (len == -1) putc('\n'); return saved_len - len;}