File: out_put.c

package info (click to toggle)
ngetty 1.1-3.1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 392 kB
  • sloc: ansic: 1,588; makefile: 206; sh: 193; asm: 100
file content (23 lines) | stat: -rw-r--r-- 424 bytes parent folder | download | duplicates (5)
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;
  } 
}