- (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.

Any more of these and I'll split them out into bsd-termio.[ch].
This commit is contained in:
Darren Tucker 2003-08-13 20:48:07 +10:00
parent 1c52ee3e6f
commit f38ea77c03
4 changed files with 34 additions and 7 deletions

View File

@ -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 $

View File

@ -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))

View File

@ -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 */

View File

@ -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 */