conoutput.c,v

来自「TCP-IP红宝书源代码」· C,V 代码 · 共 83 行

C,V
83
字号
head	1.1;
access;
symbols;
locks
	dls:1.1; strict;
comment	@ * @;


1.1
date	94.05.08.05.36.49;	author dls;	state Old;
branches;
next	;


desc
@@


1.1
log
@Initial revision
@
text
@/* conoutput.c - conputc conwrite */

#include <conf.h>
#include <kernel.h>
#include <io.h>
#include <tty.h>    
#include <sunromvec.h>    

#define prputchar(x) (romp->v_fwritechar)((unsigned char) x)

/*------------------------------------------------------------------------
 *  conputc - write one character to the SUN physical monitor
 *------------------------------------------------------------------------
 */
conputc(devptr, c )
	struct	devsw	*devptr;
     	register unsigned char c;
{
	if ( c == 0 )
		return;
	if ( c > 127 ) {
	    prputchar('M');		/* do what "cat -v" does */
	    prputchar('-');		/* prom routine dies otherwise */
	    prputchar((char) (c & 0x007f) );
	    return;
	}

	if (c==NEWLINE)
	    prputchar(RETURN);

	prputchar(c);
}


/*------------------------------------------------------------------------
 *  conwrite - write to the SUN physical monitor
 *------------------------------------------------------------------------
 */
conwrite(devptr, buff, count)
	struct	devsw	*devptr;
	char *buff;
	int count;
{

    if (count < 0)
	return(SYSERR);
    if (count == 0)
	return(OK);

    for (; count>0 ; count--)
	conputc(devptr, *buff++);

    return(OK);
}




@

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?