Revision 12455,
540 bytes
checked in by danw, 26 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r12454,
which included commits to RCS files with non-trunk default branches.
|
Line | |
---|
1 | |
---|
2 | /* |
---|
3 | * m_scratch.c -- construct a scratch file |
---|
4 | * |
---|
5 | * $Id: m_scratch.c,v 1.1.1.1 1999-02-07 18:14:09 danw Exp $ |
---|
6 | */ |
---|
7 | |
---|
8 | #include <h/mh.h> |
---|
9 | |
---|
10 | |
---|
11 | char * |
---|
12 | m_scratch (char *file, char *template) |
---|
13 | { |
---|
14 | char *cp; |
---|
15 | static char buffer[BUFSIZ], tmpfil[BUFSIZ]; |
---|
16 | |
---|
17 | snprintf (tmpfil, sizeof(tmpfil), "%sXXXXXX", template); |
---|
18 | mktemp (tmpfil); |
---|
19 | if ((cp = r1bindex (file, '/')) == file) |
---|
20 | strncpy (buffer, tmpfil, sizeof(buffer)); |
---|
21 | else |
---|
22 | snprintf (buffer, sizeof(buffer), "%.*s%s", cp - file, file, tmpfil); |
---|
23 | unlink (buffer); |
---|
24 | |
---|
25 | return buffer; |
---|
26 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.