Merge pull request #1576 from ailin-nemui/solaris

fix github solaris test
This commit is contained in:
ailin-nemui 2025-07-21 16:51:40 +00:00 committed by GitHub
commit 216715bc81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 41 additions and 14 deletions

View file

@ -63,11 +63,11 @@ jobs:
sync: rsync
release: "11.4-gcc"
prepare: |
pkg update --accept
pkg install meson
pkgutil -y -i curl
pkgutil -y -i gtar
pkgutil -y -i findutils
pkg update --accept || echo 1:$?
pkg install meson || echo 2:$?
pkgutil -y -i curl || echo 3:$?
pkgutil -y -i gtar || echo 4:$?
pkgutil -y -i findutils || echo 5:$?
run: |
set -ex
export PKG_CONFIG_PATH=/usr/lib/64/pkgconfig

View file

@ -570,23 +570,40 @@ foreach h : headers
endforeach
if want_textui and conf.get('HAVE_TERM_H', 0) == 1
if not cc.links('''
if cc.links('''
#include <stdio.h>
#include <term.h>
int main () {
int main (void) {
return tputs("x", 1, putchar);
}
''', dependencies : textui_dep)
if cc.has_header('curses.h') and cc.links('''
''', args : '-pedantic-errors', dependencies : textui_dep, name : 'Curses working')
# ok
else
has_curses_h = cc.has_header('curses.h')
if has_curses_h and cc.links('''
#include <curses.h>
#include <term.h>
int main () {
int main (void) {
return tputs("x", 1, putchar);
}
''', dependencies : textui_dep, name : 'working Curses')
''', args : '-pedantic-errors', dependencies : textui_dep, name : 'Curses working with curses.h')
conf.set('NEED_CURSES_H', 1, description : 'tputs needs curses.h')
else
error('could not link terminfo')
if has_curses_h and cc.links('''
#include <curses.h>
#include <term.h>
int char_putchar (char c) {
return putchar(c);
}
int main (void) {
return tputs("x", 1, char_putchar);
}
''', args : '-pedantic-errors', dependencies : textui_dep, name : 'Curses with tputs third argument arg char')
conf.set('NEED_CURSES_H', 1, description : 'tputs needs curses.h')
conf.set('TPUTS_SVR4', 1, description : 'third argument of tputs has the type int (*)(char)')
else
error('could not link terminfo')
endif
endif
endif
endif

View file

@ -318,7 +318,12 @@ void term_window_scroll(TERM_WINDOW *window, int count)
term_lines_empty[window->y+y] = FALSE;
}
inline static int term_putchar(int c)
#ifdef TPUTS_SVR4
#define putc_arg_t char
#else
#define putc_arg_t int
#endif
inline static int term_putchar(putc_arg_t c)
{
return fputc(c, current_term->out);
}

View file

@ -6,8 +6,13 @@
# define _POSIX_VDISABLE 0
#endif
#ifdef TPUTS_SVR4
#define putc_arg_t char
#else
#define putc_arg_t int
#endif
#define tput(s) tputs(s, 0, term_putchar)
inline static int term_putchar(int c)
inline static int term_putchar(putc_arg_t c)
{
return fputc(c, current_term->out);
}