[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Move the setterm macro to the documented header file
From: |
Graeme McCutcheon |
Subject: |
[PATCH] Move the setterm macro to the documented header file |
Date: |
Tue, 29 Dec 2020 16:18:30 +0000 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
Appreciate this is rather trivial: the documentation already states that
this function should not be used in new code. Indeed, I only spotted this
whilst reading code, not through real usage.
The BSD-compatability function setterm is documented as available
by including the header file term.h. However, the macro is only defined in
curses.h. The following program would fail to link.
#include "term.h"
int main(int arc, char** argv) {
setterm("dumb");
return 0;
}
Regards,
Graeme
---
include/MKterm.h.awk.in | 3 +++
include/curses.h.in | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/MKterm.h.awk.in b/include/MKterm.h.awk.in
index c93cdea..a4483d2 100644
--- a/include/MKterm.h.awk.in
+++ b/include/MKterm.h.awk.in
@@ -345,6 +345,9 @@ END {
print "extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *,
int, int *);"
print "extern NCURSES_EXPORT(int) setupterm (const char *,int,int *);"
print ""
+ print "/* This is provided for BSD compatability */"
+ print "#define setterm(term) setupterm(term, 1, (int *)0)"
+ print ""
print "/* terminfo entry points, also declared in curses.h */"
print "#if !defined(__NCURSES_H)"
print "extern NCURSES_EXPORT(char *) tigetstr (const char *);"
diff --git a/include/curses.h.in b/include/curses.h.in
index c516b22..95480bc 100644
--- a/include/curses.h.in
+++ b/include/curses.h.in
@@ -1122,8 +1122,6 @@ extern NCURSES_EXPORT(int)
NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /*
#define wgetstr(w, s) wgetnstr(w, s, -1)
#define getnstr(s, n) wgetnstr(stdscr, s, (n))
-#define setterm(term) setupterm(term, 1, (int *)0)
-
#define fixterm() reset_prog_mode()
#define resetterm() reset_shell_mode()
#define saveterm() def_prog_mode()
--
2.7.4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Move the setterm macro to the documented header file,
Graeme McCutcheon <=