2 * m_maildir.c -- get the path for the mail directory
4 * This code is Copyright (c) 2002, by the authors of nmh. See the
5 * COPYRIGHT file in the root directory of the nmh distribution for
6 * complete copyright information.
12 #define NCWD (sizeof(CWD) - 1)
16 #define NPWD (sizeof(PWD) - 1)
18 static char mailfold[BUFSIZ];
23 static char *exmaildir (char *);
27 m_maildir (char *folder)
29 register char *cp, *ep;
31 if ((cp = exmaildir (folder))
32 && (ep = cp + strlen (cp) - 1) > cp
41 m_mailpath (char *folder)
47 && strncmp (folder, CWD, NCWD)
48 && strcmp (folder, DOT)
49 && strcmp (folder, DOTDOT)
50 && strncmp (folder, PWD, NPWD)) {
51 strncpy (maildir, mailfold, sizeof(maildir)); /* preserve... */
52 cp = getcpy (m_maildir (folder));
53 strncpy (mailfold, maildir, sizeof(mailfold));
55 cp = path (folder, TFOLDER);
63 exmaildir (char *folder)
65 register char *cp, *pp;
67 /* use current folder if none is specified */
69 folder = getfolder(1);
72 && strncmp (folder, CWD, NCWD)
73 && strcmp (folder, DOT)
74 && strcmp (folder, DOTDOT)
75 && strncmp (folder, PWD, NPWD))) {
76 strncpy (mailfold, folder, sizeof(mailfold));
81 if ((pp = context_find ("path")) && *pp) {
83 sprintf (cp, "%s/", mypath);
88 cp = copy (path ("./", TFOLDER), cp);