All pastes #273537 Raw Edit

David R.S. Robinson

public text v1 · immutable
·published 2006-12-09 23:52 UTC
rendered paste body
unsigned 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;}