2017-11-19 14:18:44 -05:00
|
|
|
/** Terminfo interfaces
|
|
|
|
* @file */
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_TERM_H
|
|
|
|
#include <term.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "elinks.h"
|
2021-04-12 15:17:27 -04:00
|
|
|
#include "terminfo.h"
|
2017-11-19 14:18:44 -05:00
|
|
|
|
|
|
|
int
|
|
|
|
terminfo_setupterm(char *term, int fildes)
|
|
|
|
{
|
|
|
|
return setupterm(term, fildes, NULL);
|
|
|
|
}
|
|
|
|
|
2022-02-21 12:25:11 -05:00
|
|
|
const char *
|
2017-11-20 05:28:53 -05:00
|
|
|
terminfo_clear_screen(void)
|
|
|
|
{
|
2017-11-28 16:07:57 -05:00
|
|
|
char *res = tiparm(clear_screen);
|
|
|
|
|
|
|
|
if (res) return res;
|
|
|
|
return "";
|
2017-11-20 05:28:53 -05:00
|
|
|
}
|
|
|
|
|
2022-02-21 12:25:11 -05:00
|
|
|
const char *
|
2017-11-19 14:18:44 -05:00
|
|
|
terminfo_set_bold(int arg)
|
|
|
|
{
|
2017-11-28 16:07:57 -05:00
|
|
|
char *res = tiparm(arg ? enter_bold_mode : exit_attribute_mode);
|
|
|
|
|
|
|
|
if (res) return res;
|
|
|
|
return "";
|
2017-11-19 14:18:44 -05:00
|
|
|
}
|
|
|
|
|
2022-02-21 12:25:11 -05:00
|
|
|
const char *
|
2017-11-19 14:18:44 -05:00
|
|
|
terminfo_set_italics(int arg)
|
|
|
|
{
|
2017-11-28 16:07:57 -05:00
|
|
|
char *res = tiparm(arg ? enter_italics_mode : exit_italics_mode);
|
|
|
|
|
|
|
|
if (res) return res;
|
|
|
|
return "";
|
2017-11-19 14:18:44 -05:00
|
|
|
}
|
|
|
|
|
2022-02-21 12:25:11 -05:00
|
|
|
const char *
|
2017-11-19 14:18:44 -05:00
|
|
|
terminfo_set_underline(int arg)
|
|
|
|
{
|
2017-11-28 16:07:57 -05:00
|
|
|
char *res = tiparm(arg ? enter_underline_mode : exit_underline_mode);
|
|
|
|
|
|
|
|
if (res) return res;
|
|
|
|
return "";
|
2017-11-19 14:18:44 -05:00
|
|
|
}
|
|
|
|
|
2022-02-21 12:25:11 -05:00
|
|
|
const char *
|
2017-11-19 14:18:44 -05:00
|
|
|
terminfo_set_background(int arg)
|
|
|
|
{
|
2017-11-28 16:07:57 -05:00
|
|
|
char *res = tiparm(set_a_background, arg);
|
|
|
|
|
|
|
|
if (res) return res;
|
|
|
|
return "";
|
2017-11-19 14:18:44 -05:00
|
|
|
}
|
|
|
|
|
2022-02-21 12:25:11 -05:00
|
|
|
const char *
|
2017-11-19 14:18:44 -05:00
|
|
|
terminfo_set_foreground(int arg)
|
|
|
|
{
|
2017-11-28 16:07:57 -05:00
|
|
|
char *res = tiparm(set_a_foreground, arg);
|
|
|
|
|
|
|
|
if (res) return res;
|
|
|
|
return "";
|
2017-11-19 14:18:44 -05:00
|
|
|
}
|
2017-11-21 09:36:28 -05:00
|
|
|
|
|
|
|
int
|
|
|
|
terminfo_max_colors(void)
|
|
|
|
{
|
|
|
|
return max_colors;
|
|
|
|
}
|
2017-11-23 07:39:04 -05:00
|
|
|
|
2022-02-21 12:25:11 -05:00
|
|
|
const char *
|
2017-11-23 07:39:04 -05:00
|
|
|
terminfo_cursor_address(int y, int x)
|
|
|
|
{
|
2017-11-28 16:07:57 -05:00
|
|
|
char *res = tiparm(cursor_address, y, x);
|
|
|
|
|
|
|
|
if (res) return res;
|
|
|
|
return "";
|
2017-11-23 07:39:04 -05:00
|
|
|
}
|