1: /*
   2:  * Copyright (c) 1983 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #if defined(DOSCCS) && !defined(lint)
   8: static char sccsid[] = "@(#)print.c	5.2.1 (2.11BSD GTE) 1/1/94";
   9: #endif
  10: 
  11: /* debug print routines */
  12: 
  13: #include <stdio.h>
  14: #include <syslog.h>
  15: #include <sys/types.h>
  16: #include <netinet/in.h>
  17: 
  18: #include <protocols/talkd.h>
  19: 
  20: static  char *types[] =
  21:     { "leave_invite", "look_up", "delete", "announce" };
  22: #define NTYPES  (sizeof (types) / sizeof (types[0]))
  23: static  char *answers[] =
  24:     { "success", "not_here", "failed", "machine_unknown", "permission_denied",
  25:       "unknown_request", "badversion", "badaddr", "badctladdr" };
  26: #define NANSWERS    (sizeof (answers) / sizeof (answers[0]))
  27: 
  28: print_request(cp, mp)
  29:     char *cp;
  30:     register CTL_MSG *mp;
  31: {
  32:     char tbuf[80], *tp;
  33: 
  34:     if (mp->type > NTYPES) {
  35:         sprintf(tbuf, "type %d", mp->type);
  36:         tp = tbuf;
  37:     } else
  38:         tp = types[mp->type];
  39:     syslog(LOG_DEBUG, "%s: %s: id %d, l_user %s, r_user %s, r_tty %s",
  40:         cp, tp, mp->id_num, mp->l_name, mp->r_name, mp->r_tty);
  41: }
  42: 
  43: print_response(cp, rp)
  44:     char *cp;
  45:     register CTL_RESPONSE *rp;
  46: {
  47:     char tbuf[80], *tp, abuf[80], *ap;
  48: 
  49:     if (rp->type > NTYPES) {
  50:         sprintf(tbuf, "type %d", rp->type);
  51:         tp = tbuf;
  52:     } else
  53:         tp = types[rp->type];
  54:     if (rp->answer > NANSWERS) {
  55:         sprintf(abuf, "answer %d", rp->answer);
  56:         ap = abuf;
  57:     } else
  58:         ap = answers[rp->answer];
  59:     syslog(LOG_DEBUG, "%s: %s: %s, id %ld", cp, tp, ap, ntohl(rp->id_num));
  60: }

Defined functions

print_request defined in line 28; used 9 times
print_response defined in line 43; used 1 times

Defined variables

answers defined in line 23; used 3 times
sccsid defined in line 8; never used
types defined in line 20; used 4 times

Defined macros

NANSWERS defined in line 26; used 1 times
  • in line 54
NTYPES defined in line 22; used 2 times
Last modified: 1994-01-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2802
Valid CSS Valid XHTML 1.0 Strict