home *** CD-ROM | disk | FTP | other *** search
- /*
- * c-tree server for netbios
- * printf and putch implementations that go straight to bios
- *
- * This program is the CONFIDENTIAL and PROPRIETARY property
- * of FairCom(R) Corporation. Any unauthorized use, reproduction or
- * transfer of this program is strictly prohibited.
- *
- * Copyright (c) 1987, 1988, 1989 FairCom Corporation
- * (Subject to limited distribution and
- * restricted disclosure only.)
- * *** ALL RIGHTS RESERVED ***
- *
- * 4006 West Broadway
- * Columbia, MO 65203
- *
- *
- * c-tree(R) Version 4.3
- * Release C
- * February 7, 1989 17:30
- *
- */
-
-
- /* printf and putch
- * these replace library versions of same for the netbios version
- * of c-tree server. The bios is called directly for character output
- * for following reasons:
- * - disallow ctl-break of server process during start/stat/fatal-err
- * reports
- * - allow debug messages to be issued at any time by server
- */
-
- #include <dos.h> /* cpu regs structure */
-
- static char pfbuf[512]; /* handle pretty long lines */
-
- void putch(c)
- int c;
- {
- union REGS r;
- r.h.ah = 14;
- r.h.al = c;
- r.x.bx = 7;
- int86(0x10, &r, &r);
- }
-
-
-
- int printf(fmt)
- char *fmt;
- {
- char *ap;
- register int i;
- register int len;
- static int col = 0;
-
- ap = (char *)&fmt + sizeof(fmt);
- len = vsprintf(pfbuf, fmt, ap);
- for(i=0; i<len; i++)
- {
- switch(pfbuf[i])
- {
- case '\n':
- col = 0;
- putch('\r');
- putch('\n');
- break;
- case '\t':
- do
- putch(' ');
- while (7 & ++col);
- break;
- default:
- putch(pfbuf[i]);
- }
- }
- return len;
- }
-
-