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

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

Added missing parameter declaration.

  • Property mode set to 100644
File size: 1022 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#define _FS_DEF_ /* to avoid unnecessary externals */
9
10#include "biosdefs.h"
11#include "io.h"
12#include "errno.h"
13#include "fcntl.h"
14#include "stddefs.h"
15
16extern char *memcpy();
17extern int readbuf(), writeln();
18
19char _ConBuf[258]; /* console input buffer */
20int _CBused;
21
22int
23_conin(x, buff, len)
24char *buff;
25int len;
26{
27 int nbp;
28 register int l;
29
30 if (_ConBuf[1] EQ 0) {
31
32 _ConBuf[0] = 255;
33 _ConBuf[1] = _ConBuf[2] = 0;
34
35 readbuf(CON_DEV, _ConBuf);
36 writeln(CON_DEV, "\r\n");
37
38 if (_ConBuf[2] EQ 0x1a) {
39
40 _ConBuf[1] = 0;
41 return(0);
42 }
43
44 nbp = ++_ConBuf[1];
45 _ConBuf[nbp++ + 1] = '\r';
46 _ConBuf[nbp + 1] = '\n';
47 _CBused = 2;
48 }
49
50 if ((l = _ConBuf[1]) > len)
51 l = len;
52
53 memcpy(buff, (_ConBuf + _CBused), l);
54 _CBused += l;
55 _ConBuf[1] -= l;
56 return (l);
57}
Note: See TracBrowser for help on using the repository browser.