diff options
| author | rsc <rsc> | 2007-08-30 18:20:53 +0000 | 
|---|---|---|
| committer | rsc <rsc> | 2007-08-30 18:20:53 +0000 | 
| commit | 37321196a4d2a3893422a9f628de41a8a128b47f (patch) | |
| tree | e818fc01a351a35401efa07856189f747359903f | |
| parent | 71d5bf4d08b3ce328fe403f464f4ec95f2d8ca29 (diff) | |
| download | xv6-labs-37321196a4d2a3893422a9f628de41a8a128b47f.tar.gz xv6-labs-37321196a4d2a3893422a9f628de41a8a128b47f.tar.bz2 xv6-labs-37321196a4d2a3893422a9f628de41a8a128b47f.zip  | |
oops - broke circular buffer
| -rw-r--r-- | console.c | 6 | 
1 files changed, 2 insertions, 4 deletions
@@ -219,7 +219,7 @@ console_intr(int (*getc)(void))        break;      default:        if(c != 0 && input.e < input.r+INPUT_BUF){ -        input.buf[input.e++] = c; +        input.buf[input.e++ % INPUT_BUF] = c;          cons_putc(c);          if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){            input.w = input.e; @@ -250,7 +250,7 @@ console_read(struct inode *ip, char *dst, int n)        }        sleep(&input.r, &input.lock);      } -    c = input.buf[input.r++]; +    c = input.buf[input.r++ % INPUT_BUF];      if(c == C('D')){  // EOF        if(n < target){          // Save ^D for next time, to make sure @@ -263,8 +263,6 @@ console_read(struct inode *ip, char *dst, int n)      --n;      if(c == '\n')        break; -    if(input.r >= INPUT_BUF) -      input.r = 0;    }    release(&input.lock);    ilock(ip);  | 
