summaryrefslogtreecommitdiff
path: root/lib/libcurses/base/lib_ungetch.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcurses/base/lib_ungetch.c')
-rw-r--r--lib/libcurses/base/lib_ungetch.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/lib/libcurses/base/lib_ungetch.c b/lib/libcurses/base/lib_ungetch.c
index 81b315d6a42..3837f645b3a 100644
--- a/lib/libcurses/base/lib_ungetch.c
+++ b/lib/libcurses/base/lib_ungetch.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_ungetch.c,v 1.1 1999/01/18 19:10:05 millert Exp $ */
+/* $OpenBSD: lib_ungetch.c,v 1.2 2001/01/22 18:01:47 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -42,35 +42,38 @@
#include <curses.priv.h>
-MODULE_ID("$From: lib_ungetch.c,v 1.2 1998/02/11 12:13:56 tom Exp $")
+MODULE_ID("$From: lib_ungetch.c,v 1.4 2000/12/10 02:43:27 tom Exp $")
#include <fifo_defs.h>
#ifdef TRACE
-void _nc_fifo_dump(void)
+NCURSES_EXPORT(void)
+_nc_fifo_dump(void)
{
-int i;
- T(("head = %d, tail = %d, peek = %d", head, tail, peek));
- for (i = 0; i < 10; i++)
- T(("char %d = %s", i, _trace_key(SP->_fifo[i])));
+ int i;
+ T(("head = %d, tail = %d, peek = %d", head, tail, peek));
+ for (i = 0; i < 10; i++)
+ T(("char %d = %s", i, _trace_key(SP->_fifo[i])));
}
#endif /* TRACE */
-int ungetch(int ch)
+NCURSES_EXPORT(int)
+ungetch(int ch)
{
- if (tail == -1)
- return ERR;
- if (head == -1) {
- head = 0;
- t_inc()
- peek = tail; /* no raw keys */
- } else
- h_dec();
+ if (tail == -1)
+ return ERR;
+ if (head == -1) {
+ head = 0;
+ t_inc()
+ peek = tail; /* no raw keys */
+ } else
+ h_dec();
- SP->_fifo[head] = ch;
- T(("ungetch %#x ok", ch));
+ SP->_fifo[head] = ch;
+ T(("ungetch %#x ok", ch));
#ifdef TRACE
- if (_nc_tracing & TRACE_IEVENT) _nc_fifo_dump();
+ if (_nc_tracing & TRACE_IEVENT)
+ _nc_fifo_dump();
#endif
- return OK;
+ return OK;
}