]>
diplodocus.org Git - nmh/blob - docs/historical/SRI-NOSC/scan.c
7 struct swit switches
[] {
12 "noheader", 0, /* 4 */
20 char *inp
, *folder
, *maildir
, *msgs
[100];
22 register char *cp
, *ap
;
26 char *arguments
[50], **argp
;
28 fout
.b_fildes
= dup(1);
32 ff
= msgp
= folder
= 0;
38 if((cp
= m_find(ap
)) != -1) {
39 ap
= brkstring(cp
= getcpy(cp
), " ", "\n");
40 ap
= copyip(ap
, arguments
);
41 /* printf("1:\n"); flush(); ##*/
42 /* pr_array("arguments", arguments); flush(); ##*/
46 /* printf("2:\n"); flush(); ##*/
47 /* pr_array("arguments", arguments); flush(); ##*/
51 switch(smatch(++cp
, switches
)) {
52 case -2:ambigsw(cp
, switches
); /* ambiguous */
55 case -1:printf("-%s unknown\n", cp
);
58 case 0: printf("\"-all\" changed to \"all\"\n");
60 case 1: ff
= 1; continue; /* -ff */
61 case 2: ff
= 0; continue; /* -noff */
62 case 3: hdrflag
= 0; continue; /* -header */
63 case 4: hdrflag
= 1; continue; /* -noheader */
64 case 5: help(concat( inp
, " [+folder] [msgs] [switches]", 0),
70 printf("Only one folder at a time.\n");
78 folder
= m_getfolder();
79 maildir
= m_maildir(folder
);
80 if(chdir(maildir
) < 0) {
81 printf("Can't chdir to: "); flush();
85 if(!(mp
= m_gmsg(folder
))) {
86 printf("Can't read folder!?\n");
90 printf("No messages in \"%s\".\n", folder
);
94 msgs
[msgp
++] = "first-last";
95 for(msgnum
= 0; msgnum
< msgp
; msgnum
++)
96 if(!m_convert(msgs
[msgnum
], EXISTS
, EXISTS
))
98 m_replace("folder",folder
);
99 for(msgnum
= mp
->lowsel
; msgnum
<= mp
->hghsel
; msgnum
++) {
100 if(mp
->msgstats
[msgnum
]&SELECTED
) {
101 if(fopen(cp
= m_name(msgnum
), &in
) < 0)
102 printf("--Can't open %s\n", cp
);
107 cp
[9] = ' '; cp
[15] = 0;
110 # Date From Subject [<<Body]\n\n", folder
, cp
);
112 scan(&in
, msgnum
, 0, msgnum
== mp
->curmsg
);
114 if(fout
.b_nextp
+ 80 >= (&fout
) + 1)