summaryrefslogtreecommitdiff
path: root/LibC/termcap.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-12 01:28:46 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-12 01:28:46 +0100
commitf1404aa9484e1a38b0924f74ac8b5796faf5c77a (patch)
treebe571507f54f885aca4eddd0a8bc03f2ada4ee04 /LibC/termcap.cpp
parent18e3ddf6058d86f22df9fd90f6ad7f3a3833909f (diff)
downloadserenity-f1404aa9484e1a38b0924f74ac8b5796faf5c77a.zip
Add primitive FIFO and hook it up to sys$pipe().
It's now possible to do this in bash: cat kernel.map | fgrep List This is very cool! :^)
Diffstat (limited to 'LibC/termcap.cpp')
-rw-r--r--LibC/termcap.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/LibC/termcap.cpp b/LibC/termcap.cpp
index 9dbd7a7dc3..d422d47697 100644
--- a/LibC/termcap.cpp
+++ b/LibC/termcap.cpp
@@ -5,6 +5,8 @@
#include <AK/HashMap.h>
#include <AK/String.h>
+//#define TERMCAP_DEBUG
+
extern "C" {
char PC;
@@ -13,7 +15,9 @@ char* BC;
int tgetent(char* bp, const char* name)
{
+#ifdef TERMCAP_DEBUG
fprintf(stderr, "tgetent: bp=%p, name='%s'\n", bp, name);
+#endif
if (!strcmp(name, "ansi")) {
PC = '\0';
BC = const_cast<char*>("\033[D");
@@ -60,7 +64,9 @@ void ensure_caps()
char* tgetstr(char* id, char** area)
{
ensure_caps();
- fprintf(stderr, "tgetstr: id='%s', area=%p", id, area);
+#ifdef TERMCAP_DEBUG
+ fprintf(stderr, "tgetstr: id='%s'\n", id);
+#endif
auto it = caps->find(id);
if (it != caps->end()) {
char* ret = *area;
@@ -74,7 +80,9 @@ char* tgetstr(char* id, char** area)
int tgetflag(char* id)
{
+#ifdef TERMCAP_DEBUG
fprintf(stderr, "tgetflag: '%s'\n", id);
+#endif
auto it = caps->find(id);
if (it != caps->end())
return 1;
@@ -83,11 +91,12 @@ int tgetflag(char* id)
int tgetnum(char* id)
{
+#ifdef TERMCAP_DEBUG
fprintf(stderr, "tgetnum: '%s'\n", id);
+#endif
auto it = caps->find(id);
- if (it != caps->end()) {
+ if (it != caps->end())
return atoi((*it).value);
- }
assert(false);
}