2 5e11c00c 2021-03-02 op * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
4 5e11c00c 2021-03-02 op * Permission to use, copy, modify, and distribute this software for any
5 5e11c00c 2021-03-02 op * purpose with or without fee is hereby granted, provided that the above
6 5e11c00c 2021-03-02 op * copyright notice and this permission notice appear in all copies.
8 5e11c00c 2021-03-02 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 5e11c00c 2021-03-02 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 5e11c00c 2021-03-02 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 5e11c00c 2021-03-02 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 5e11c00c 2021-03-02 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 5e11c00c 2021-03-02 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 5e11c00c 2021-03-02 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 5e11c00c 2021-03-02 op #include "telescope.h"
19 5e11c00c 2021-03-02 op #include <fcntl.h>
22 5e11c00c 2021-03-02 op mark_nonblock(int fd)
26 5e11c00c 2021-03-02 op if ((flags = fcntl(fd, F_GETFL)) == -1)
28 5e11c00c 2021-03-02 op if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1)
34 5e11c00c 2021-03-02 op telescope_strnchr(char *b, char d, size_t len)
38 5e11c00c 2021-03-02 op for (i = 0; i < len; ++i) {
39 5e11c00c 2021-03-02 op if (b[i] == d)