]>
diplodocus.org Git - nmh/blob - sbr/m_maildir.c
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.
10 #include "context_find.h"
13 #include "m_maildir.h"
20 static char mailfold
[BUFSIZ
];
25 static char *exmaildir (char *);
28 /* Returns static char[], never NULL. */
30 m_maildir (char *folder
)
34 if ((cp
= exmaildir (folder
))
35 && (ep
= cp
+ strlen (cp
) - 1) > cp
43 /* Return value must be free(3)'d. */
45 m_mailpath (char *folder
)
51 && !has_prefix(folder
, CWD
)
52 && strcmp (folder
, DOT
)
53 && strcmp (folder
, DOTDOT
)
54 && !has_prefix(folder
, PWD
)) {
55 strncpy (maildir
, mailfold
, sizeof(maildir
)); /* preserve... */
56 cp
= mh_xstrdup(m_maildir(folder
));
57 strncpy (mailfold
, maildir
, sizeof(mailfold
));
59 cp
= path (folder
, TFOLDER
);
66 /* Returns static char[], never NULL. */
68 exmaildir (char *folder
)
72 /* use current folder if none is specified */
74 folder
= getfolder(1);
77 && !has_prefix(folder
, CWD
)
78 && strcmp (folder
, DOT
)
79 && strcmp (folder
, DOTDOT
)
80 && !has_prefix(folder
, PWD
))) {
81 strncpy (mailfold
, folder
, sizeof(mailfold
));
86 if ((pp
= context_find ("path")) && *pp
) {
88 snprintf(cp
, sizeof mailfold
, "%s/", mypath
);
93 char *p
= path("./", TFOLDER
);