|
|
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: 2254 (0x8ce)
Types: TextFile
Names: »mhpath.c«
└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit
└─⟦3658e588a⟧ »EurOpenD3/mail/mh/mh-6.7.tar.Z«
└─⟦c75e36ecb⟧
└─⟦this⟧ »mh-6.7/uip/mhpath.c«
/* mhpath.c - print full pathnames */
#include "../h/mh.h"
#include <stdio.h>
/* \f
*/
static struct swit switches[] = {
#define HELPSW 0
"help", 4,
NULL, NULL
};
/* \f
*/
/* ARGSUSED */
main(argc, argv)
int argc;
char *argv[];
{
int msgp = 0,
msgnum;
char *cp,
*maildir,
*folder = NULL,
buf[100],
**ap,
**argp,
*arguments[MAXARGS],
*msgs[MAXARGS];
struct msgs *mp;
invo_name = r1bindex (argv[0], '/');
if ((cp = m_find (invo_name)) != NULL) {
ap = brkstring (cp = getcpy (cp), " ", "\n");
ap = copyip (ap, arguments);
}
else
ap = arguments;
(void) copyip (argv + 1, ap);
argp = arguments;
/* \f
*/
while (cp = *argp++) {
if (*cp == '-')
switch (smatch (++cp, switches)) {
case AMBIGSW:
ambigsw (cp, switches);
done (1);
case UNKWNSW:
adios (NULLCP, "-%s unknown", cp);
case HELPSW:
(void) sprintf (buf, "%s [+folder] [msgs] [switches]",
invo_name);
help (buf, switches);
done (1);
}
if (*cp == '+' || *cp == '@') {
if (folder)
adios (NULLCP, "only one folder at a time!");
else
folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
}
else
msgs[msgp++] = cp;
}
/* \f
*/
if (!m_find ("path"))
free (path ("./", TFOLDER));
if (!folder)
folder = m_getfolder ();
maildir = m_maildir (folder);
if (!msgp) {
printf ("%s\n", maildir);
done (0);
}
if (chdir (maildir) == NOTOK)
adios (maildir, "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;
for (msgnum = 0; msgnum < msgp; msgnum++)
if (!m_convert (mp, msgs[msgnum]))
done (1);
m_setseq (mp);
/* \f
*/
if (mp -> numsel > MAXARGS - 2)
adios (NULLCP, "more than %d messages", MAXARGS - 2);
for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++)
if (mp -> msgstats[msgnum] & SELECTED)
printf ("%s/%s\n", mp -> foldpath, m_name (msgnum));
m_sync (mp);
m_update ();
done (0);
}