diff --git a/ChangeLog b/ChangeLog index 2140b20c8..47e97438b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,9 @@ - markus@cvs.openbsd.org 2003/08/13 09:07:10 [readconf.c ssh.c] socks4->socks, since with support both 4 and 5; dtucker@zip.com.au + - (dtucker) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h] + Add a tcsendbreak function for platforms that don't have one, based on the + one from OpenBSD. 20030811 - (dtucker) OpenBSD CVS Sync @@ -831,4 +834,4 @@ - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. Report from murple@murple.net, diagnosis from dtucker@zip.com.au -$Id: ChangeLog,v 1.2892 2003/08/13 10:38:36 dtucker Exp $ +$Id: ChangeLog,v 1.2893 2003/08/13 10:48:07 dtucker Exp $ diff --git a/configure.ac b/configure.ac index 68fa5c1f2..9644dcaf2 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.138 2003/08/02 12:24:49 dtucker Exp $ +# $Id: configure.ac,v 1.139 2003/08/13 10:48:07 dtucker Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -695,8 +695,8 @@ AC_CHECK_FUNCS(\ setdtablesize setegid setenv seteuid setgroups setlogin setpcred \ setproctitle setregid setresgid setresuid setreuid setrlimit \ setsid setvbuf sigaction sigvec snprintf socketpair strerror \ - strlcat strlcpy strmode strnvis sysconf tcgetpgrp truncate utimes \ - vhangup vsnprintf waitpid \ + strlcat strlcpy strmode strnvis sysconf tcgetpgrp tcsendbreak \ + truncate utimes vhangup vsnprintf waitpid \ ) AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP)) diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index da8f77046..d4c793724 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c @@ -25,7 +25,7 @@ #include "includes.h" #include "xmalloc.h" -RCSID("$Id: bsd-misc.c,v 1.16 2003/08/02 14:36:16 dtucker Exp $"); +RCSID("$Id: bsd-misc.c,v 1.17 2003/08/13 10:48:07 dtucker Exp $"); /* * NB. duplicate __progname in case it is an alias for argv[0] @@ -180,3 +180,23 @@ tcgetpgrp(int fd) } #endif /* HAVE_TCGETPGRP */ +#ifndef HAVE_TCSENDBREAK +int +tcsendbreak(int fd, int duration) +{ +# if defined(TIOCSBRK) && defined(TIOCCBRK) + struct timeval sleepytime; + + sleepytime.tv_sec = 0; + sleepytime.tv_usec = 400000; + if (ioctl(fd, TIOCSBRK, 0) == -1) + return (-1); + (void)select(0, 0, 0, 0, &sleepytime); + if (ioctl(fd, TIOCCBRK, 0) == -1) + return (-1); + return (0); +# else + return -1; +# endif +} +#endif /* HAVE_TCSENDBREAK */ diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h index 03a1f3af0..f2fbdc2e3 100644 --- a/openbsd-compat/bsd-misc.h +++ b/openbsd-compat/bsd-misc.h @@ -22,7 +22,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: bsd-misc.h,v 1.9 2003/08/02 13:31:42 dtucker Exp $ */ +/* $Id: bsd-misc.h,v 1.10 2003/08/13 10:48:07 dtucker Exp $ */ #ifndef _BSD_MISC_H #define _BSD_MISC_H @@ -91,6 +91,10 @@ int nanosleep(const struct timespec *, struct timespec *); #ifndef HAVE_TCGETPGRP pid_t tcgetpgrp(int); -#endif /* HAVE_TCGETPGRP */ +#endif + +#ifndef HAVE_TCSENDBREAK +int tcsendbreak(int, int); +#endif #endif /* _BSD_MISC_H */