aboutsummaryrefslogtreecommitdiff
path: root/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/out_put.c
blob: f39cd2a97cfceaa14301e39c7dbb1d4098899c71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <unistd.h>
#include "str_defs.h"

static char buf_space[256];
static int  buf_pos;

void out_flush() /*EXTRACT_INCL*/ { 
  const_io((int(*)())write, 1, buf_space, buf_pos);
  buf_pos=0;
}

void out_char(char ch) /*EXTRACT_INCL*/ {
  if (buf_pos == sizeof(buf_space)) out_flush();
  buf_space[buf_pos] = ch;
  buf_pos++;
}

void out_puts(char *s) /*EXTRACT_INCL*/ { 
  while (*s) {
    out_char(*s);
    ++s;
  } 
}