source: buchla-68k/libcio/conin.c@ 33b5477

Last change on this file since 33b5477 was 33b5477, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Fixed argument order.

  • Property mode set to 100644
File size: 852 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
10int8_t _ConBuf[258]; /* console input buffer */
11int16_t _CBused;
12
13int16_t _conin(io_arg arg, 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.