1: # include   "ctlmod.h"
   2: # include   "pipes.h"
   3: # include   <sccs.h>
   4: 
   5: SCCSID(@(#)pb_write.c	8.1	12/31/84)
   6: 
   7: /*
   8: **  PB_WRITE -- Write pipe block
   9: **
  10: **	Writes the block specified by ppb to the pipe implied by
  11: **	ppb->pb_proc.  Also handles broadcase messages.
  12: **
  13: **	Parameters:
  14: **		ppb -- a ptr to the pipe block to write.
  15: **
  16: **	Returns:
  17: **		none
  18: **
  19: **	Side Effects:
  20: **		none
  21: **
  22: **	Trace Flags:
  23: **		12.10 - 12.15
  24: */
  25: 
  26: pb_write(ppb)
  27: register pb_t   *ppb;
  28: {
  29:     register int    i;
  30: 
  31: # ifdef xCTR1
  32:     if (tTf(12, 10))
  33:     {
  34:         lprintf("pb_write: ");
  35:         pb_dump(ppb, TRUE);
  36:     }
  37: # endif
  38: 
  39:     /* handle broadcast messages */
  40:     if (ppb->pb_proc == PB_WILD)
  41:     {
  42:         /* write on all pipes marked as a broadcast pipe */
  43:         for (i = 0; i < CM_MAXPROC; i++)
  44:         {
  45:             if ((Cm.cm_proc[i].pr_stat & PR_BCAST) != 0)
  46:                 pb_wphys(ppb, Cm.cm_proc[i].pr_file);
  47:         }
  48:     }
  49:     else
  50:     {
  51:         /* normal message */
  52:         i = ppb->pb_proc;
  53: # ifdef xCM_DEBUG
  54:         if (i > CM_MAXPROC || i < 0)
  55:             syserr("pb_write: proc %d", i);
  56: # endif
  57: # ifdef xCTR1
  58:         if (tTf(12, 11))
  59:             printf("pb_write: proc %d fd=%d\n", i, Cm.cm_proc[i].pr_file);
  60: # endif
  61:         pb_wphys(ppb, Cm.cm_proc[i].pr_file);
  62:     }
  63: 
  64:     /* determine the new input */
  65:     if ((ppb->pb_stat & (PB_INFO|PB_EOF)) == PB_EOF)
  66:         Cm.cm_input = Cm.cm_proc[ppb->pb_proc].pr_ninput;
  67: 
  68:     /* reset some exciting pointers */
  69:     ppb->pb_xptr = ppb->pb_data;
  70:     ppb->pb_nleft = PB_DBSIZE;
  71:     ppb->pb_nused = 0;
  72: }
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1102
Valid CSS Valid XHTML 1.0 Strict