]> diplodocus.org Git - nmh/blob - sbr/m_backup.c
Just reworded the bit about '%s' being safe not to quote (it's only safe not to
[nmh] / sbr / m_backup.c
1
2 /*
3 * m_backup.c -- construct a backup file
4 *
5 * $Id$
6 */
7
8 #include <h/mh.h>
9
10
11 char *
12 m_backup (char *file)
13 {
14 char *cp;
15 static char buffer[BUFSIZ];
16
17 if ((cp = r1bindex(file, '/')) == file)
18 snprintf(buffer, sizeof(buffer), "%s%s",
19 BACKUP_PREFIX, cp);
20 else
21 snprintf(buffer, sizeof(buffer), "%.*s%s%s", cp - file, file,
22 BACKUP_PREFIX, cp);
23
24 unlink(buffer);
25 return buffer;
26 }