From 2c3eb0d244ea4e76069fb50ae694a7685fc4538f Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Tue, 22 Jun 2004 22:59:20 +0000 Subject: [PATCH] don't use buffer --- second/serial.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/second/serial.c b/second/serial.c index 997ab39..60fc49e 100644 --- a/second/serial.c +++ b/second/serial.c @@ -11,12 +11,14 @@ #include "glue.h" #include "head.h" -#define BUFFER_LEN 80 - static short refnum0; static short refnum1; + +#if USE_BUFFER +#define BUFFER_LEN 80 static char buffer[256]; static int buff_len; +#endif /* * Technical Note TN1119 "Serial Port Apocrypha" @@ -235,6 +237,7 @@ ssize_t write(int fd, const void *buf, size_t count) void serial_put(char c) { +#if USE_BUFFER buffer[buff_len++] = c; if ( c == '\n' ) @@ -257,6 +260,14 @@ void serial_put(char c) flush: write(refnum0, buffer, buff_len); buff_len = 0; +#else + if ( c == '\n' ) + { + write(refnum0, "\n\r", 2); + } + else + write(refnum0, &c, 1); +#endif } void serial_init(emile_l2_header_t* info) @@ -275,5 +286,7 @@ void serial_init(emile_l2_header_t* info) info->serial1_parity, info->serial1_stopbits); +#if USE_BUFFER buff_len = 0; +#endif }