1: #include "parms.h"
   2: #include "structs.h"
   3: 
   4: #ifdef  RCSIDENT
   5: static char rcsid[] = "$Header: dmpnote.c,v 1.7.0.1 87/02/25 09:04:58 notes Rel $";
   6: #endif	RCSIDENT
   7: 
   8: /*	dmpnote - dump a note in canonical form. This routine
   9:  *	will take the note specified by the arguement and dump
  10:  *	it in a canonical form..
  11:  *
  12:  *	fid - file to write the output to
  13:  *	note - the current descriptor for that note
  14:  *
  15:  *	Original Coding:	Ray Essick	December 1981
  16:  */
  17: 
  18: 
  19: dmpnote (io, note, num, dmpfile, extensive, protocol)
  20: struct io_f *io;
  21: struct note_f  *note;
  22: FILE * dmpfile;
  23: {
  24:     char    buf[256];                   /* hold some strings */
  25:     int     i;
  26: 
  27: 
  28:     switch (protocol)
  29:     {
  30:     case 0:                     /* original */
  31:         fprintf (dmpfile, "N:%s:%ld:%d\n",
  32:             note -> n_id.sys, note -> n_id.uniqid, note -> n_nresp);
  33:         fprintf (dmpfile, "%s\n", note -> ntitle);
  34: 
  35:         fprintf (dmpfile, "%s:%d:%s:\n", note -> n_auth.aname,
  36:             note -> n_auth.aid & UIDMASK, note -> n_auth.asystem);
  37: 
  38:         fprintf (dmpfile, "%d:%d:%d:%d:%d:%ld:\n", note -> n_date.w_year, note -> n_date.w_month,
  39:             note -> n_date.w_day, note -> n_date.w_hours,
  40:             note -> n_date.w_mins, note -> n_date.w_gmttime);
  41: 
  42:         if (extensive)
  43:         {
  44:         fprintf (dmpfile, "%d:%d:%d:%d:%d:%ld:\n", note -> n_rcvd.w_year, note -> n_rcvd.w_month,
  45:             note -> n_rcvd.w_day, note -> n_rcvd.w_hours,
  46:             note -> n_rcvd.w_mins, note -> n_rcvd.w_gmttime);
  47: 
  48:         fprintf (dmpfile, "%d:%d:%d:%d:%d:%ld:\n", note -> n_lmod.w_year, note -> n_lmod.w_month,
  49:             note -> n_lmod.w_day, note -> n_lmod.w_hours,
  50:             note -> n_lmod.w_mins, note -> n_lmod.w_gmttime);
  51:         fprintf (dmpfile, "%s\n", note -> n_from);/* dump who from */
  52:         }
  53: 
  54: 
  55:         if (note -> n_addr.addr == 0)       /* for orphans */
  56:         note -> n_addr.textlen = 0;     /* used to not init */
  57:         fprintf (dmpfile, "0%03o:%ld\n", note -> n_stat & 0377,
  58:             ((long) note -> n_addr.textlen));   /* make sure long */
  59: 
  60:         pageout (io, &note -> n_addr, dmpfile);
  61:         break;
  62: 
  63:     case 1:                     /* protocol 1 */
  64:         fprintf (dmpfile, "Protocol: 1 Note\n");    /* for loadem */
  65:         fprintf (dmpfile, "Title: %s\n", note -> ntitle);
  66:         fprintf (dmpfile, "Author: %s@%s\n",
  67:             note -> n_auth.aname, note -> n_auth.asystem);
  68:         if (extensive)
  69:         fprintf (dmpfile, "Author-UID: %d\n", note -> n_auth.aid);
  70:         fprintf (dmpfile, "Note-ID: %s.%ld\n", note -> n_id.sys,
  71:             note -> n_id.uniqid);
  72:         sprdate (&note -> n_date, buf);     /* format date */
  73:         fprintf (dmpfile, "Date-Written: %s\n", buf);
  74:         if (extensive)              /* dump extra information */
  75:         {
  76:         sprdate (&note -> n_rcvd, buf);
  77:         fprintf (dmpfile, "Date-Received: %s\n", buf);
  78:         sprdate (&note -> n_lmod, buf);
  79:         fprintf (dmpfile, "Date-Modified: %s\n", buf);
  80:         fprintf (dmpfile, "Source-System: %s\n", note -> n_from);
  81:         }
  82:         fprintf (dmpfile, "Status:");       /* do the bits */
  83:         if (note -> n_stat & FRMNEWS)
  84:         fprintf (dmpfile, " Thru-News");
  85:         if (note -> n_stat & DIRMES)
  86:         fprintf (dmpfile, " Director-Message");
  87:         if (note -> n_stat & WRITONLY)
  88:         fprintf (dmpfile, " Write-Only");
  89:         if (note -> n_stat & ORPHND)
  90:         fprintf (dmpfile, " Foster-Parent");
  91:         putc ('\n', dmpfile);
  92:         if (note -> n_addr.addr == 0)       /* empty */
  93:         note -> n_addr.textlen = 0;
  94:         fprintf (dmpfile, "Text-Length: %ld bytes\n",
  95:             (long) note -> n_addr.textlen);
  96:         pageout (io, &note -> n_addr, dmpfile); /* dump text */
  97:         break;
  98: 
  99: 
 100:     default:
 101:         fprintf (stderr, "dmpnote: Unsupported Protocol (%d)\n",
 102:             protocol);
 103:         break;
 104:     }
 105: 
 106: }

Defined functions

dmpnote defined in line 19; used 3 times

Defined variables

rcsid defined in line 5; never used
Last modified: 1987-02-25
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2491
Valid CSS Valid XHTML 1.0 Strict