annotate target-utils/calversion/mygetchar.c @ 442:ba4171b2f980

target-utils/Makefile: calversion added
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 26 Dec 2018 07:04:32 +0000
parents 1dcc9e4b71fd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
441
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * The interactive command entry (editing) function in libcommon
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * will call mygetchar() for its character input. It is supposed
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * to be a blocking wait for input, but in some programs other
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * processing can be done while waiting - for example, check for
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * keypad presses as well. This is the basic version which waits
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 * for serial input and nothing else.
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 */
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 extern int serial_in_poll();
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 int
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 mygetchar()
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 {
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 register int c;
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 do
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 c = serial_in_poll();
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 while (c < 0);
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 return c;
1dcc9e4b71fd target-utils/calversion: program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 }