1 /* RCS $Id: tempnam.c,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $
4 -- Fake tempnam function for the mac
7 -- Get a temporary file name.
10 -- Dennis Vadura, dvadura@dmake.wticorp.com
14 -- http://dmake.wticorp.com/
17 -- Copyright (c) 1996,1997 by WTI Corp. All rights reserved.
19 -- This program is NOT free software; you can redistribute it and/or
20 -- modify it under the terms of the Software License Agreement Provided
21 -- in the file <distribution-root>/readme/license.txt.
24 -- Use cvs log to obtain detailed change logs.
35 * Try to open a temporary file in the given directory (if non-NULL)
36 * with the given prefix (if non-NULL).
38 * We ignore the directory argument.
41 tempnam(char *pDir
, char * pPrefix
)
46 pName
= tmpnam ((char *) NULL
);
48 /* Assume that if the name returned by tmpnam is not being used,
49 the name with the prefix is also not being used. */
50 pFullName
= MALLOC (((pPrefix
!= NULL
) ? strlen (pPrefix
) : 0) +
51 strlen (pName
) + 1, char);
53 /* Copy in the name if we successfully allocated space for it. */
54 if (pFullName
!= NULL
) {
55 if (pPrefix
!= NULL
) {
56 strcpy (pFullName
, pPrefix
);
61 strcat (pFullName
, pName
);
65 } /* PUBLIC char *tempnam () */