1: # include   "ctlmod.h"
   2: # include   "pipes.h"
   3: # include   <sccs.h>
   4: 
   5: SCCSID(@(#)pb_put.c	8.1	12/31/84)
   6: 
   7: /*
   8: **  PB_PUT -- buffered put on pipe
   9: **
  10: **	This routine puts the named data out onto the pipe
  11: **	determined by ppb->pb_proc.
  12: **
  13: **	Parameters:
  14: **		dp -- a pointer to the data to write.
  15: **		len -- the length of the data to write.
  16: **		ppb -- a pointer to the pipe block.
  17: **
  18: **	Returns:
  19: **		none
  20: **
  21: **	Side Effects:
  22: **		none
  23: **
  24: **	Trace Flags:
  25: **		18.8 - 18.15
  26: */
  27: 
  28: pb_put(dp, len, ppb)
  29: register char   *dp;
  30: register int    len;
  31: register pb_t   *ppb;
  32: {
  33:     register int    i;
  34: 
  35: # ifdef xCTR2
  36:     if (tTf(18, 9))
  37:         lprintf("pb_put: len %d\n", len);
  38: # endif
  39: 
  40:     /*
  41: 	**  Top loop.
  42: 	**	Loop until we have run out of things to write.
  43: 	*/
  44: 
  45:     while (len > 0)
  46:     {
  47:         /* compute the length to move */
  48:         i = min(ppb->pb_nleft, len);
  49: # ifdef xCM_DEBUG
  50:         if (i <= 0)
  51:             syserr("pb_put: zero");
  52: # endif
  53: 
  54:         /* move data into buffer and adjust ptrs & counts */
  55:         bmove(dp, ppb->pb_xptr, i);
  56:         dp += i;
  57:         len -= i;
  58:         ppb->pb_xptr += i;
  59:         ppb->pb_nleft -= i;
  60:         ppb->pb_nused += i;
  61: 
  62:         /* flush block if full */
  63:         if (ppb->pb_nleft <= 0)
  64:             pb_write(ppb);
  65:     }
  66: }

Defined functions

pb_put defined in line 5; used 6 times
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 940
Valid CSS Valid XHTML 1.0 Strict