#include #include #include #include "select.h" /** Zero all the file descriptor sets. * * @param set select set * @param fd file descriptor * @return 0 on success, -1 otherwise */ void SelectSet_zero(SelectSet *set){ set->n = 0; FD_ZERO(&set->rd); FD_ZERO(&set->wr); FD_ZERO(&set->er); } /** Add a file descriptor to the write set. * * @param set select set * @param fd file descriptor * @return 0 on success, -1 otherwise */ void SelectSet_add_read(SelectSet *set, int fd){ FD_SET(fd, &set->rd); if(fd > set->n) set->n = fd; } /** Add a file descriptor to the write set. * * @param set select set * @param fd file descriptor * @return 0 on success, -1 otherwise */ void SelectSet_add_write(SelectSet *set, int fd){ FD_SET(fd, &set->wr); if(fd > set->n) set->n = fd; } /** Select on file descriptors. * * @param set select set * @param timeout timeout (may be NULL for no timeout) * @return 0 on success, -1 otherwise */ int SelectSet_select(SelectSet *set, struct timeval *timeout){ return select(set->n+1, &set->rd, &set->wr, &set->er, timeout); } orm> [no description]
aboutsummaryrefslogtreecommitdiffstats
blob: d945949a41d53b86cf4fff2850a0f7d684c9a6f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* Copyright 2017 Jack Humbert
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef PROCESS_TERMINAL_H
#define PROCESS_TERMINAL_H

#include "quantum.h"

extern const char keycode_to_ascii_lut[58];
extern const char shifted_keycode_to_ascii_lut[58];
extern const char terminal_prompt[8];
bool process_terminal(uint16_t keycode, keyrecord_t *record);

#endif