2 Proprietary Rand Corporation
, 1981.
3 Further distribution of
this software
4 subject to the terms of the Rand
10 /* anno [+folder] [msgs] [switches] -component component [-text [text]]
12 * prepends Component: <<date stamp>>
18 int inplace
; /* preserve links in anno */
20 struct swit switches
[] {
22 "component", 0, /* 1 */
24 "noinplace", 0, /* 3 */
33 register int i
, msgnum
;
34 register char *cp
, *ap
;
35 char *folder
, *maildir
, *msgs
[128], *component
, *text
;
36 char *arguments
[50], **argp
;
43 folder
= msgp
= component
= text
= 0;
48 if((cp
= m_find(ap
)) != -1) {
49 ap
= brkstring(cp
= getcpy(cp
), " ", "\n");
50 ap
= copyip(ap
, arguments
);
57 switch(smatch(++cp
, switches
)) {
58 case -2:ambigsw(cp
, switches
); /* ambiguous */
61 case -1:printf("anno: -%s unknown\n", cp
);
64 case 0: printf("\"-all\" changed to \"all\"\n");
67 case 1: if(component
) {
68 printf("Only one component.\n");
71 if(!(component
= *argp
++)) {
72 printf("anno: Missing argument for %s switch\n", argp
[-2]);
76 case 2: inplace
= 1; continue; /* -inplace */
77 case 3: inplace
= 0; continue; /* -noinplace */
78 case 4: if(text
) { /* -text */
79 printf("Only one text switch.\n");
82 text
= *argp
++; continue;
84 help("anno [+folder] [msgs] [switches] -component component [-text [text]]", switches
);
89 printf("Only one folder at a time.\n");
98 printf("usage: anno [+folder] [msgs] [switches] -component component [-text [text]] \n");
102 msgs
[msgp
++] = "cur";
104 folder
= m_getfolder();
105 maildir
= m_maildir(folder
);
106 if(chdir(maildir
) < 0) {
107 printf("Can't chdir to: "); flush();
111 if(!(mp
= m_gmsg(folder
))) {
112 printf("Can't read folder!?\n");
115 if(mp
->hghmsg
== 0) {
116 printf("No messages in \"%s\".\n", folder
);
119 for(msgnum
= 0; msgnum
< msgp
; msgnum
++)
120 if(!m_convert(msgs
[msgnum
]))
122 if(mp
->numsel
== 0) {
123 printf("anno: feta cheese and garlic\n"); /* never get here */
126 m_replace("folder", folder
);
127 if(mp
->lowsel
!= mp
->curmsg
)
128 m_setcur(mp
->lowsel
);
129 for(i
= mp
->lowsel
; i
<= mp
->hghsel
; i
++)
130 if(mp
->msgstats
[i
] & SELECTED
)
131 annotate(m_name(i
), component
, text
? text
: "");
143 * if(!(ap = rmquote(cp + 1)))
145 * astrings[astrp++] = ap;
151 * if(cp[i = length(cp) -1] != '\"') {
152 * printf("rmquote: string doesn't end with \"\n");
162 astrings[astrp++] = cp + 1;