7 /* remove or stash away file
9 /* \fBint REMOVE(path)\fR
10 /* \fBconst char *path;\fR
12 /* \fBREMOVE()\fR removes a file, or renames it to a unique name,
13 /* depending on the setting of the boolean \fBvar_dont_remove\fR
16 /* The result is 0 in case of success, -1 in case of trouble.
17 /* The global \fBerrno\fR variable reflects the nature of the
20 /* saved/*, stashed-away files.
26 /* The Secure Mailer license must be distributed with this software.
29 /* IBM T.J. Watson Research
31 /* Yorktown Heights, NY 10598, USA
43 /* Utility library. */
49 #include <mail_params.h>
51 /* REMOVE - squirrel away a file instead of removing it */
53 int REMOVE(const char *path
)
59 if (var_dont_remove
== 0) {
60 return (remove(path
));
63 dest
= vstring_alloc(10);
64 vstring_sprintf(dest
, "saved/%s", ((slash
= strrchr(path
, '/')) != 0) ?
67 if (stat(vstring_str(dest
), &st
) < 0)
69 vstring_strcat(dest
, "+");
71 return (rename(path
, vstring_str(dest
)));