[BACK]Return to print.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / libexec / talkd

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/libexec/talkd/print.c between version 1.8 and 1.8.28.1

version 1.8, 2006/03/17 02:12:15 version 1.8.28.1, 2009/05/13 19:18:43
Line 43  __RCSID("$NetBSD$");
Line 43  __RCSID("$NetBSD$");
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/socket.h>  #include <sys/socket.h>
 #include <protocols/talkd.h>  #include <protocols/talkd.h>
   #include <inttypes.h>
 #include <syslog.h>  #include <syslog.h>
 #include <stdio.h>  #include <stdio.h>
 #include "extern.h"  #include "extern.h"
   
 static  char *types[] = {  static  const char *types[] = {
         "leave_invite",          "leave_invite",
         "look_up",          "look_up",
         "delete",          "delete",
Line 55  static char *types[] = {
Line 56  static char *types[] = {
 };  };
 #define NTYPES  (sizeof (types) / sizeof (types[0]))  #define NTYPES  (sizeof (types) / sizeof (types[0]))
   
 static  char *answers[] = {  static  const char *answers[] = {
         "success",          "success",
         "not_here",          "not_here",
         "failed",          "failed",
Line 69  static char *answers[] = {
Line 70  static char *answers[] = {
 #define NANSWERS        (sizeof (answers) / sizeof (answers[0]))  #define NANSWERS        (sizeof (answers) / sizeof (answers[0]))
   
 void  void
 print_request(cp, mp)  print_request(const char *cp, CTL_MSG *mp)
         char *cp;  
         CTL_MSG *mp;  
 {  {
         char tbuf[80], *tp;          char tbuf[80];
           const char *tp;
   
         if (mp->type >= NTYPES) {          if (mp->type >= NTYPES) {
                 (void)snprintf(tbuf, sizeof tbuf, "type %d", mp->type);                  (void)snprintf(tbuf, sizeof tbuf, "type %d", mp->type);
Line 81  print_request(cp, mp)
Line 81  print_request(cp, mp)
         } else          } else
                 tp = types[mp->type];                  tp = types[mp->type];
         syslog(debug ? LOG_DEBUG : LOG_INFO,          syslog(debug ? LOG_DEBUG : LOG_INFO,
             "%s: %s: id %d, l_user %s, r_user %s, r_tty %s",              "%s: %s: id %"PRIu32", l_user %s, r_user %s, r_tty %s",
             cp, tp, mp->id_num, mp->l_name, mp->r_name, mp->r_tty);              cp, tp, mp->id_num, mp->l_name, mp->r_name, mp->r_tty);
 }  }
   
 void  void
 print_response(cp, rp)  print_response(const char *cp, CTL_RESPONSE *rp)
         char *cp;  
         CTL_RESPONSE *rp;  
 {  {
         char tbuf[80], *tp, abuf[80], *ap;          char tbuf[80], abuf[80];
           const char *tp, *ap;
   
         if (rp->type >= NTYPES) {          if (rp->type >= NTYPES) {
                 (void)snprintf(tbuf, sizeof tbuf, "type %d", rp->type);                  (void)snprintf(tbuf, sizeof tbuf, "type %d", rp->type);
Line 102  print_response(cp, rp)
Line 101  print_response(cp, rp)
                 ap = abuf;                  ap = abuf;
         } else          } else
                 ap = answers[rp->answer];                  ap = answers[rp->answer];
         syslog(debug ? LOG_DEBUG : LOG_INFO, "%s: %s: %s, id %d",          syslog(debug ? LOG_DEBUG : LOG_INFO, "%s: %s: %s, id %"PRIu32,
             cp, tp, ap, ntohl(rp->id_num));              cp, tp, ap, ntohl(rp->id_num));
 }  }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.8.28.1

CVSweb <webmaster@jp.NetBSD.org>