Annotation of 43BSD/lib/libc/gen/mktemp.c, revision 1.1.1.1

1.1       root        1: #if defined(LIBC_SCCS) && !defined(lint)
                      2: static char sccsid[] = "@(#)mktemp.c   5.2 (Berkeley) 3/9/86";
                      3: #endif LIBC_SCCS and not lint
                      4: 
                      5: char *
                      6: mktemp(as)
                      7: char *as;
                      8: {
                      9:        register char *s;
                     10:        register unsigned pid;
                     11:        register i;
                     12: 
                     13:        pid = getpid();
                     14:        s = as;
                     15:        while (*s++)
                     16:                ;
                     17:        s--;
                     18:        while (*--s == 'X') {
                     19:                *s = (pid%10) + '0';
                     20:                pid /= 10;
                     21:        }
                     22:        s++;
                     23:        i = 'a';
                     24:        while (access(as, 0) != -1) {
                     25:                if (i=='z')
                     26:                        return("/");
                     27:                *s = i++;
                     28:        }
                     29:        return(as);
                     30: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.