diff options
Diffstat (limited to 'term')
-rw-r--r-- | term/Makefile | 2 | ||||
-rw-r--r-- | term/main.c | 2 | ||||
-rw-r--r-- | term/munge.c | 4 | ||||
-rw-r--r-- | term/term.h | 47 | ||||
-rw-r--r-- | term/users.c | 2 | ||||
-rw-r--r-- | term/xinl.c | 2 |
6 files changed, 43 insertions, 16 deletions
diff --git a/term/Makefile b/term/Makefile index 8b287f36..e13763a1 100644 --- a/term/Makefile +++ b/term/Makefile @@ -22,7 +22,7 @@ dir := term makemode := server target = term -SRCS = devio.c munge.c users.c main.c ptyio.c hurdio.c +SRCS = devio.c munge.c users.c main.c ptyio.c hurdio.c xinl.c LCLHDRS = term.h DIST_FILES = ourmsg.defs diff --git a/term/main.c b/term/main.c index 516a2dcf..405e7cd8 100644 --- a/term/main.c +++ b/term/main.c @@ -405,7 +405,7 @@ main (int argc, char **argv) } if (err) - error (1, err, peer_name); + error (1, err, "%s", peer_name); (*peercntl)->hook = peer_name; ports_port_deref (*peercntl); diff --git a/term/munge.c b/term/munge.c index 74d82888..660a99bd 100644 --- a/term/munge.c +++ b/term/munge.c @@ -582,7 +582,7 @@ input_character (int c) echo_char (c, 0, 0); if (CCEQ (cc[VEOF], c) && (lflag & ECHO)) { - /* Special bizzare echo processing for VEOF character. */ + /* Special bizarre echo processing for VEOF character. */ int n; n = echo_double (c, 0) ? 2 : output_width (c, output_psize); while (n--) @@ -642,7 +642,7 @@ input_break () enqueue_quote (qp, '\0'); } -/* Called when a character is recived with a framing error. */ +/* Called when a character is received with a framing error. */ void input_framing_error (int c) { diff --git a/term/term.h b/term/term.h index 8448d78e..81d0efee 100644 --- a/term/term.h +++ b/term/term.h @@ -25,8 +25,15 @@ #include <sys/types.h> #include <sys/mman.h> #include <fcntl.h> +#include <features.h> #include <hurd/hurd_types.h> +#ifdef TERM_DEFINE_EI +#define TERM_EI +#else +#define TERM_EI __extern_inline +#endif + #undef MDMBUF #undef ECHO #undef TOSTOP @@ -184,34 +191,49 @@ struct queue struct queue *create_queue (int size, int lowat, int hiwat); +extern int qsize (struct queue *q); +extern int qavail (struct queue *q); +extern void clear_queue (struct queue *q); +extern quoted_char dequeue_quote (struct queue *q); +extern char dequeue (struct queue *q); +extern void enqueue_internal (struct queue **qp, quoted_char c); +extern void enqueue (struct queue **qp, char c); +extern void enqueue_quote (struct queue **qp, char c); +extern char unquote_char (quoted_char c); +extern int char_quoted_p (quoted_char c); +extern short queue_erase (struct queue *q); + +#if defined(__USE_EXTERN_INLINES) || defined(TERM_DEFINE_EI) /* Return the number of characters in Q. */ -extern inline int +TERM_EI int qsize (struct queue *q) { return q->ce - q->cs; } /* Return nonzero if characters can be added to Q. */ -extern inline int +TERM_EI int qavail (struct queue *q) { return !q->susp; } /* Flush all the characters from Q. */ -extern inline void +TERM_EI void clear_queue (struct queue *q) { q->susp = 0; q->cs = q->ce = q->array; condition_broadcast (q->wait); } +#endif /* Use extern inlines. */ /* Should be below, but inlines need it. */ void call_asyncs (int dir); +#if defined(__USE_EXTERN_INLINES) || defined(TERM_DEFINE_EI) /* Return the next character off Q; leave the quoting bit on. */ -extern inline quoted_char +TERM_EI quoted_char dequeue_quote (struct queue *q) { int beep = 0; @@ -234,16 +256,18 @@ dequeue_quote (struct queue *q) } /* Return the next character off Q. */ -extern inline char +TERM_EI char dequeue (struct queue *q) { return dequeue_quote (q) & ~QUEUE_QUOTE_MARK; } +#endif /* Use extern inlines. */ struct queue *reallocate_queue (struct queue *); +#if defined(__USE_EXTERN_INLINES) || defined(TERM_DEFINE_EI) /* Add C to *QP. */ -extern inline void +TERM_EI void enqueue_internal (struct queue **qp, quoted_char c) { struct queue *q = *qp; @@ -265,28 +289,28 @@ enqueue_internal (struct queue **qp, quoted_char c) } /* Add C to *QP. */ -extern inline void +TERM_EI void enqueue (struct queue **qp, char c) { enqueue_internal (qp, c); } /* Add C to *QP, marking it with a quote. */ -extern inline void +TERM_EI void enqueue_quote (struct queue **qp, char c) { enqueue_internal (qp, c | QUEUE_QUOTE_MARK); } /* Return the unquoted version of a quoted_char. */ -extern inline char +TERM_EI char unquote_char (quoted_char c) { return c & ~QUEUE_QUOTE_MARK; } /* Tell if a quoted_char is actually quoted. */ -extern inline int +TERM_EI int char_quoted_p (quoted_char c) { return c & QUEUE_QUOTE_MARK; @@ -294,7 +318,7 @@ char_quoted_p (quoted_char c) /* Remove the most recently enqueue character from Q; leaving the quote mark on. */ -extern inline short +TERM_EI short queue_erase (struct queue *q) { short answer; @@ -313,6 +337,7 @@ queue_erase (struct queue *q) condition_broadcast (q->wait); return answer; } +#endif /* Use extern inlines. */ /* Functions devio is supposed to call */ diff --git a/term/users.c b/term/users.c index a4e110b4..4ec2b810 100644 --- a/term/users.c +++ b/term/users.c @@ -678,7 +678,7 @@ trivfs_S_io_read (struct trivfs_protid *cred, while (!qsize (inputq)) { - if ((termflags & NO_CARRIER) && !(termstate.c_cflag & CLOCAL)) + if ((termflags & NO_CARRIER) && !(termstate.c_cflag & CLOCAL) || !amount) { /* Return EOF, Posix.1 7.1.1.10. */ mutex_unlock (&global_lock); diff --git a/term/xinl.c b/term/xinl.c new file mode 100644 index 00000000..3695faa5 --- /dev/null +++ b/term/xinl.c @@ -0,0 +1,2 @@ +#define TERM_DEFINE_EI +#include "term.h" |