1: # include   <sccs.h>
   2: 
   3: SCCSID(@(#)pmove.c	8.1	12/31/84)
   4: 
   5: /*
   6: **  Packed Move
   7: **
   8: **	Moves string `s' to storage area `b' of length `l' bytes.  If
   9: **	`s' is too long, it is truncated, otherwise it is padded to
  10: **	length `l' with character `c'.  `B' after the transfer is
  11: **	returned.
  12: */
  13: 
  14: char *
  15: pmove(s1, b1, l1, c)
  16: char    *s1;
  17: char    *b1;
  18: int l1;
  19: char    c;
  20: {
  21:     register char   *s;
  22:     register char   *b;
  23:     register int    l;
  24: 
  25:     s = s1;
  26:     b = b1;
  27:     l = l1;
  28: 
  29:     /* move up to `l' bytes */
  30:     while (*s && l > 0)
  31:     {
  32:         *b++ = *s++;
  33:         l -= 1;
  34:     }
  35: 
  36:     /* if we still have some `l', pad */
  37:     while (l-- > 0)
  38:     {
  39:         *b++ = c;
  40:     }
  41: 
  42:     return (b);
  43: }

Defined functions

pmove defined in line 3; used 1 times
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 462
Valid CSS Valid XHTML 1.0 Strict