/****************************************************************************
- * Copyright 2020,2023 Thomas E. Dickey *
+ * Copyright 2020-2023,2024 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
#include <curses.priv.h>
-MODULE_ID("$Id: lib_raw.c,v 1.27 2023/04/29 18:56:30 tom Exp $")
+MODULE_ID("$Id: lib_raw.c,v 1.30 2024/03/30 15:54:17 tom Exp $")
#if HAVE_SYS_TERMIO_H
#include <sys/termio.h> /* needed for ISC */
#ifdef TERMIOS
buf.c_lflag &= (unsigned) ~ICANON;
buf.c_iflag &= (unsigned) ~ICRNL;
- buf.c_lflag |= ISIG;
buf.c_cc[VMIN] = 1;
buf.c_cc[VTIME] = 0;
#elif defined(EXP_WIN32_DRIVER)
return NCURSES_SP_NAME(intrflush) (CURRENT_SCREEN, win, flag);
}
#endif
+
+#if NCURSES_EXT_FUNCS
+/* *INDENT-OFF* */
+
+/*
+ * SCREEN is always opaque, but nl/raw/cbreak/echo set properties in it.
+ * As an extension, provide a way to query the properties.
+ *
+ * There are other properties which could be queried, e.g., filter, keypad,
+ * use_env, use_meta, but these particular properties are saved/restored within
+ * the wgetnstr() and wgetn_wstr() functions, which requires that the higher
+ * level curses library knows about the internal state of the lower level
+ * terminfo library.
+ */
+
+#define is_TEST(show,what) \
+ NCURSES_EXPORT(int) \
+ NCURSES_SP_NAME(show) (NCURSES_SP_DCL0) \
+ { \
+ return ((SP_PARM != NULL) ? (what(SP_PARM) ? 1 : 0) : -1); \
+ }
+
+is_TEST(is_nl, IsNl)
+is_TEST(is_raw, IsRaw)
+is_TEST(is_cbreak, IsCbreak)
+is_TEST(is_echo, IsEcho)
+
+#if NCURSES_SP_FUNCS
+#undef is_TEST
+#define is_TEST(show) \
+ NCURSES_EXPORT(int) \
+ show(void) \
+ { \
+ return NCURSES_SP_NAME(show) (CURRENT_SCREEN); \
+ }
+is_TEST(is_nl)
+is_TEST(is_raw)
+is_TEST(is_cbreak)
+is_TEST(is_echo)
+#endif
+
+/* *INDENT-ON* */
+#endif /* extensions */