Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / support / general / RCS / packmbox.sh,v
1 head    1.16;
2 access;
3 symbols;
4 locks; strict;
5 comment @# @;
6
7
8 1.16
9 date    92.02.14.17.05.31;      author jromine; state Exp;
10 branches;
11 next    1.15;
12
13 1.15
14 date    92.02.13.19.07.01;      author jromine; state Exp;
15 branches;
16 next    1.14;
17
18 1.14
19 date    92.02.13.18.58.56;      author jromine; state Exp;
20 branches;
21 next    1.13;
22
23 1.13
24 date    92.02.13.18.57.46;      author jromine; state Exp;
25 branches;
26 next    1.12;
27
28 1.12
29 date    92.02.13.18.39.27;      author jromine; state Exp;
30 branches;
31 next    1.11;
32
33 1.11
34 date    92.02.13.00.01.44;      author jromine; state Exp;
35 branches;
36 next    1.10;
37
38 1.10
39 date    92.02.12.23.48.40;      author jromine; state Exp;
40 branches;
41 next    1.9;
42
43 1.9
44 date    92.02.12.23.38.59;      author jromine; state Exp;
45 branches;
46 next    1.8;
47
48 1.8
49 date    92.02.12.23.34.06;      author jromine; state Exp;
50 branches;
51 next    1.7;
52
53 1.7
54 date    92.02.12.23.33.13;      author jromine; state Exp;
55 branches;
56 next    1.6;
57
58 1.6
59 date    92.02.12.23.11.58;      author jromine; state Exp;
60 branches;
61 next    1.5;
62
63 1.5
64 date    92.02.12.22.40.02;      author jromine; state Exp;
65 branches;
66 next    1.4;
67
68 1.4
69 date    92.02.12.22.23.40;      author jromine; state Exp;
70 branches;
71 next    1.3;
72
73 1.3
74 date    92.02.12.22.16.40;      author jromine; state Exp;
75 branches;
76 next    1.2;
77
78 1.2
79 date    92.02.12.22.16.01;      author jromine; state Exp;
80 branches;
81 next    1.1;
82
83 1.1
84 date    92.02.12.22.14.05;      author jromine; state Exp;
85 branches;
86 next    ;
87
88
89 desc
90 @@
91
92
93 1.16
94 log
95 @make format string backward compatible
96 @
97 text
98 @#! /bin/sh
99 # packmbox - pack an MH folder back into a UUCP-style mbox
100 # @@(#)$Id: packmbox.sh,v 1.15 1992/02/13 19:07:01 jromine Exp $
101 #
102 # Defaults:
103 #    `+folder'  defaults to current folder
104 #    `msgs'     defaults to all
105 #
106 # Context:
107 #    Current-Folder
108 #
109 # for simplicity (and speed) we don't parse command-line args (much)
110 case $#/$1 in
111    1/-h*) echo "syntax: packmbox [+folder] [msgs] [-help]" 1>&2; exit 0;;
112 esac
113
114 format="%(msg) From \
115 %<{return-path}%(putstr)%|\
116 %<(nonnull(mbox{from}))%(putstr)%|nobody%>@@\
117 %<(nonnull(host{from}))%(putstr)%|nowhere%>%> \
118 %(day{date}) %(month{date}) %2(mday{date}) \
119 %02(hour{date}):%02(min{date}):%02(sec{date}) \
120 %(void(year{date}))%<(gt 100)%4(putnum)%|19%02(putnum)%>"
121
122 trap 'rm -f /tmp/packm$$; exit 1' 1 2 3 15
123
124 scan -noclear -noheader -noreverse -width 256 \
125                         -format "${format}" $* >/tmp/packm$$
126 # tricky -- you must do this "cd" after scan has updated the context
127 cd `mhpath`
128
129 exec </tmp/packm$$
130 rm -f /tmp/packm$$
131 while read m f
132 do
133     echo "$f"
134     sed -e '/^From /s/^/>/' < $m
135     echo ""
136 done
137 exit
138 @
139
140
141 1.15
142 log
143 @typo
144 @
145 text
146 @d3 1
147 a3 1
148 # @@(#)$Id: packmbox.sh,v 1.14 1992/02/13 18:58:56 jromine Exp $
149 d18 3
150 a20 1
151 %(putstr %<{return-path}%|%<{from}%(addr{from})%|nobody%>%>) \
152 @
153
154
155 1.14
156 log
157 @tricky comment
158 @
159 text
160 @d3 1
161 a3 1
162 # @@(#)$Id: packmbox.sh,v 1.13 1992/02/13 18:57:46 jromine Exp jromine $
163 d21 1
164 a21 1
165 %(void(year{date}))%<(gt 100)%4(putnum)%|19%2(putnum)%>"
166 @
167
168
169 1.13
170 log
171 @back out changes
172 Fix 2-digit dates to be "19xx".
173 @
174 text
175 @d3 1
176 a3 1
177 # @@(#)$Id: packmbox.sh,v 1.11 1992/02/13 00:01:44 jromine Exp $
178 d27 1
179 @
180
181
182 1.12
183 log
184 @Fixes from Jerry Peek
185 @
186 text
187 @d3 1
188 a3 1
189 # @@(#)$Id: packmbox.sh,v 1.11 1992/02/13 00:01:44 jromine Exp jromine $
190 d20 2
191 a21 1
192 %02(hour{date}):%02(min{date}):%02(sec{date}) %4(year{date})"
193 d23 4
194 d29 2
195 a30 1
196 scan -noclear -noheader -noreverse -width 256 -format "${format}" $* |
197 @
198
199
200 1.11
201 log
202 @give help
203 @
204 text
205 @d3 1
206 a3 1
207 # @@(#)$Id: packmbox.sh,v 1.10 1992/02/12 23:48:40 jromine Exp jromine $
208 a21 4
209 trap 'rm -f /tmp/packm$$; exit 1' 1 2 3 15
210
211 scan -noclear -noheader -noreverse -width 256 \
212                         -format "${format}" $* >/tmp/packm$$
213 d24 1
214 a24 2
215 exec </tmp/packm$$
216 rm -f /tmp/packm$$
217 @
218
219
220 1.10
221 log
222 @*** empty log message ***
223 @
224 text
225 @d3 1
226 a3 1
227 # @@(#)$Id: packmbox,v 1.9 1992/02/12 23:38:59 jromine Exp jromine $
228 a4 2
229 # usage: packmbox [+folder] [msgs] > mbox
230 #
231 d12 4
232 a15 1
233 # for simplicity (and speed) we don't parse command-line args
234 @
235
236
237 1.9
238 log
239 @*** empty log message ***
240 @
241 text
242 @d3 1
243 a3 1
244 # @@(#)$Id: packmbox,v 1.8 1992/02/12 23:34:06 jromine Exp jromine $
245 d23 2
246 a24 1
247 scan -noclear -noheader -noheader -format "${format}" $* >/tmp/packm$$
248 @
249
250
251 1.8
252 log
253 @*** empty log message ***
254 @
255 text
256 @d2 2
257 a3 1
258 # $Id: packmbox,v 1.7 1992/02/12 23:33:13 jromine Exp jromine $
259 d5 1
260 a5 1
261 # Turn an MH folder back into a UUCP-style mbox
262 d8 2
263 a9 1
264 #    Current-folder, `msgs' defaults to all
265 d12 3
266 a14 1
267 #    Current-folder, and/or msg
268 @
269
270
271 1.7
272 log
273 @*** empty log message ***
274 @
275 text
276 @d2 1
277 a2 1
278 # $Id: packmbox,v 1.6 1992/02/12 23:11:58 jromine Exp jromine $
279 d23 1
280 @
281
282
283 1.6
284 log
285 @*** empty log message ***
286 @
287 text
288 @d2 1
289 a2 1
290 # $Id: packmbox,v 1.5 1992/02/12 22:40:02 jromine Exp jromine $
291 a10 4
292 #
293 # Sadly, this had to run "pick" in order to select the current
294 # folder.  "scan" doesn't need an expanded list of the messages,
295 # but we need to `cd' to the selected folder.
296 d17 3
297 a19 1
298 msgs="`pick $* -list`"
299 d22 1
300 a22 1
301 scan -noclear -noheader -noheader -format "${format}" ${msgs} | (
302 a28 1
303 )
304 @
305
306
307 1.5
308 log
309 @*** empty log message ***
310 @
311 text
312 @d2 1
313 a2 1
314 # $Id: MH2Mail,v 1.4 1992/02/12 22:23:40 jromine Exp jromine $
315 d4 1
316 a4 1
317 # Turn an MH folder back into a UUCP-style mbox (yuk!)
318 d6 9
319 a14 2
320 # Note, this tries to avoid bad defaults in your .mh_profile,
321 # but may not be 100% successful.
322 d16 2
323 a17 3
324 # set the format string
325 format="\
326 %(msg) From %(putstr %<{return-path}%?{from}%(addr{from})%|nobody%>) \
327 d21 1
328 a21 3
329 MHCONTEXT=/dev/null; export MHCONTEXT
330 # do the work
331 scan -noclear -noheader -noheader -format "${format}" $* | (
332 d23 2
333 d28 1
334 a28 1
335     cat $m
336 d32 1
337 @
338
339
340 1.4
341 log
342 @*** empty log message ***
343 @
344 text
345 @d2 2
346 a3 1
347 # $Id$
348 d8 2
349 a9 1
350 #
351 d15 3
352 a18 1
353 scan -noclear -noheader -noheader -format "${format}" $* | (
354 @
355
356
357 1.3
358 log
359 @*** empty log message ***
360 @
361 text
362 @d2 6
363 a7 1
364 msgs="`pick $* -list`"
365 d14 1
366 a14 1
367 scan -noheader -format "${format}" ${msgs} | (
368 @
369
370
371 1.2
372 log
373 @*** empty log message ***
374 @
375 text
376 @d9 2
377 a10 1
378 for i in ${msgs}
379 d12 2
380 a13 2
381     scan -noheader -format "${format}" $i
382     cat $i
383 d16 1
384 @
385
386
387 1.1
388 log
389 @Initial revision
390 @
391 text
392 @d9 1
393 a9 2
394 scan -noheader -format "${format}" ${msgs} | (
395 while read m f
396 d11 2
397 a12 2
398     echo "$f"
399     cat $m
400 a14 1
401 )
402 @