Last change
on this file since 0170798 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
1.5 KB
|
Line | |
---|
1 | /*
|
---|
2 | =============================================================================
|
---|
3 | printf.c -- printf function
|
---|
4 | Version 6 -- 1987-08-13 -- D.N. Lynx Crowe
|
---|
5 |
|
---|
6 | RECOVERED From: Version 5 -- 1987-06-16 -- D.N. Lynx Crowe
|
---|
7 |
|
---|
8 | "Crufty code" Warning:
|
---|
9 | Since this isn't Unix(tm), we prepend a '\r' when we see a '\n'.
|
---|
10 | We also return a long, since this is a 32 bit address machine.
|
---|
11 | (Well, almost 32 bits. Too big for an Alcyon 16 bit int anyway.)
|
---|
12 | =============================================================================
|
---|
13 | */
|
---|
14 |
|
---|
15 | #include "stddefs.h"
|
---|
16 | #include "biosdefs.h"
|
---|
17 | #include "varargs.h"
|
---|
18 |
|
---|
19 | extern long dofmt_();
|
---|
20 |
|
---|
21 | /*
|
---|
22 | =============================================================================
|
---|
23 | printf(fmt, args) -- output 'args' according to 'fmt' on CON_DEV
|
---|
24 | =============================================================================
|
---|
25 | */
|
---|
26 |
|
---|
27 | long
|
---|
28 | printf(fmt, va_alist)
|
---|
29 | char *fmt;
|
---|
30 | va_dcl
|
---|
31 | {
|
---|
32 | register long count;
|
---|
33 | int fpsub();
|
---|
34 | va_list aptr;
|
---|
35 |
|
---|
36 | va_start(aptr);
|
---|
37 | count = dofmt_(fpsub, fmt, aptr);
|
---|
38 | va_end(aptr);
|
---|
39 | return(count);
|
---|
40 | }
|
---|
41 |
|
---|
42 | /*
|
---|
43 | =============================================================================
|
---|
44 | fpsub(c) -- output 'c' to CON_DEV
|
---|
45 | =============================================================================
|
---|
46 | */
|
---|
47 |
|
---|
48 | static
|
---|
49 | int
|
---|
50 | fpsub(c)
|
---|
51 | int c;
|
---|
52 | {
|
---|
53 | /* KLUDGE: since we aren't Unix(tm) we prepend a CR to LF's */
|
---|
54 |
|
---|
55 | if (c EQ '\n')
|
---|
56 | BIOS(B_PUTC, CON_DEV, '\r');
|
---|
57 |
|
---|
58 | BIOS(B_PUTC, CON_DEV, c);
|
---|
59 | return(c);
|
---|
60 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.