GNU Octave
4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
wait-for-input.c
Go to the documentation of this file.
1
/*
2
3
Copyright (C) 2016-2018 John W. Eaton
4
5
This file is part of Octave.
6
7
Octave is free software: you can redistribute it and/or modify it
8
under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 3 of the License, or
10
(at your option) any later version.
11
12
Octave is distributed in the hope that it will be useful, but
13
WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
16
17
You should have received a copy of the GNU General Public License
18
along with Octave; see the file COPYING. If not, see
19
<https://www.gnu.org/licenses/>.
20
21
*/
22
23
// select may be provided by gnulib. We don't include gnulib headers
24
// directly in Octave's C++ source files to avoid problems that may be
25
// caused by the way that gnulib overrides standard library functions.
26
27
// We don't need select directly, we just need to use it to wait for
28
// input on an open file descriptor.
29
30
#if defined (HAVE_CONFIG_H)
31
# include "config.h"
32
#endif
33
34
#include <sys/select.h>
35
36
#include "
wait-for-input.h
"
37
38
int
39
octave_wait_for_input
(
int
fid
)
40
{
41
int
retval
= -1;
42
43
#if defined (HAVE_SELECT)
44
if
(
fid
>= 0)
45
{
46
fd_set
set
;
47
48
FD_ZERO (&
set
);
49
FD_SET (
fid
, &
set
);
50
51
retval
= select (FD_SETSIZE, &
set
, 0, 0, 0);
52
}
53
#else
54
octave_unused_parameter (
fid
);
55
56
retval
= 1;
57
#endif
58
59
return
retval
;
60
}
retval
octave_value retval
Definition:
data.cc:6246
wait-for-input.h
octave_wait_for_input
int octave_wait_for_input(int fid)
Definition:
wait-for-input.c:39
fid
int fid
Definition:
file-io.cc:625
liboctave
wrappers
wait-for-input.c
Generated on Sat Sep 1 2018 14:01:47 for GNU Octave by
1.8.14