/*
 * OmniPlay v1.23
 * by David Champion
 *
 * temp-file name generator
 * modified from my Amiga port of SOX, the Sound Exchange
 * 17 Nov 92
 */
/*
 * This is not needed under SAS/C version 6, but is left
 * in case people want to use it in compiling with
 * something else.
 */

#include <exec/types.h>
#include <string.h>
#include <stdio.h>

#include "oplay.h"

#include <clib/exec_protos.h>
#include <pragmas/exec_lib.h>

/*
 * I used to use myname as the base for the temp file name,
 * but then I realized that it doesn't work if, e.g., you
 * call OmniPlay as "dh0:c/oplay chuckachucka.pp" --
 * it tries to make a file called "t:dh0:c/o.XXXXXXXX" or
 * something.  Obviously, this is unfair.
 */
//extern char *myname;	/* myname MUST exist! */


char *tmpnam(char *s)
{
char tmp1[B_tmpnam+1], tmp2[64];
//int i;

//old method; see above
//strncpy(tmp1, myname, B_tmpnam);
//sprintf(tmp2, "%s%s.%08x.%08x", P_tmpdir, tmp1, (ULONG)FindTask(NULL), (ULONG)time());
strncpy(tmp1, PROGNAME, B_tmpnam);
sprintf(tmp2, "%s%s.%08x", P_tmpdir, tmp1, (ULONG)FindTask(NULL));

strncpy(s, tmp2, L_tmpnam);

return(s);
}
