]> diplodocus.org Git - nmh/blob - sbr/m_backup.c
uip/flist.c: Make locally defined and used functions static.
[nmh] / sbr / m_backup.c
1 /* m_backup.c -- construct a backup file
2 *
3 * This code is Copyright (c) 2002, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
6 */
7
8 #include <h/mh.h>
9
10
11 char *
12 m_backup (const char *file)
13 {
14 const char *cp;
15 static char buffer[BUFSIZ];
16
17 if ((cp = r1bindex((char *) file, '/')) == file)
18 snprintf(buffer, sizeof(buffer), "%s%s",
19 BACKUP_PREFIX, cp);
20 else
21 snprintf(buffer, sizeof(buffer), "%.*s%s%s", (int)(cp - file), file,
22 BACKUP_PREFIX, cp);
23
24 (void) m_unlink(buffer);
25 return buffer;
26 }