home *** CD-ROM | disk | FTP | other *** search
- /*
- * TMPFILE.C
- *
- * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved.
- *
- * create a temporary file
- *
- * template limited to 16 chars
- */
-
- #include <string.h>
- #include <stdio.h>
- #include "config.h"
-
- Prototype char *TmpFileName (const char *);
-
- char *
- TmpFileName (const char *template)
- {
- static char
- Template [256];
- static unsigned short
- Idx;
- const char
- *ptr;
-
- for (ptr = template + strlen (template); ptr >= template && *ptr != ':' && *ptr != '/'; --ptr)
- ;
- ++ptr;
-
- sprintf (Template, "%.*sTMP%08lx.%s", ptr - template, template, (long) FindTask (NULL) + Idx++, ptr);
-
- return Template;
- }
-