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: #ifndef lint
   8: static char sccsid[] = "@(#)print.c	5.2 (Berkeley) 3/13/86";
   9: #endif not lint
  10: 
  11: /* debug print routines */
  12: 
  13: #include <stdio.h>
  14: #include <syslog.h>
  15: 
  16: #include <protocols/talkd.h>
  17: 
  18: static  char *types[] =
  19:     { "leave_invite", "look_up", "delete", "announce" };
  20: #define NTYPES  (sizeof (types) / sizeof (types[0]))
  21: static  char *answers[] =
  22:     { "success", "not_here", "failed", "machine_unknown", "permission_denied",
  23:       "unknown_request", "badversion", "badaddr", "badctladdr" };
  24: #define NANSWERS    (sizeof (answers) / sizeof (answers[0]))
  25: 
  26: print_request(cp, mp)
  27:     char *cp;
  28:     register CTL_MSG *mp;
  29: {
  30:     char tbuf[80], *tp;
  31: 
  32:     if (mp->type > NTYPES) {
  33:         sprintf(tbuf, "type %d", mp->type);
  34:         tp = tbuf;
  35:     } else
  36:         tp = types[mp->type];
  37:     syslog(LOG_DEBUG, "%s: %s: id %d, l_user %s, r_user %s, r_tty %s",
  38:         cp, tp, mp->id_num, mp->l_name, mp->r_name, mp->r_tty);
  39: }
  40: 
  41: print_response(cp, rp)
  42:     char *cp;
  43:     register CTL_RESPONSE *rp;
  44: {
  45:     char tbuf[80], *tp, abuf[80], *ap;
  46: 
  47:     if (rp->type > NTYPES) {
  48:         sprintf(tbuf, "type %d", rp->type);
  49:         tp = tbuf;
  50:     } else
  51:         tp = types[rp->type];
  52:     if (rp->answer > NANSWERS) {
  53:         sprintf(abuf, "answer %d", rp->answer);
  54:         ap = abuf;
  55:     } else
  56:         ap = answers[rp->answer];
  57:     syslog(LOG_DEBUG, "%s: %s: %s, id %d", cp, tp, ap, ntohl(rp->id_num));
  58: }

Defined functions

print_request defined in line 26; used 9 times
print_response defined in line 41; used 1 times

Defined variables

answers defined in line 21; used 3 times
sccsid defined in line 8; never used
types defined in line 18; used 4 times

Defined macros

NANSWERS defined in line 24; used 1 times
  • in line 52
NTYPES defined in line 20; used 2 times
Last modified: 1986-03-16
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1042
Valid CSS Valid XHTML 1.0 Strict