home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / TELECOM / UUCPbb_2_1_src.lzh / UUCPBB21 / dumpcode.c < prev    next >
Text File  |  1994-09-27  |  2KB  |  54 lines

  1. /*  dumpcode.c   This routine writes data sent/received by UUCICO to log file.
  2.     Copyright (C) 1990, 1993  Rick Adams and Bob Billson
  3.  
  4.     This file is part of the OS-9 UUCP package, UUCPbb.
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; either version 2 of the License, or
  9.     (at your option) any later version.
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program; if not, write to the Free Software
  18.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20.     The author of UUCPbb, Bob Billson, can be contacted at:
  21.     bob@kc2wz.bubble.org  or  uunet!kc2wz!bob  or  by snail mail:
  22.     21 Bates Way, Westfield, NJ 07090
  23. */
  24.  
  25. /* Only come here if global variable 'debuglvl' > 7 */
  26.  
  27. #include "uucp.h"
  28. #include "uucico.h"
  29.  
  30.  
  31. int dumpcode (msg, code)
  32. char *msg;
  33. struct pk *code;
  34. {
  35.      static char *ttlist[] = { "CONTROL", "ALTCHN", "LONGDATA", "SHORTDATA" };
  36.      static char *xxxlist[] = {
  37.                 "ZERO", "CLOSE", "RJ", "SRJ", "RR", "INITC", "INITB", "INITA"
  38.               };
  39.  
  40.      short tt, xxx, yyy;
  41.  
  42.      fprintf (log, "    %s ", msg);
  43.      tt = (code->C & 0xC0) >> 6;
  44.      xxx = (code->C & 0x38) >> 3;
  45.      yyy = code->C & 7;
  46.  
  47.      if (tt == 0)
  48.           /* control message */
  49.           fprintf (log, "%s %d\n", xxxlist[xxx], yyy);
  50.      else
  51.           /* packet */
  52.           fprintf (log, "%s seg=%d ackno=%d\n", ttlist[tt], xxx, yyy);
  53. }
  54.