]>
diplodocus.org Git - nmh/blob - sbr/m_maildir.c
e72cd7806d3c1b67501fc9e2a71bb66583525b6e
1 /* m_maildir.c -- get the path for the mail directory
3 * This code is Copyright (c) 2002, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
9 #include "context_find.h"
12 #include "m_maildir.h"
19 static char mailfold
[BUFSIZ
];
24 static char *exmaildir (char *);
27 /* Returns static char[], never NULL. */
29 m_maildir (char *folder
)
33 if ((cp
= exmaildir (folder
))
34 && (ep
= cp
+ strlen (cp
) - 1) > cp
42 /* Return value must be free(3)'d. */
44 m_mailpath (char *folder
)
50 && !has_prefix(folder
, CWD
)
51 && strcmp (folder
, DOT
)
52 && strcmp (folder
, DOTDOT
)
53 && !has_prefix(folder
, PWD
)) {
54 strncpy (maildir
, mailfold
, sizeof(maildir
)); /* preserve... */
55 cp
= mh_xstrdup(m_maildir(folder
));
56 strncpy (mailfold
, maildir
, sizeof(mailfold
));
58 cp
= path (folder
, TFOLDER
);
65 /* Returns static char[], never NULL. */
67 exmaildir (char *folder
)
71 /* use current folder if none is specified */
73 folder
= getfolder(1);
76 && !has_prefix(folder
, CWD
)
77 && strcmp (folder
, DOT
)
78 && strcmp (folder
, DOTDOT
)
79 && !has_prefix(folder
, PWD
))) {
80 strncpy (mailfold
, folder
, sizeof(mailfold
));
85 if ((pp
= context_find ("path")) && *pp
) {
87 snprintf(cp
, sizeof mailfold
, "%s/", mypath
);
92 char *p
= path("./", TFOLDER
);