diff --git a/src/modules/_Stdio/configure.in b/src/modules/_Stdio/configure.in index f440e9ff780352ba8f6ca47693f0583da3f7f871..a805cb2e9a83fa5821db3e1063de9a22f8845fe1 100644 --- a/src/modules/_Stdio/configure.in +++ b/src/modules/_Stdio/configure.in @@ -67,7 +67,7 @@ AC_CHECK_LIB(util, openpty) AC_HAVE_FUNCS(readdir_r statvfs statfs ustat lseek64 lstat fsync \ grantpt unlockpt ptsname posix_openpt socketpair writev sendfile munmap \ - openpty \ + openpty tcgetattr \ madvise poll setsockopt getprotobyname inet_ntoa \ inet_ntop execve listxattr flistxattr getxattr fgetxattr setxattr fsetxattr \ fdopendir pathconf fpathconf dirfd fstatat openat unlinkat kqueue access) diff --git a/src/modules/_Stdio/file.c b/src/modules/_Stdio/file.c index d62093f37431ba9282fa3f2ce573793e1b1376df..20408a48b1a1e422116dd4041f9f03d9db93c0cb 100644 --- a/src/modules/_Stdio/file.c +++ b/src/modules/_Stdio/file.c @@ -6157,6 +6157,7 @@ void check_static_file_data(struct callback *UNUSED(a), void *UNUSED(b), #if defined(HAVE_TERMIOS_H) || defined(HAVE_SYS_TERMIOS_H) void file_tcgetattr(INT32 args); +#ifdef HAVE_TCGETATTR void file_tcsetattr(INT32 args); void file_tcsendbreak(INT32 args); void file_tcflush(INT32 args); @@ -6164,6 +6165,7 @@ void file_tcdrain(INT32 args); /* void file_tcflow(INT32 args); */ /* void file_tcgetpgrp(INT32 args); */ /* void file_tcsetpgrp(INT32 args); */ +#endif #ifdef TIOCSWINSZ void file_tcsetsize(INT32 args); #endif diff --git a/src/modules/_Stdio/file_functions.h b/src/modules/_Stdio/file_functions.h index ce3393aba8a73804851423cd38b37b2c40d6dbca..67040f189d3d3608f46aeff88cac35cc6d1b1138 100644 --- a/src/modules/_Stdio/file_functions.h +++ b/src/modules/_Stdio/file_functions.h @@ -170,6 +170,7 @@ FILE_FUNC("grantpt",file_grantpt, tFunc(tNone,tStr)) #if defined(HAVE_TERMIOS_H) || defined(HAVE_SYS_TERMIOS_H) /* function(void:mapping) */ FILE_FUNC("tcgetattr",file_tcgetattr, tFunc(tNone,tMapping)) +#ifdef HAVE_TCGETATTR /* function(mapping, void|string: int(0..1)) */ FILE_FUNC("tcsetattr", file_tcsetattr, tFunc(tMapping tOr(tVoid, tStr), tInt01)) /* function(int: int(0..1)) */ @@ -180,6 +181,7 @@ FILE_FUNC("tcdrain", file_tcdrain, tFunc(tNone, tInt01)) /* FILE_FUNC("tcflow",file_tcflow,"function(string:int)"); */ /* FILE_FUNC("tcgetpgrp",file_tcgetpgrp,"function(void:int)"); */ /* FILE_FUNC("tcsetpgrp",file_tcsetpgrp,"function(int:int)"); */ +#endif #ifdef TIOCSWINSZ FILE_FUNC("tcsetsize", file_tcsetsize, tFunc(tIntPos tIntPos, tInt01)) #endif diff --git a/src/modules/_Stdio/termios.c b/src/modules/_Stdio/termios.c index 8e890729d3c6b19cfc2465191f39ac2ff4b5416a..1e243ca44e462edaf98df63de4a33eee379233ab 100644 --- a/src/modules/_Stdio/termios.c +++ b/src/modules/_Stdio/termios.c @@ -126,6 +126,7 @@ #define FD (THIS->box.fd) #define ERRNO (THIS->my_errno) +#ifdef HAVE_TCGETATTR static int termios_bauds( int speed ) { switch (speed) @@ -158,6 +159,8 @@ static const struct { #undef c_oflag #undef c_lflag +#endif /* HAVE_TCGETATTR */ + void file_tcgetattr(INT32 args) { struct termios ti; @@ -168,6 +171,7 @@ void file_tcgetattr(INT32 args) pop_n_elems(args); +#ifdef HAVE_TCGETATTR if (tcgetattr(FD,&ti)) /* error */ { ERRNO=errno; @@ -216,6 +220,8 @@ void file_tcgetattr(INT32 args) n++; #endif +#endif /* HAVE_TCGETATTR */ + #ifdef TIOCGWINSZ { struct winsize winsize; @@ -235,6 +241,7 @@ void file_tcgetattr(INT32 args) } +#ifdef HAVE_TCGETATTR static int termios_speed( int speed ) { switch (speed) @@ -467,6 +474,8 @@ void file_tcsendbreak(INT32 args) push_int(!tcsendbreak(FD, len)); } +#endif /* HAVE_TCGETATTR */ + #ifdef TIOCSWINSZ /*! @decl int(0..1) tcsetsize(int rows, int cols) *!