1 /* mhpath.c - print full pathnames */
3 static char ident[] = "@(#)$Id: mhpath.c,v 1.4 1992/12/15 00:20:22 jromine Exp $";
14 static struct swit switches[] = {
42 setlocale(LC_ALL, "");
44 invo_name = r1bindex (argv[0], '/');
45 if ((cp = m_find (invo_name)) != NULL) {
46 ap = brkstring (cp = getcpy (cp), " ", "\n");
47 ap = copyip (ap, arguments);
51 (void) copyip (argv + 1, ap);
56 while (cp = *argp++) {
58 switch (smatch (++cp, switches)) {
60 ambigsw (cp, switches);
63 adios (NULLCP, "-%s unknown", cp);
65 (void) sprintf (buf, "%s [+folder] [msgs] [switches]",
70 if (*cp == '+' || *cp == '@') {
72 adios (NULLCP, "only one folder at a time!");
74 folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
83 free (path ("./", TFOLDER));
86 folder = m_getfolder ();
87 maildir = m_maildir (folder);
89 printf ("%s\n", maildir);
93 if (chdir (maildir) == NOTOK)
94 adios (maildir, "unable to change directory to");
95 if (!(mp = m_gmsg (folder)))
96 adios (NULLCP, "unable to read folder %s", folder);
98 if ((mp = m_remsg (mp, 0, MAXFOLDER)) == NULL)
99 adios (NULLCP, "unable to allocate folder storage");
100 mp -> msgflags |= MHPATH;
102 for (msgnum = 0; msgnum < msgp; msgnum++)
103 if (!m_convert (mp, msgs[msgnum]))
109 if (mp -> numsel > MAXARGS - 2)
110 adios (NULLCP, "more than %d messages", MAXARGS - 2);
112 for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++)
113 if (mp -> msgstats[msgnum] & SELECTED)
114 printf ("%s/%s\n", mp -> foldpath, m_name (msgnum));