]> diplodocus.org Git - nmh/blob - docs/historical/mh-jun-1982/Extras/libh/getcopy.c
Updated documentation and comments about sendmail/pipe.
[nmh] / docs / historical / mh-jun-1982 / Extras / libh / getcopy.c
1 #ifdef COMMENT
2 Proprietary Rand Corporation, 1981.
3 Further distribution of this software
4 subject to the terms of the Rand
5 license agreement.
6 #endif
7
8 char copy_space[128];
9 int copy_size; /* if this is non-zero, assume represents */
10 /* actual size of copy_space */
11 char *copy_ptr;
12 char *
13 getcopy(str)
14 char *str;
15 {
16 static char *cpend;
17 register char *r1, *r2;
18
19 if (cpend == 0) {
20 /* first time through */
21 cpend = copy_space+ (copy_size? copy_size: sizeof copy_space);
22 copy_ptr = copy_space;
23 }
24 r2 = str;
25 for (r1 = copy_ptr; r1 < cpend; ) {
26 if ((*r1++ = *r2++) == 0) {
27 r2 = copy_ptr;
28 copy_ptr = r1;
29 return(r2);
30 }
31 }
32 write(2, "getcopy out of space\n", 21);
33 exit(-1);
34 }