Last change
on this file since 4aa78b2 was b28a12e, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Zero redundant declarations.
|
-
Property mode
set to
100644
|
File size:
840 bytes
|
Line | |
---|
1 | /*
|
---|
2 | =============================================================================
|
---|
3 | conin.c -- read from the console
|
---|
4 | Version 6 -- 1987-06-30 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "ram.h"
|
---|
9 |
|
---|
10 | int8_t _ConBuf[258]; /* console input buffer */
|
---|
11 | int16_t _CBused;
|
---|
12 |
|
---|
13 | int16_t _conin(int8_t *buff, int16_t len)
|
---|
14 | {
|
---|
15 | int16_t nbp;
|
---|
16 | register int16_t l;
|
---|
17 |
|
---|
18 | if (_ConBuf[1] EQ 0) {
|
---|
19 |
|
---|
20 | _ConBuf[0] = 255;
|
---|
21 | _ConBuf[1] = _ConBuf[2] = 0;
|
---|
22 |
|
---|
23 | readbuf(CON_DEV, _ConBuf);
|
---|
24 | writeln(CON_DEV, "\r\n");
|
---|
25 |
|
---|
26 | if (_ConBuf[2] EQ 0x1a) {
|
---|
27 |
|
---|
28 | _ConBuf[1] = 0;
|
---|
29 | return(0);
|
---|
30 | }
|
---|
31 |
|
---|
32 | nbp = ++_ConBuf[1];
|
---|
33 | _ConBuf[nbp++ + 1] = '\r';
|
---|
34 | _ConBuf[nbp + 1] = '\n';
|
---|
35 | _CBused = 2;
|
---|
36 | }
|
---|
37 |
|
---|
38 | if ((l = _ConBuf[1]) > len)
|
---|
39 | l = len;
|
---|
40 |
|
---|
41 | memcpy(buff, (_ConBuf + _CBused), l);
|
---|
42 | _CBused += l;
|
---|
43 | _ConBuf[1] -= l;
|
---|
44 | return (l);
|
---|
45 | }
|
---|
46 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.