struct stat st2;
char *msgs, *folder;
char buf[BUFSIZ];
+ char *vec[MAXARGS];
+ int vecp;
+ char *cp, *dp;
if (altmsg && (stat(altmsg, &st2) == NOTOK ||
st->st_mtime != st2.st_mtime ||
advise(NULL, "annotate as `%s': %s %s", annotext,
folder, msgs);
}
- snprintf(buf, sizeof buf, "anno -comp '%s' '+%s' %s",
- annotext, folder, msgs);
- if (system(buf) != 0) {
+ vec[vecp++] = "anno";
+ vec[vecp++] = "-comp";
+ vec[vecp++] = annotext;
+ snprintf(buf, sizeof buf, "+%s", folder);
+ vec[vecp++] = buf;
+
+ while (isspace(*msgs)) {
+ msgs++;
+ }
+ for (cp=dp=msgs; *cp; cp++) {
+ if (isspace(*cp)) {
+ while (isspace(*cp)) {
+ *cp++ = '\0';
+ }
+ vec[vecp++] = dp;
+ dp = cp;
+ }
+ }
+ vec[vecp++] = dp;
+ vec[vecp] = NULL;
+ if (execprog(*vec, vec) != 0) {
advise(NULL, "unable to annotate");
}
}