summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC/sys
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2023-02-26 18:56:25 +0200
committerAndrew Kaster <andrewdkaster@gmail.com>2023-03-01 19:36:53 -0700
commit6b849fc8b1c51772359c4202df274890284ba4ff (patch)
tree6114b476deae1a991a8885c584efaa2761951d4c /Userland/Libraries/LibC/sys
parent800e244ed9fd30729de7cf7d1f97792a811587de (diff)
downloadserenity-6b849fc8b1c51772359c4202df274890284ba4ff.zip
Kernel: Move TYPEDEF_* TTY macros to API/ttydefaults.h file
This allows us to get rid of an include to LibC/sys/ttydefaults.h in the Kernel TTY implementation. Also, move ttydefchars static const struct to another file called Kernel/API/ttydefaultschars.h, so it could be used too in the Kernel TTY implementation without the need to include anything from LibC.
Diffstat (limited to 'Userland/Libraries/LibC/sys')
-rw-r--r--Userland/Libraries/LibC/sys/ttydefaults.h76
1 files changed, 3 insertions, 73 deletions
diff --git a/Userland/Libraries/LibC/sys/ttydefaults.h b/Userland/Libraries/LibC/sys/ttydefaults.h
index 0719830cdf..057f7e7c8b 100644
--- a/Userland/Libraries/LibC/sys/ttydefaults.h
+++ b/Userland/Libraries/LibC/sys/ttydefaults.h
@@ -6,80 +6,10 @@
#pragma once
-#define TTYDEF_IFLAG (ICRNL)
-#define TTYDEF_OFLAG (OPOST | ONLCR)
-#define TTYDEF_LFLAG_NOECHO (ISIG | ICANON)
-#define TTYDEF_LFLAG_ECHO (TTYDEF_LFLAG_NOECHO | ECHO | ECHOE | ECHOK | ECHONL)
-#define TTYDEF_LFLAG TTYDEF_LFLAG_ECHO
-#define TTYDEF_CFLAG (CS8)
-#define TTYDEF_SPEED (B9600)
-
-#define CTRL(c) (c & 0x1F)
-#define CINTR CTRL('c')
-#define CQUIT 034
-#define CERASE 010
-#define CKILL CTRL('u')
-#define CEOF CTRL('d')
-#define CTIME 0
-#define CMIN 1
-#define CSWTC 0
-#define CSTART CTRL('q')
-#define CSTOP CTRL('s')
-#define CSUSP CTRL('z')
-#define CEOL 0
-#define CREPRINT CTRL('r')
-#define CDISCARD CTRL('o')
-#define CWERASE CTRL('w')
-#define CLNEXT CTRL('v')
-#define CEOL2 CEOL
-
-#define CEOT CEOF
-#define CBRK CEOL
-#define CRPRNT CREPRINT
-#define CFLUSH CDISCARD
+#include <Kernel/API/ttydefaults.h>
#ifdef TTYDEFCHARS
-# ifdef KERNEL
-# include <Kernel/UnixTypes.h>
-# else
-# include <termios.h>
-# endif
-
-# ifdef __clang__
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wc99-designator"
-# endif
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-static const cc_t ttydefchars[NCCS] = {
- [VINTR] = CINTR,
- [VQUIT] = CQUIT,
- [VERASE] = CERASE,
- [VKILL] = CKILL,
- [VEOF] = CEOF,
- [VTIME] = CTIME,
- [VMIN] = CMIN,
- [VSWTC] = CSWTC,
- [VSTART] = CSTART,
- [VSTOP] = CSTOP,
- [VSUSP] = CSUSP,
- [VEOL] = CEOL,
- [VREPRINT] = CREPRINT,
- [VDISCARD] = CDISCARD,
- [VWERASE] = CWERASE,
- [VLNEXT] = CLNEXT,
- [VEOL2] = CEOL2
-};
-
-# ifdef __clang__
-# pragma clang diagnostic pop
-# endif
-
-# ifdef __cplusplus
-}
-# endif
+# include <termios.h>
+# include <Kernel/API/ttydefaultschars.h>
#endif