-/* $OpenBSD: network.c,v 1.11 2014/07/20 05:22:02 guenther Exp $ */
+/* $OpenBSD: network.c,v 1.12 2014/07/20 06:24:19 guenther Exp $ */
/* $NetBSD: network.c,v 1.5 1996/02/28 21:04:06 thorpej Exp $ */
/*
* Initialize internal network data structures.
*/
- void
-init_network()
+void
+init_network(void)
{
- if (ring_init(&netoring, netobuf, sizeof netobuf) != 1) {
- exit(1);
- }
- if (ring_init(&netiring, netibuf, sizeof netibuf) != 1) {
- exit(1);
- }
- NetTrace = stdout;
+ ring_init(&netoring, netobuf, sizeof netobuf);
+ ring_init(&netiring, netibuf, sizeof netibuf);
+ NetTrace = stdout;
}
-/* $OpenBSD: ring.c,v 1.6 2014/07/19 23:50:38 guenther Exp $ */
+/* $OpenBSD: ring.c,v 1.7 2014/07/20 06:24:19 guenther Exp $ */
/* $NetBSD: ring.c,v 1.7 1996/02/28 21:04:07 thorpej Exp $ */
/*
/* Buffer state transition routines */
- int
+void
ring_init(ring, buffer, count)
Ring *ring;
unsigned char *buffer;
int count;
{
- memset((char *)ring, 0, sizeof *ring);
+ memset(ring, 0, sizeof *ring);
ring->size = count;
ring->supply = ring->consume = ring->bottom = buffer;
ring->top = ring->bottom+ring->size;
-
- return 1;
}
/* Mark routines */
-/* $OpenBSD: ring.h,v 1.7 2014/07/19 23:50:38 guenther Exp $ */
+/* $OpenBSD: ring.h,v 1.8 2014/07/20 06:24:19 guenther Exp $ */
/* $NetBSD: ring.h,v 1.5 1996/02/28 21:04:09 thorpej Exp $ */
/*
*
*/
typedef struct {
- unsigned char *consume, /* where data comes out of */
- *supply, /* where data comes in to */
- *bottom, /* lowest address in buffer */
- *top, /* highest address+1 in buffer */
- *mark; /* marker (user defined) */
- int size; /* size in bytes of buffer */
- u_long consumetime, /* help us keep straight full, empty, etc. */
- supplytime;
+ unsigned char *consume; /* where data comes out of */
+ unsigned char *supply; /* where data comes in to */
+ unsigned char *bottom; /* lowest address in buffer */
+ unsigned char *top; /* highest address+1 in buffer */
+ unsigned char *mark; /* marker (user defined) */
+ int size; /* size in bytes of buffer */
+ u_long consumetime; /* help us keep straight full, empty, etc. */
+ u_long supplytime;
} Ring;
/* Here are some functions and macros to deal with the ring buffer */
/* Initialization routine */
-extern int
- ring_init(Ring *ring, unsigned char *buffer, int count);
+void ring_init(Ring *ring, unsigned char *buffer, int size);
/* Data movement routines */
-extern void
- ring_supply_data(Ring *ring, unsigned char *buffer, int count);
+void ring_supply_data(Ring *ring, unsigned char *buffer, int count);
/* Buffer state transition routines */
-extern void
- ring_supplied(Ring *ring, int count),
- ring_consumed(Ring *ring, int count);
+void ring_supplied(Ring *ring, int count);
+void ring_consumed(Ring *ring, int count);
/* Buffer state query routines */
-extern int
- ring_empty_count(Ring *ring),
- ring_empty_consecutive(Ring *ring),
- ring_full_count(Ring *ring),
- ring_full_consecutive(Ring *ring);
+int ring_empty_count(Ring *ring);
+int ring_empty_consecutive(Ring *ring);
+int ring_full_count(Ring *ring);
+int ring_full_consecutive(Ring *ring);
-extern void
- ring_clear_mark(Ring *),
- ring_mark(Ring *);
+/* Buffer urgent data handling */
+void ring_clear_mark(Ring *);
+void ring_mark(Ring *);
+int ring_at_mark(Ring *);
-
-extern int
- ring_at_mark(Ring *);
-/* $OpenBSD: terminal.c,v 1.7 2014/07/19 23:50:38 guenther Exp $ */
+/* $OpenBSD: terminal.c,v 1.8 2014/07/20 06:24:19 guenther Exp $ */
/* $NetBSD: terminal.c,v 1.5 1996/02/28 21:04:17 thorpej Exp $ */
/*
* initialize the terminal data structures.
*/
- void
+void
init_terminal()
{
- if (ring_init(&ttyoring, ttyobuf, sizeof ttyobuf) != 1) {
- exit(1);
- }
- if (ring_init(&ttyiring, ttyibuf, sizeof ttyibuf) != 1) {
- exit(1);
- }
- autoflush = TerminalAutoFlush();
+ ring_init(&ttyoring, ttyobuf, sizeof ttyobuf);
+ ring_init(&ttyiring, ttyibuf, sizeof ttyibuf);
+ autoflush = TerminalAutoFlush();
}