mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
link in tinfo, call setupterm()
This commit is contained in:
parent
4a406a8d8a
commit
b6ee41b355
@ -10,12 +10,20 @@ configure_file(tools/version.h.in include/version.h)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(TERMINFO REQUIRED tinfo>=6.1)
|
||||
|
||||
file(GLOB LIBSRCS CONFIGURE_DEPENDS src/lib/*.c)
|
||||
add_library(notcurses SHARED ${LIBSRCS})
|
||||
target_include_directories(notcurses
|
||||
PRIVATE
|
||||
include
|
||||
"${PROJECT_BINARY_DIR}/include"
|
||||
"${TERMINFO_INCLUDE_DIR}"
|
||||
)
|
||||
target_link_libraries(notcurses
|
||||
INTERFACE
|
||||
"${TERMINFO_LIBRARIES}"
|
||||
)
|
||||
set_target_properties(notcurses PROPERTIES
|
||||
PUBLIC_HEADER "include/notcurses.h"
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include <curses.h> // needed for some definitions, see terminfo(3ncurses)
|
||||
#include <term.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
@ -37,6 +39,12 @@ notcurses* notcurses_init(void){
|
||||
if(ret == NULL){
|
||||
return ret;
|
||||
}
|
||||
int termerr;
|
||||
if(setupterm(NULL, STDERR_FILENO, &termerr) != OK){
|
||||
fprintf(stderr, "Terminfo error %d (see terminfo(3ncurses))\n", termerr);
|
||||
free(ret);
|
||||
return NULL;
|
||||
}
|
||||
// FIXME should we maybe use stdout if stdin was redirected?
|
||||
ret->ttyfd = STDIN_FILENO;
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user