File: addcr.c

package info (click to toggle)
ucspi-tcp 1%3A0.88-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,772 kB
  • sloc: ansic: 10,201; makefile: 2,689; python: 604; sh: 168
file content (22 lines) | stat: -rw-r--r-- 394 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "buffer.h"
#include "exit.h"

int main()
{
  register int n;
  register char *x;
  char ch;

  for (;;) {
    n = buffer_feed(buffer_0);
    if (n < 0) _exit(111);
    if (!n) _exit(0);
    x = buffer_PEEK(buffer_0);
    buffer_SEEK(buffer_0,n);
    while (n > 0) {
      ch = *x++; --n;
      if (ch == '\n') buffer_PUTC(buffer_1,"\r"[0]);
      buffer_PUTC(buffer_1,ch);
    }
  }
}