|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T m
Length: 1784 (0x6f8)
Types: TextFile
Names: »m_draft.c«
└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit
└─⟦3658e588a⟧ »EurOpenD3/mail/mh/mh-6.7.tar.Z«
└─⟦c75e36ecb⟧
└─⟦this⟧ »mh-6.7/sbr/m_draft.c«
/* m_draft.c - construct the draft name */
#include "../h/mh.h"
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
extern int errno;
char *m_draft (folder, msg, use, isdf)
register char *folder,
*msg;
register int use,
*isdf;
{
register char *cp;
register struct msgs *mp;
struct stat st;
static char buffer[BUFSIZ];
if (*isdf == NOTOK || folder == NULL || *folder == NULL) {
if (*isdf == NOTOK || (cp = m_find ("Draft-Folder")) == NULL) {
*isdf = 0;
return m_maildir (msg && *msg ? msg : draft);
}
else
folder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
*cp != '@' ? TFOLDER : TSUBCWF);
}
*isdf = 1;
(void) chdir (m_maildir (""));
(void) strcpy (buffer, m_maildir (folder));
if (stat (buffer, &st) == NOTOK) {
if (errno != ENOENT)
adios (buffer, "error on folder");
cp = concat ("Create folder \"", buffer, "\"? ", NULLCP);
if (!getanswer (cp))
done (0);
free (cp);
if (!makedir (buffer))
adios (NULLCP, "unable to create folder %s", buffer);
}
if (chdir (buffer) == NOTOK)
adios (buffer, "unable to change directory to");
if (!(mp = m_gmsg (folder)))
adios (NULLCP, "unable to read folder %s", folder);
if ((mp = m_remsg (mp, 0, MAXFOLDER)) == NULL)
adios (NULLCP, "unable to allocate folder storage");
mp -> msgflags |= MHPATH;
if (!m_convert (mp, msg && *msg ? msg : use ? "cur" : "new"))
done (1);
m_setseq (mp);
if (mp -> numsel > 1)
adios (NULLCP, "only one message draft at a time!");
(void) sprintf (buffer, "%s/%s", mp -> foldpath, m_name (mp -> lowsel));
cp = buffer;
m_setcur (mp, mp -> lowsel);
m_sync (mp);
m_fmsg (mp);
return cp;
}