1: #include "parms.h"
   2: #include "structs.h"
   3: 
   4: #ifdef  RCSIDENT
   5: static char rcsid[] = "$Header: dmpresp.c,v 1.7 85/01/18 15:09:02 notes Rel $";
   6: #endif	RCSIDENT
   7: 
   8: /*
   9:  *	dmprsp(io, note, notenum, dumpfid, response number)
  10:  *	prints logical response number to the note whose number is
  11:  *	passed in. The note descriptor is also passed in. The dump if
  12:  *	sent to the file pointed to by dumpfid
  13:  *
  14:  *	Original Coding:	Ray Essick December 1981
  15:  *
  16:  */
  17: 
  18: 
  19: dmprsp (io, note, notenum, dmpfile, num, extensive, protocol)
  20: struct io_f *io;
  21: struct note_f  *note;
  22: FILE * dmpfile;
  23: {
  24:     int     roffset,
  25:             rrecnum;
  26:     int     i;
  27:     struct resp_f   rsprec;
  28:     struct when_f  *zdate;
  29:     char    buf[256];                   /* hold intermediate strings */
  30: 
  31:     if (lrsp (io, notenum, num, &rsprec, &roffset, &rrecnum) == -1)
  32:     return;                     /* no response */
  33: 
  34:     switch (protocol)
  35:     {
  36:     case 0:                     /* original protocol */
  37:         fprintf (dmpfile, "R:%s:%ld:%s:%ld:%d\n", note -> n_id.sys,
  38:             note -> n_id.uniqid, rsprec.r_id[roffset].sys,
  39:             rsprec.r_id[roffset].uniqid, num);
  40: 
  41:         fprintf (dmpfile, "%s:%d:%s:\n", rsprec.r_auth[roffset].aname,
  42:             rsprec.r_auth[roffset].aid & UIDMASK,
  43:             rsprec.r_auth[roffset].asystem);
  44: 
  45:         zdate = &rsprec.r_when[roffset];
  46:         fprintf (dmpfile, "%d:%d:%d:%d:%d:%ld:\n", zdate -> w_year, zdate -> w_month,
  47:             zdate -> w_day, zdate -> w_hours, zdate -> w_mins, zdate -> w_gmttime);
  48:         if (extensive)
  49:         {
  50:         zdate = &rsprec.r_rcvd[roffset];
  51:         fprintf (dmpfile, "%d:%d:%d:%d:%d:%ld:\n", zdate -> w_year, zdate -> w_month,
  52:             zdate -> w_day, zdate -> w_hours, zdate -> w_mins, zdate -> w_gmttime);
  53: 
  54:         fprintf (dmpfile, "%s\n", rsprec.r_from[roffset]);
  55:         }
  56: 
  57: 
  58: 
  59:         fprintf (dmpfile, "%03o:%ld\n", rsprec.r_stat[roffset],
  60:             ((long) rsprec.r_addr[roffset].textlen));/* make sure long */
  61: 
  62:         pageout (io, &rsprec.r_addr[roffset], dmpfile);
  63:         break;
  64: 
  65:     case 1:                     /* protocol 1 */
  66:         fprintf (dmpfile, "Protocol: 1 Response\n");/* let it know */
  67:         fprintf (dmpfile, "Title: Re: %s\n", note -> ntitle);
  68:         fprintf (dmpfile, "Parent-ID: %s.%ld\n", note -> n_id.sys,
  69:             note -> n_id.uniqid);
  70:         fprintf (dmpfile, "Author: %s@%s\n",
  71:             rsprec.r_auth[roffset].aname, rsprec.r_auth[roffset].asystem);
  72:         if (extensive)
  73:         fprintf (dmpfile, "Author-UID: %d\n", rsprec.r_auth[roffset].aid);
  74:         fprintf (dmpfile, "Response-ID: %s.%ld\n", rsprec.r_id[roffset].sys,
  75:             rsprec.r_id[roffset].uniqid);
  76:         sprdate (&rsprec.r_when[roffset], buf); /* format date */
  77:         fprintf (dmpfile, "Date-Written: %s\n", buf);
  78:         if (extensive)              /* dump extra information */
  79:         {
  80:         sprdate (&rsprec.r_rcvd[roffset], buf);
  81:         fprintf (dmpfile, "Date-Received: %s\n", buf);
  82:         fprintf (dmpfile, "Source-System: %s\n", rsprec.r_from[roffset]);
  83:         }
  84:         fprintf (dmpfile, "Status:");       /* do the bits */
  85:         if (rsprec.r_stat[roffset] & FRMNEWS)
  86:         fprintf (dmpfile, " Thru-News");
  87:         if (rsprec.r_stat[roffset] & DIRMES)
  88:         fprintf (dmpfile, " Director-Message");
  89:         if (rsprec.r_stat[roffset] & WRITONLY)
  90:         fprintf (dmpfile, " Write-Only");
  91:         if (rsprec.r_stat[roffset] & ORPHND)
  92:         fprintf (dmpfile, " Foster-Parent");
  93:         putc ('\n', dmpfile);
  94:         fprintf (dmpfile, "Text-Length: %ld bytes\n",
  95:             (long) rsprec.r_addr[roffset].textlen);
  96:         pageout (io, &rsprec.r_addr[roffset], dmpfile);/* dump text */
  97:         break;
  98: 
  99:     default:
 100:         fprintf (stderr, "dmpresp: Unsupported Protocol (%d)\n",
 101:             protocol);
 102:         break;
 103:     }
 104: 
 105: }
 106: 
 107: /*	dmpall - dump all the responses to a note.  Merely calls
 108:  *	dmpresp repetitively to dump all of them
 109:  *
 110:  *	Original Coding:	Ray Essick	December 1981
 111:  */
 112: dmprall (io, note, notenum, dmpfile, extensive, protocol)
 113: struct io_f *io;
 114: struct note_f  *note;
 115: FILE * dmpfile;
 116: {
 117:     int     num;
 118: 
 119:     for (num = 1; num <= note -> n_nresp; num++)
 120:     {
 121:     dmprsp (io, note, notenum, dmpfile, num, extensive, protocol);
 122:     }
 123: }

Defined functions

dmprall defined in line 112; used 1 times
dmprsp defined in line 19; used 2 times

Defined variables

rcsid defined in line 5; never used
Last modified: 1985-01-19
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2241
Valid CSS Valid XHTML 1.0 Strict