Beispiel #1
0
Datei: uniq.c Projekt: darius/ung
static void uniq (void) {
  Line line1, line2;
  Line *prev = &line1;
  Line *next = &line2;

  line_read (prev);
  line_write (prev);
  while (!feof (stdin)) {
    line_read (next);
    if (!lines_match (prev, next)) {
      Line *tmp = prev;
      prev = next;
      next = tmp;
      line_write (prev);
    }
  }
}
Beispiel #2
0
/* format into single file */
void format(FILE * fo, FILE * f1, FILE * fi, int n) {
  int p, j;
  struct line line;

  rewind(fo);
  rewind(f1);

  while (n) {
    p = min(n, M * (k + 1) * (db + 1));
    fread(buffer[0], S, p, f1);
    for (j = 0; j < p; j++) {
      fseek(fi, buffer[0][j].p, SEEK_SET);
      line_read(fi, &line);
      line_write(fo, &line);
    }
    n -= p;
  }
}
Beispiel #3
0
static void ssl_put_char(struct tty_struct *tty, unsigned char ch)
{
	line_write(serial_lines, tty, 0, &ch, sizeof(ch));
}
Beispiel #4
0
static int ssl_write(struct tty_struct * tty, int from_user,
		     const unsigned char *buf, int count)
{
	return(line_write(serial_lines, tty, from_user, buf, count));
}