summaryrefslogtreecommitdiff
path: root/aux.c
diff options
context:
space:
mode:
Diffstat (limited to 'aux.c')
-rw-r--r--aux.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/aux.c b/aux.c
new file mode 100644
index 000000000..899142da7
--- /dev/null
+++ b/aux.c
@@ -0,0 +1,36 @@
1#include "includes.h"
2RCSID("$OpenBSD: aux.c,v 1.2 2000/05/17 09:47:59 markus Exp $");
3
4#include "ssh.h"
5
6char *
7chop(char *s)
8{
9 char *t = s;
10 while (*t) {
11 if(*t == '\n' || *t == '\r') {
12 *t = '\0';
13 return s;
14 }
15 t++;
16 }
17 return s;
18
19}
20
21void
22set_nonblock(int fd)
23{
24 int val;
25 val = fcntl(fd, F_GETFL, 0);
26 if (val < 0) {
27 error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno));
28 return;
29 }
30 if (val & O_NONBLOCK)
31 return;
32 debug("fd %d setting O_NONBLOCK", fd);
33 val |= O_NONBLOCK;
34 if (fcntl(fd, F_SETFL, val) == -1)
35 error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno));
36}