* uip/sendsbr.c: replaced st_mtim with st_mtime, that's what
[mmh] / sbr / m_backup.c
1
2 /*
3  * m_backup.c -- construct a backup file
4  *
5  * $Id$
6  *
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.
10  */
11
12 #include <h/mh.h>
13
14
15 char *
16 m_backup (char *file)
17 {
18     char *cp;
19     static char buffer[BUFSIZ];
20
21     if ((cp = r1bindex(file, '/')) == file)
22         snprintf(buffer, sizeof(buffer), "%s%s",
23                 BACKUP_PREFIX, cp);
24     else
25         snprintf(buffer, sizeof(buffer), "%.*s%s%s", cp - file, file,
26                 BACKUP_PREFIX, cp);
27
28     unlink(buffer);
29     return buffer;
30 }