⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dobanner.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
字号:
#ifndef lintstatic char *sccsid = "@(#)dobanner.c	4.1	ULTRIX	7/2/90";#endif/************************************************************************ *									* *			Copyright (c) 1988 by				* *		Digital Equipment Corporation, Maynard, MA		* *			All rights reserved.				* *									* *   This software is furnished under a license and may be used and	* *   copied  only  in accordance with the terms of such license and	* *   with the  inclusion  of  the  above  copyright  notice.   This	* *   software  or  any  other copies thereof may not be provided or	* *   otherwise made available to any other person.  No title to and	* *   ownership of the software is hereby transferred.			* *									* *   This software is  derived  from  software  received  from  the	* *   University    of   California,   Berkeley,   and   from   Bell	* *   Laboratories.  Use, duplication, or disclosure is  subject  to	* *   restrictions  under  license  agreements  with  University  of	* *   California and with AT&T.						* *									* *   The information in this software is subject to change  without	* *   notice  and should not be construed as a commitment by Digital	* *   Equipment Corporation.						* *									* *   Digital assumes no responsibility for the use  or  reliability	* *   of its software on equipment which is not supplied by Digital.	* *									* ************************************************************************//* * dobanner.c -- Banner printing stuff * * Description: *	This is the banner stuff from printjob.c *	Note that the form feeds are done separately *//* SCCS history beginning * *************************************************************** *                -- Revision History -- * *************************************************************** *  * 1.1  25/04/88 -- thoms * date and time created 88/04/25 18:57:03 by thoms *  * *************************************************************** * * 1.2  15/07/88 -- thoms * Added copyright notice mod history * SCCS history end */#include "lp.h"static int scan_out();static char *scnline();/* * dobanner -- write a banner to file descriptor */intbanner(ofd, user, job, class)int ofd;			/* where to write to */char *user, *job, *class;{	time_t tvec;	extern char *ctime();	time(&tvec);	if (SB) {	/* short banner only */		if (class[0]) {			(void) write(ofd, class, strlen(class));			(void) write(ofd, ":", 1);		}		(void) write(ofd, user, strlen(user));		(void) write(ofd, "  Job: ", 7);		(void) write(ofd, job, strlen(job));		(void) write(ofd, "  Date: ", 8);		(void) write(ofd, ctime(&tvec), 24);		(void) write(ofd, "\n", 1);	} else {	/* normal banner */		(void) write(ofd, "\n\n\n", 3);		scan_out(ofd, user, '\0');		(void) write(ofd, "\n\n", 2);		scan_out(ofd, job, '\0');		if (class[0]) {			(void) write(ofd,"\n\n\n",3);			scan_out(ofd, class, '\0');		}		(void) write(ofd, "\n\n\n\n\t\t\t\t\tJob:  ", 15);		(void) write(ofd, job, strlen(job));		(void) write(ofd, "\n\t\t\t\t\tDate: ", 12);		(void) write(ofd, ctime(&tvec), 24);		(void) write(ofd, "\n", 1);	}}/* * scnline -- put chars in buffer for scan line (in bits) key */static char *scnline(key, p, c)register char key, *p;	char c;{	register scnwidth;	for (scnwidth = WIDTH; --scnwidth;) {		key <<= 1;		*p++ = key & 0200 ? c : BACKGND;	}	return (p);}#define TRC(q)	(((q)-' ')&0177)/* * scan_out -- write the string scsp up to dlm in BIG letters */staticscan_out(scfd, scsp, dlm)int scfd;char *scsp, dlm;{	register char *strp;	register nchrs, j;	char outbuf[LINELEN+1], *sp, c, cc;	int d, scnhgt;	extern char scnkey[][HEIGHT];	/* in lpdchar.c */	for (scnhgt = 0; scnhgt++ < HEIGHT+DROP; ) {		strp = &outbuf[0];		sp = scsp;		for (nchrs = 0; ; ) {			d = dropit(c = TRC(cc = *sp++));			if ((!d && scnhgt > HEIGHT) || (scnhgt <= DROP && d))				for (j = WIDTH; --j;)					*strp++ = BACKGND;			else				strp = scnline(scnkey[c][scnhgt-1-d], strp, cc);			if (*sp == dlm || *sp == '\0' || nchrs++ >= PW/(WIDTH+1)-1)				break;			*strp++ = BACKGND;			*strp++ = BACKGND;		}		while (*--strp == BACKGND && strp >= outbuf)			;		strp++;		*strp++ = '\n';			(void) write(scfd, outbuf, strp-outbuf);	}}/* * dropit -- character has a descender? */staticdropit(c)	char c;{	switch(c) {	case TRC('_'):	case TRC(';'):	case TRC(','):	case TRC('g'):	case TRC('j'):	case TRC('p'):	case TRC('q'):	case TRC('y'):		return (DROP);	default:		return (0);	}}

⌨️ 快捷键说明

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