3 * m_maildir.c -- get the path for the mail directory
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
13 #define NCWD (sizeof(CWD) - 1)
17 #define NPWD (sizeof(PWD) - 1)
19 static char mailfold[BUFSIZ];
24 static char *exmaildir (char *);
28 m_maildir (char *folder)
30 register char *cp, *ep;
32 if ((cp = exmaildir (folder))
33 && (ep = cp + strlen (cp) - 1) > cp
42 m_mailpath (char *folder)
48 && strncmp (folder, CWD, NCWD)
49 && strcmp (folder, DOT)
50 && strcmp (folder, DOTDOT)
51 && strncmp (folder, PWD, NPWD)) {
52 strncpy (maildir, mailfold, sizeof(maildir)); /* preserve... */
53 cp = getcpy (m_maildir (folder));
54 strncpy (mailfold, maildir, sizeof(mailfold));
56 cp = path (folder, TFOLDER);
64 exmaildir (char *folder)
66 register char *cp, *pp;
68 /* use current folder if none is specified */
70 folder = getfolder(1);
73 && strncmp (folder, CWD, NCWD)
74 && strcmp (folder, DOT)
75 && strcmp (folder, DOTDOT)
76 && strncmp (folder, PWD, NPWD))) {
77 strncpy (mailfold, folder, sizeof(mailfold));
82 if ((pp = context_find ("path")) && *pp) {
84 sprintf (cp, "%s/", mypath);
89 cp = copy (path ("./", TFOLDER), cp);