]>
diplodocus.org Git - nmh/blob - sbr/m_maildir.c
75c6baf2445f1ab4e14f10471fd1a50a58d7ff9c
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.
11 #include "m_maildir.h"
18 static char mailfold
[BUFSIZ
];
23 static char *exmaildir (char *);
26 /* Returns static char[], never NULL. */
28 m_maildir (char *folder
)
32 if ((cp
= exmaildir (folder
))
33 && (ep
= cp
+ strlen (cp
) - 1) > cp
41 /* Return value must be free(3)'d. */
43 m_mailpath (char *folder
)
49 && !has_prefix(folder
, CWD
)
50 && strcmp (folder
, DOT
)
51 && strcmp (folder
, DOTDOT
)
52 && !has_prefix(folder
, PWD
)) {
53 strncpy (maildir
, mailfold
, sizeof(maildir
)); /* preserve... */
54 cp
= mh_xstrdup(m_maildir(folder
));
55 strncpy (mailfold
, maildir
, sizeof(mailfold
));
57 cp
= path (folder
, TFOLDER
);
64 /* Returns static char[], never NULL. */
66 exmaildir (char *folder
)
70 /* use current folder if none is specified */
72 folder
= getfolder(1);
75 && !has_prefix(folder
, CWD
)
76 && strcmp (folder
, DOT
)
77 && strcmp (folder
, DOTDOT
)
78 && !has_prefix(folder
, PWD
))) {
79 strncpy (mailfold
, folder
, sizeof(mailfold
));
84 if ((pp
= context_find ("path")) && *pp
) {
86 snprintf(cp
, sizeof mailfold
, "%s/", mypath
);
91 char *p
= path("./", TFOLDER
);