[BACK]Return to aux.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Annotation of src/usr.bin/ssh/aux.c, Revision 1.1

1.1     ! markus      1: #include "includes.h"
        !             2: RCSID("$OpenBSD: aux.c,v 1.12 2000/04/14 10:30:32 markus Exp $");
        !             3:
        !             4: char *
        !             5: chop(char *s)
        !             6: {
        !             7:        char *t = s;
        !             8:        while (*t) {
        !             9:                if(*t == '\n' || *t == '\r') {
        !            10:                        *t = '\0';
        !            11:                        return s;
        !            12:                }
        !            13:                t++;
        !            14:        }
        !            15:        return s;
        !            16:
        !            17: }
        !            18:
        !            19: void
        !            20: set_nonblock(int fd)
        !            21: {
        !            22:        int val;
        !            23:        val = fcntl(fd, F_GETFL, 0);
        !            24:        if (val < 0) {
        !            25:                error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno));
        !            26:                return;
        !            27:        }
        !            28:        if (val & O_NONBLOCK)
        !            29:                return;
        !            30:        debug("fd %d setting O_NONBLOCK", fd);
        !            31:        val |= O_NONBLOCK;
        !            32:        if (fcntl(fd, F_SETFL, val) == -1)
        !            33:                error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno));
        !            34: }