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