]>
diplodocus.org Git - nmh/blob - sbr/m_scratch.c
3 * m_scratch.c -- construct a scratch file
7 * This code is Copyright (c) 2002, by the authors of nmh. See the
8 * COPYRIGHT file in the root directory of the nmh distribution for
9 * complete copyright information.
16 m_scratch (char *file
, char *template)
19 static char buffer
[BUFSIZ
], tmpfil
[BUFSIZ
];
21 snprintf (tmpfil
, sizeof(tmpfil
), "%sXXXXXX", template);
23 Mkstemp work postponed until later -Doug
32 /* nasty - this really means: if there is no '/' in the path */
33 if ((cp
= r1bindex (file
, '/')) == file
)
34 strncpy (buffer
, tmpfil
, sizeof(buffer
));
36 snprintf (buffer
, sizeof(buffer
), "%.*s%s", (int)(cp
- file
), file
, tmpfil
);