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

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

Unix line breaks.

  • Property mode set to 100644
File size: 1013 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;
25{
26 int nbp;
27 register int l;
28
29 if (_ConBuf[1] EQ 0) {
30
31 _ConBuf[0] = 255;
32 _ConBuf[1] = _ConBuf[2] = 0;
33
34 readbuf(CON_DEV, _ConBuf);
35 writeln(CON_DEV, "\r\n");
36
37 if (_ConBuf[2] EQ 0x1a) {
38
39 _ConBuf[1] = 0;
40 return(0);
41 }
42
43 nbp = ++_ConBuf[1];
44 _ConBuf[nbp++ + 1] = '\r';
45 _ConBuf[nbp + 1] = '\n';
46 _CBused = 2;
47 }
48
49 if ((l = _ConBuf[1]) > len)
50 l = len;
51
52 memcpy(buff, (_ConBuf + _CBused), l);
53 _CBused += l;
54 _ConBuf[1] -= l;
55 return (l);
56}
Note: See TracBrowser for help on using the repository browser.