ack/mach/minixST/libsys/mktemp.c

21 lines
420 B
C
Raw Normal View History

1988-04-19 09:34:37 +00:00
/* mktemp - make a name for a temporary file */
char *mktemp(template)
char *template;
{
int pid, k;
char *p;
pid = getpid(); /* get process id as semi-unique number */
p = template;
while (*p++) ; /* find end of string */
p--; /* backup to last character */
/* Replace XXXXXX at end of template with pid. */
while (*--p == 'X') {
*p = '0' + (pid % 10);
pid = pid/10;
}
return(template);
}