source: buchla-68k/libcio/conin.c@ 3f2d518

Last change on this file since 3f2d518 was 8973acd, checked in by Thomas Lopatic <thomas@…>, 7 years ago

No more warnings in libcio.

  • Property mode set to 100644
File size: 897 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
10uint8_t _ConBuf[258]; /* console input buffer */
11int16_t _CBused;
12
13int16_t _conin(io_arg arg, void *buff, int16_t len)
14{
15 int16_t nbp;
16 register int16_t l;
17
18 (void)arg;
19
20 if (_ConBuf[1] EQ 0) {
21
22 _ConBuf[0] = 255;
23 _ConBuf[1] = _ConBuf[2] = 0;
24
25 readbuf(CON_DEV, (int8_t *)_ConBuf);
26 writeln(CON_DEV, "\r\n");
27
28 if (_ConBuf[2] EQ 0x1a) {
29
30 _ConBuf[1] = 0;
31 return(0);
32 }
33
34 nbp = ++_ConBuf[1];
35 _ConBuf[nbp++ + 1] = '\r';
36 _ConBuf[nbp + 1] = '\n';
37 _CBused = 2;
38 }
39
40 if ((l = _ConBuf[1]) > len)
41 l = len;
42
43 memcpy(buff, (_ConBuf + _CBused), l);
44 _CBused += l;
45 _ConBuf[1] = (uint8_t)(_ConBuf[1] - l);
46 return (l);
47}
48
Note: See TracBrowser for help on using the repository browser.