source: buchla-68k/orig/lib/INCLUDE/LIBC.H@ a838f5b

Last change on this file since a838f5b was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

  • Property mode set to 100755
File size: 2.2 KB
Line 
1/*
2 ============================================================================
3 libc.h -- "One stop source" of C library definitions for the Buchla 700
4 Version 4 -- 1987-07-01 -- D.N. Lynx Crowe
5
6 This defines a lot of what fspars.h, stdio.h, io.h, and fcntl.h
7 have to offer, which means, of course, that you must not use
8 this header file if you use one of those.
9 ============================================================================
10*/
11
12#include "fspars.h" /* file system parameters */
13
14extern int errno; /* most recent error code */
15
16struct channel {
17
18 char c_read;
19 char c_write;
20 char c_ioctl;
21 char c_seek;
22 int (*c_close)();
23 arg c_arg;
24} ;
25
26struct channel chantab[MAXCHAN];
27
28#define NULL 0
29#define EOF -1
30
31#define _BUSY 0x01
32#define _ALLBUF 0x02
33#define _DIRTY 0x04
34#define _EOF 0x08
35#define _IOERR 0x10
36
37typedef struct {
38
39 char *_bp; /* current position in buffer */
40 char *_bend; /* last character in buffer + 1 */
41 char *_buff; /* address of buffer */
42 char _flags; /* {_BUSY, _ALLBUF, _DIRTY, _EOF, _IOERR} */
43 char _unit; /* fd token returned by open */
44 char _bytbuf; /* single byte buffer for unbuffered streams */
45 char _pad; /* pad for alignment -- possibly use later */
46 int _buflen; /* length of buffer */
47
48} FILE;
49
50extern FILE Cbuffs[NSTREAMS]; /* table of FILE structures */
51extern char *Stdbufs; /* free list of buffers */
52extern long ftell();
53
54#define stdin (&Cbuffs[0])
55#define stdout (&Cbuffs[1])
56#define stderr (&Cbuffs[2])
57#define getchar() agetc(stdin)
58#define putchar(c) aputc(c, stdout)
59#define feof(fp) (((fp)->_flags&_EOF)!=0)
60#define ferror(fp) (((fp)->_flags&_IOERR)!=0)
61#define clearerr(fp) ((fp)->_flags &= ~(_IOERR|_EOF))
62#define fileno(fp) ((fp)->_unit)
63
64#define O_RDONLY 0x0000 /* Read-only value */
65#define O_WRONLY 0x0001 /* Write-only value */
66#define O_RDWR 0x0002 /* Read-write value */
67
68#define O_NDELAY 0x0004 /* Non-blocking I/O flag */
69#define O_APPEND 0x0008 /* Append mode flag (write only at end) */
70
71#define O_CREAT 0x0100 /* File creation flag (uses 3rd argument) */
72#define O_TRUNC 0x0200 /* File truncation flag */
73#define O_EXCL 0x0400 /* Exclusive access flag */
74
75#define O_RAW 0x8000 /* Raw (binary) I/O flag for getc and putc */
Note: See TracBrowser for help on using the repository browser.