diff options
author | kris <kris@FreeBSD.org> | 2000-06-03 09:20:19 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2000-06-03 09:20:19 +0000 |
commit | 585dc667de870922b14ce5a99c088c1a68de7934 (patch) | |
tree | cd954394127ade437854c42bd29f4b7aa34b45fd /crypto/openssh/aux.c | |
parent | e503398156edd9b3ad9ebac248c30f5d5380f379 (diff) | |
download | FreeBSD-src-585dc667de870922b14ce5a99c088c1a68de7934.zip FreeBSD-src-585dc667de870922b14ce5a99c088c1a68de7934.tar.gz |
Import from vendor repository.
Obtained from: OpenBSD
Diffstat (limited to 'crypto/openssh/aux.c')
-rw-r--r-- | crypto/openssh/aux.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/crypto/openssh/aux.c b/crypto/openssh/aux.c new file mode 100644 index 0000000..899142d --- /dev/null +++ b/crypto/openssh/aux.c @@ -0,0 +1,36 @@ +#include "includes.h" +RCSID("$OpenBSD: aux.c,v 1.2 2000/05/17 09:47:59 markus Exp $"); + +#include "ssh.h" + +char * +chop(char *s) +{ + char *t = s; + while (*t) { + if(*t == '\n' || *t == '\r') { + *t = '\0'; + return s; + } + t++; + } + return s; + +} + +void +set_nonblock(int fd) +{ + int val; + val = fcntl(fd, F_GETFL, 0); + if (val < 0) { + error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno)); + return; + } + if (val & O_NONBLOCK) + return; + debug("fd %d setting O_NONBLOCK", fd); + val |= O_NONBLOCK; + if (fcntl(fd, F_SETFL, val) == -1) + error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno)); +} |