home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 4 / CDPD_IV.bin / networking / uucp / amigauucpsrc / lib / tmpfile.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-29  |  622 b   |  32 lines

  1.  
  2. /*
  3.  *  TMPFILE.C
  4.  *
  5.  *  (C) Copyright 1989-1990 by Matthew Dillon,  All Rights Reserved.
  6.  *
  7.  *  create a temporary file
  8.  *
  9.  *  template limited to 16 chars
  10.  */
  11.  
  12. #include <stdio.h>
  13. #include "config.h"
  14.  
  15. Prototype char *TmpFileName(const char *);
  16.  
  17. char *
  18. TmpFileName(template)
  19. const char *template;
  20. {
  21.     static char Template[256];
  22.     static unsigned short Idx;
  23.     const char *ptr;
  24.  
  25.     for (ptr = template + strlen(template); ptr >= template && *ptr != ':' && *ptr != '/'; --ptr);
  26.     ++ptr;
  27.  
  28.     sprintf(Template, "%.*sTMP%08lx.%s", ptr - template, template, (long)FindTask(NULL) + Idx++, ptr);
  29.     return(Template);
  30. }
  31.  
  32.