annotate target-utils/c139-lldbg/mygetchar.c @ 982:461f7ee5f254

fc-olddump: brown paper bag
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Thu, 10 Dec 2015 05:35:42 +0000
parents d7830aee0d35
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
955
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 * The interactive command entry (editing) function in libcommon
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 * will call mygetchar() for its character input. It is supposed
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4 * to be a blocking wait for input, but in some programs other
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 * processing can be done while waiting - for example, check for
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 * keypad presses as well. This is the basic version which waits
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 * for serial input and nothing else.
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8 */
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10 extern int serial_in_poll();
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12 int
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 mygetchar()
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14 {
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15 register int c;
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17 do
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18 c = serial_in_poll();
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 while (c < 0);
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20 return c;
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 }