]> diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/uip/RCS/mhpath.c,v
sbr/mts.c: Delete mmdlm2; use same-valued mmdlm1 instead.
[nmh] / docs / historical / mh-6.8.5 / uip / RCS / mhpath.c,v
1 head 1.4;
2 access;
3 symbols;
4 locks; strict;
5 comment @ * @;
6
7
8 1.4
9 date 92.12.15.00.20.22; author jromine; state Exp;
10 branches;
11 next 1.3;
12
13 1.3
14 date 92.11.04.00.48.24; author jromine; state Exp;
15 branches;
16 next 1.2;
17
18 1.2
19 date 92.01.31.22.13.42; author jromine; state Exp;
20 branches;
21 next 1.1;
22
23 1.1
24 date 92.01.31.22.12.57; author jromine; state Exp;
25 branches;
26 next ;
27
28
29 desc
30 @@
31
32
33 1.4
34 log
35 @endif sugar
36 @
37 text
38 @/* mhpath.c - print full pathnames */
39 #ifndef lint
40 static char ident[] = "@@(#)$Id: mhpath.c,v 1.3 1992/11/04 00:48:24 jromine Exp jromine $";
41 #endif /* lint */
42
43 #include "../h/mh.h"
44 #include <stdio.h>
45 #ifdef LOCALE
46 #include <locale.h>
47 #endif
48
49 /* \f */
50
51 static struct swit switches[] = {
52 #define HELPSW 0
53 "help", 4,
54
55 NULL, 0
56 };
57
58 /* \f */
59
60 /* ARGSUSED */
61
62 main(argc, argv)
63 int argc;
64 char *argv[];
65 {
66 int msgp = 0,
67 msgnum;
68 char *cp,
69 *maildir,
70 *folder = NULL,
71 buf[100],
72 **ap,
73 **argp,
74 *arguments[MAXARGS],
75 *msgs[MAXARGS];
76 struct msgs *mp;
77
78 #ifdef LOCALE
79 setlocale(LC_ALL, "");
80 #endif
81 invo_name = r1bindex (argv[0], '/');
82 if ((cp = m_find (invo_name)) != NULL) {
83 ap = brkstring (cp = getcpy (cp), " ", "\n");
84 ap = copyip (ap, arguments);
85 }
86 else
87 ap = arguments;
88 (void) copyip (argv + 1, ap);
89 argp = arguments;
90
91 /* \f */
92
93 while (cp = *argp++) {
94 if (*cp == '-')
95 switch (smatch (++cp, switches)) {
96 case AMBIGSW:
97 ambigsw (cp, switches);
98 done (1);
99 case UNKWNSW:
100 adios (NULLCP, "-%s unknown", cp);
101 case HELPSW:
102 (void) sprintf (buf, "%s [+folder] [msgs] [switches]",
103 invo_name);
104 help (buf, switches);
105 done (1);
106 }
107 if (*cp == '+' || *cp == '@@') {
108 if (folder)
109 adios (NULLCP, "only one folder at a time!");
110 else
111 folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
112 }
113 else
114 msgs[msgp++] = cp;
115 }
116
117 /* \f */
118
119 if (!m_find ("path"))
120 free (path ("./", TFOLDER));
121
122 if (!folder)
123 folder = m_getfolder ();
124 maildir = m_maildir (folder);
125 if (!msgp) {
126 printf ("%s\n", maildir);
127 done (0);
128 }
129
130 if (chdir (maildir) == NOTOK)
131 adios (maildir, "unable to change directory to");
132 if (!(mp = m_gmsg (folder)))
133 adios (NULLCP, "unable to read folder %s", folder);
134
135 if ((mp = m_remsg (mp, 0, MAXFOLDER)) == NULL)
136 adios (NULLCP, "unable to allocate folder storage");
137 mp -> msgflags |= MHPATH;
138
139 for (msgnum = 0; msgnum < msgp; msgnum++)
140 if (!m_convert (mp, msgs[msgnum]))
141 done (1);
142 m_setseq (mp);
143
144 /* \f */
145
146 if (mp -> numsel > MAXARGS - 2)
147 adios (NULLCP, "more than %d messages", MAXARGS - 2);
148
149 for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++)
150 if (mp -> msgstats[msgnum] & SELECTED)
151 printf ("%s/%s\n", mp -> foldpath, m_name (msgnum));
152
153 m_sync (mp);
154 m_update ();
155
156 done (0);
157 }
158 @
159
160
161 1.3
162 log
163 @LOCALE
164 @
165 text
166 @d3 2
167 a4 2
168 static char ident[] = "@@(#)$Id: mhpath.c,v 1.2 1992/01/31 22:13:42 jromine Exp jromine $";
169 #endif lint
170 @
171
172
173 1.2
174 log
175 @kerberos
176 @
177 text
178 @d3 1
179 a3 1
180 static char ident[] = "@@(#)$Id$";
181 d8 3
182 d41 3
183 @
184
185
186 1.1
187 log
188 @Initial revision
189 @
190 text
191 @d2 3
192 d15 1
193 a15 1
194 NULL, NULL
195 @