]> diplodocus.org Git - nmh/blob - docs/historical/mh-jun-1982/Extras/libh/makename.c
Replaced use of snprintf() with memcpy()/memmove().
[nmh] / docs / historical / mh-jun-1982 / Extras / libh / makename.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 makename(prefix,suffix)
9 char *prefix, *suffix;
10 {
11 static char tmpname[15];
12 register char *cp1, *cp2;
13 register int pid;
14
15 pid = getpid();
16 cp1 = tmpname;
17 for (cp2 = prefix; *cp1++ = *cp2++; );
18 cp1--;
19 do *cp1++ = pid%10 + '0'; while (pid =/ 10);
20 for (cp2 = suffix; *cp1++ = *cp2++; );
21 if (cp1 > &tmpname + 1) error("strs too long to makename");
22 return (tmpname);
23 }