- int i, j, others;
- register char *maildir;
- char cur[BUFSIZ];
- register struct dirent *dp;
- register DIR *dd;
-
- switch (i = chdir (maildir = m_maildir (folder))) {
- case OK:
- if (access (".", W_OK) != NOTOK && access ("..", W_OK) != NOTOK)
- break; /* fall otherwise */
-
- case NOTOK:
- snprintf (cur, sizeof(cur), "atr-%s-%s",
- current, m_mailpath (folder));
- if (!context_del (cur)) {
- printf ("[+%s de-referenced]\n", folder);
- return OK;
- }
- advise (NULL, "you have no profile entry for the %s folder +%s",
- i == NOTOK ? "unreadable" : "read-only", folder);
- return NOTOK;
- }
-
- if ((dd = opendir (".")) == NULL)
- adios (NULL, "unable to read folder +%s", folder);
- others = 0;
-
- /*
- * Run the external delete hook program.
- */
-
- (void)ext_hook("del-hook", maildir, (char *)0);
-
- j = strlen(BACKUP_PREFIX);
- while ((dp = readdir (dd))) {
- switch (dp->d_name[0]) {
- case '.':
- if (strcmp (dp->d_name, ".") == 0
- || strcmp (dp->d_name, "..") == 0)
- continue; /* else fall */
-
- case ',':
-#ifdef MHE
- case '+':
-#endif /* MHE */
-#ifdef UCI
- case '_':
- case '#':
-#endif /* UCI */
- break;
-
- default:
- if (m_atoi (dp->d_name))
- break;
- if (strcmp (dp->d_name, LINK) == 0
- || strncmp (dp->d_name, BACKUP_PREFIX, j) == 0)
- break;
-
- admonish (NULL, "file \"%s/%s\" not deleted",
- folder, dp->d_name);
- others++;
- continue;
- }
- if (unlink (dp->d_name) == NOTOK) {
- admonish (dp->d_name, "unable to unlink %s:", folder);
- others++;
+ int i, others;
+ char *maildir;
+ char cur[BUFSIZ];
+ struct dirent *dp;
+ DIR *dd;
+
+ switch (i = chdir(maildir = toabsdir(folder))) {
+ case OK:
+ if (access(".", W_OK) != NOTOK && access("..", W_OK) != NOTOK)
+ break; /* fall otherwise */
+
+ case NOTOK:
+ snprintf(cur, sizeof(cur), "atr-%s-%s", seq_cur,
+ toabsdir(folder));
+ if (!context_del(cur)) {
+ printf("[+%s de-referenced]\n", folder);
+ return OK;
+ }
+ advise(NULL, "you have no profile entry for the %s folder +%s",
+ i == NOTOK ? "unreadable" : "read-only",
+ folder);
+ return NOTOK;