diff --git a/src/modules/files/file.c b/src/modules/files/file.c index 271d07c52ff747323113e6c5306a71197d1b358d..343aed767f01b5f94befe978460b3f24bdbaf942 100644 --- a/src/modules/files/file.c +++ b/src/modules/files/file.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: file.c,v 1.152 1999/05/02 08:12:48 hubbe Exp $"); +RCSID("$Id: file.c,v 1.153 1999/05/09 10:28:00 mirar Exp $"); #include "fdlib.h" #include "interpret.h" #include "svalue.h" @@ -2549,7 +2549,8 @@ void check_static_file_data(struct callback *a, void *b, void *c) #if defined(HAVE_TERMIOS_H) void file_tcgetattr(INT32 args); void file_tcsetattr(INT32 args); -/* void file_tcsendbreak(INT32 args); */ +void file_tcsendbreak(INT32 args); +void file_tcflush(INT32 args); /* void file_tcdrain(INT32 args); */ /* void file_tcflow(INT32 args); */ /* void file_tcgetpgrp(INT32 args); */ diff --git a/src/modules/files/file_functions.h b/src/modules/files/file_functions.h index e0788c25a9b3eac201779d9b9cc92e0e29c7caee..689e94bf28b2f4263f4b81f9bdf9a46ed33ee8a3 100644 --- a/src/modules/files/file_functions.h +++ b/src/modules/files/file_functions.h @@ -59,7 +59,8 @@ #if defined(HAVE_TERMIOS_H) FILE_FUNC("tcgetattr",file_tcgetattr,"function(void:mapping)") FILE_FUNC("tcsetattr",file_tcsetattr,"function(mapping,void|string:int)") -/* FILE_FUNC("tcsendbreak",file_tcsendbreak,"function(int:int)") */ + FILE_FUNC("tcsendbreak",file_tcsendbreak,"function(int:int)") + FILE_FUNC("tcflush",file_tcflush,"function(void:string)") /* FILE_FUNC("tcdrain",file_tcdrain,"function(void:int)") */ /* FILE_FUNC("tcflow",file_tcflow,"function(string:int)") */ /* FILE_FUNC("tcgetpgrp",file_tcgetpgrp,"function(void:int)") */ diff --git a/src/modules/files/termios.c b/src/modules/files/termios.c index 7b37f0cda29c696fbe85f6188358a75c934107d0..21470b6c8d6cacc027a1b2ecef7675c176db24eb 100644 --- a/src/modules/files/termios.c +++ b/src/modules/files/termios.c @@ -1,5 +1,5 @@ #include "global.h" -RCSID("$Id: termios.c,v 1.3 1998/12/18 17:26:55 mirar Exp $"); +RCSID("$Id: termios.c,v 1.4 1999/05/09 10:28:02 mirar Exp $"); #include "file_machine.h" #if defined(HAVE_TERMIOS_H) @@ -303,6 +303,43 @@ void file_tcsetattr(INT32 args) push_int(!tcsetattr(FD,optional_actions,&ti)); } +void file_tcflush(INT32 args) +{ + int action=TCIOFLUSH; + + if(args) + { + struct pike_string *a, *s_tciflush, *s_tcoflush, *s_tcioflush; + MAKE_CONSTANT_SHARED_STRING( s_tciflush, "TCIFLUSH" ); + MAKE_CONSTANT_SHARED_STRING( s_tcoflush, "TCOFLUSH" ); + MAKE_CONSTANT_SHARED_STRING( s_tcioflush, "TCIOFLUSH" ); + get_all_args( "tcflush", args, "%S", &a ); + if(a == s_tciflush ) + action=TCIFLUSH; + else if(a == s_tcoflush ) + action=TCOFLUSH; + +#ifdef TCIOFLUSH + else if(a == s_tcioflush ) + action=TCIOFLUSH; +#endif + free_string( s_tcoflush ); + free_string( s_tciflush ); + free_string( s_tcioflush ); + pop_stack(); + } + push_int(!tcflush(FD, action)); +} + +void file_tcsendbreak(INT32 args) +{ + int len=0; + + get_all_args("tcsendbreak", args, "%d", &len); + pop_stack(); + push_int(!tcsendbreak(FD, len)); +} + /* end of termios stuff */ #endif