]> andersk Git - openssh.git/blob - aux.c
doc
[openssh.git] / aux.c
1 #include "includes.h"
2 RCSID("$OpenBSD: aux.c,v 1.2 2000/05/17 09:47:59 markus Exp $");
3
4 #include "ssh.h"
5
6 char *
7 chop(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
21 void
22 set_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 }
This page took 0.036722 seconds and 5 git commands to generate.