20 #include <sys/types.h> 28 #define _XOPEN_SOURCE_EXTENDED 29 #include "/usr/xpg4/include/term.h" 40 #if defined(HAVE_TERMIOS_H) && ! defined(TCSANOW) 43 #if defined(HAVE_TERM_H) && ! defined(TCSANOW) 51 #define STDIN_FILENO 0 54 #define STDOUT_FILENO 1 57 #define feCTRL(C) ((C) & 0x1F) 68 #define fe_hist_max 32 76 int on_exit(
void (*
f)(
int,
void *),
void *arg);
121 struct termios tattr;
125 tattr.c_lflag &= ~(ICANON|
ECHO);
126 tattr.c_cc[VMIN] = 1;
127 tattr.c_cc[VTIME] = 0;
156 char *tty_name=ttyname(fileno(stdin));
158 fe_echo = fopen( tty_name,
"w" );
164 printf(
"stdin is a tty, but ttyname fails\n");
170 struct termios tattr;
182 tattr.c_lflag &= ~(ICANON|
ECHO);
183 tattr.c_cc[VMIN] = 1;
184 tattr.c_cc[VTIME] = 0;
190 printf(
"need TERM\n");
194 printf(
"could not access termcap data base\n");
204 char *t_buf=(
char *)
omAlloc(128);
207 char** t_buf_ptr= &t_buf;
209 temp = tgetstr (
"pc", t_buf_ptr);
210 PC = (temp!=
NULL) ? *temp :
'\0';
211 BC=tgetstr(
"le",t_buf_ptr);
212 UP=tgetstr(
"up",t_buf_ptr);
220 temp = tgetstr (
"ti", t_buf_ptr);
428 (
int *)fdset.fds_bits,
433 }
while( (sel == -1) && (errno == EINTR) );
459 if ((
i==0) &&(
s[0]==
'\0'))
return NULL;
635 if ((c>=
' ')&&(c<=126))
650 while ((
s[
j]!=
'\0')&&(
j<
size-2))
j++;
652 while (
j>
i) {
s[
j]=
s[
j-1];
j--; }
686 return fgets(
s,
size,stdin);
707 #if defined(HAVE_DYN_RL) 709 #include "kernel/mod_raw.h" 713 char *(*fe_filename_completion_function)();
714 char *(* fe_readline) ();
718 char **(*fe_completion_matches)();
746 m=(
char **)
malloc(2*
sizeof(
char*));
747 m[0]=(
char *)
malloc(end-start+2);
748 strncpy(
m[0],text,end-start+1);
803 (*fe_rl_readline_name) =
"Singular";
807 (*fe_using_history)();
811 (*fe_read_history) (
p);
821 #if defined(HAVE_READLINE) && !defined(HAVE_FEREAD) && !defined(HAVE_DYN_RL) 827 #if defined(HAVE_DYN_RL) 828 char *
p =
getenv(
"SINGULARHIST");
832 (*fe_write_history) (
p);
835 #if defined(HAVE_READLINE) && !defined(HAVE_FEREAD) && !defined(HAVE_DYN_RL) 836 char *
p =
getenv(
"SINGULARHIST");
843 #if defined(HAVE_FEREAD)
const CanonicalForm int s
static void fe_ctrl_k(char *s, int i)
static void fe_add_hist(char *s)
static void fe_ctrl_u(char *s, int *i)
static int fe_out_char(int c)
char *(* fe_filename_completion_function)()
char ** singular_completion(char *text, int start, int end)
static BOOLEAN fe_stdin_is_tty
#define omFreeSize(addr, size)
static void fe_get_hist(char *s, int size, int *pos, int change, int incr)
static BOOLEAN fe_stdout_is_tty
char ** fe_rl_line_buffer
void * dynl_sym(void *handle, const char *symbol)
char **(* fe_completion_matches)()
void * dynl_open(char *filename)
static void fe_init(void)
static BOOLEAN fe_is_initialized
int history_total_bytes()
void(* fe_using_history)()
void * malloc(size_t size)
void select(const ListCFList &ppi, int length, ListCFList &ppi1, ListCFList &ppi2)
char ** fe_rl_readline_name
static char termcap_buff[2048]
void PrintS(const char *s)
int(* fe_history_total_bytes)()
static void fe_set_cursor(char *s, int i)
const Variable & v
< [in] a sqrfree bivariate poly
int dynl_close(void *handle)
int(* fe_write_history)()
char * fe_fgets_stdin_fe(char *pr, char *s, int size)
struct termios fe_saved_attributes
void omMarkAsStaticAddr(void *addr)
CPPFunction ** fe_rl_attempted_completion_function
void fe_reset_input_mode()
char * command_generator(char *text, int state)