fix linux-specific compilation errors

This commit is contained in:
2024-10-27 15:36:14 +00:00
parent e77c3908eb
commit a86291ca75
5 changed files with 15 additions and 11 deletions

View File

@@ -1,15 +1,15 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <unistd.h>
int z__c_stream_is_tty(FILE *fp)
int z__b_stream_is_tty(FILE *fp)
{
return isatty(fileno(fp));
}
int z__c_stream_dimensions(FILE *fp, unsigned int *w, unsigned int *h)
int z__b_stream_dimensions(FILE *fp, unsigned int *w, unsigned int *h)
{
if (!isatty(fileno(fp))) {
return -1;
@@ -31,7 +31,7 @@ int z__c_stream_dimensions(FILE *fp, unsigned int *w, unsigned int *h)
return 0;
}
int z__c_stream_cursorpos(FILE *in, FILE *out, unsigned int *x, unsigned int *y)
int z__b_stream_cursorpos(FILE *in, FILE *out, unsigned int *x, unsigned int *y)
{
if (!isatty(fileno(in)) || !isatty(fileno(out))) {
return -1;
@@ -41,7 +41,7 @@ int z__c_stream_cursorpos(FILE *in, FILE *out, unsigned int *x, unsigned int *y)
tcgetattr(fileno(in), &term);
tcgetattr(fileno(in), &restore);
term.c_lflag &= ~(ICANON|ECHO);
term.c_lflag &= ~(ICANON | ECHO);
tcsetattr(fileno(in), TCSANOW, &term);
const char *cmd = "\033[6n";