print.c

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 91 行

C
91
字号
#ifndef lintstatic	char	*sccsid = "@(#)print.c	4.1	(ULTRIX)	7/2/90";#endif lint/************************************************************************ *									* *			Copyright (c) 1984,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.	* *									* ************************************************************************//* * Copyright (c) 1983 Regents of the University of California. * All rights reserved.  The Berkeley software License Agreement * specifies the terms and conditions for redistribution. *//*#ifndef lintstatic char sccsid[] = "print.c	5.4 (Berkeley) 10/22/87";#endif not lint*//* debug print routines */#include <stdio.h>#include <syslog.h>#include <sys/param.h>#include <protocols/talkd.h>static	char *types[] =    { "leave_invite", "look_up", "delete", "announce" };#define	NTYPES	(sizeof (types) / sizeof (types[0]))static	char *answers[] =     { "success", "not_here", "failed", "machine_unknown", "permission_denied",      "unknown_request", "badversion", "badaddr", "badctladdr" };#define	NANSWERS	(sizeof (answers) / sizeof (answers[0]))print_request(cp, mp)	char *cp;	register CTL_MSG *mp;{	char tbuf[80], *tp;		if (mp->type > NTYPES) {		(void)sprintf(tbuf, "type %d", mp->type);		tp = tbuf;	} else		tp = types[mp->type];	syslog(LOG_DEBUG, "%s: %s: id %d, l_user %s, r_user %s",	    cp, tp, mp->id_num, mp->l_name, mp->r_name);}print_response(cp, rp)	char *cp;	register CTL_RESPONSE *rp;{	char tbuf[80], *tp, abuf[80], *ap;		if (rp->type > NTYPES) {		(void)sprintf(tbuf, "type %d", rp->type);		tp = tbuf;	} else		tp = types[rp->type];	if (rp->answer > NANSWERS) {		(void)sprintf(abuf, "answer %d", rp->answer);		ap = abuf;	} else		ap = answers[rp->answer];	syslog(LOG_DEBUG, "%s: %s: %s, id %d", cp, tp, ap, ntohl(rp->id_num));}

⌨️ 快捷键说明

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