2 ** Refile articles into the storage manager under the current storage.conf
3 ** rules, deleting articles from their old place in the spool.
4 ** Written 10-09-99 by rmtodd@servalan.servalan.com
6 ** Note that history and overview will have to be rebuilt for the moved
7 ** articles to be visible after they're moved.
10 /* include foo needed by libinn/storage manager */
15 #include "inn/innconf.h"
24 ProcessLine(char *line)
30 TOKEN token, newtoken;
36 /* zap newline at end of tokenptr, if present. */
37 len = strlen(tokenptr);
38 if (tokenptr[len-1] == '\n') {
39 tokenptr[len-1] = '\0';
42 token = TextToToken(tokenptr);
43 if ((art = SMretrieve(token, RETR_ALL)) == NULL) return;
46 arrived = art->arrived;
47 arttmp = xmalloc(len);
48 memcpy(arttmp, art->data, len);
50 if (!SMcancel(token)) {
51 fprintf(stderr, "%s: cant cancel %s:%s\n", ME, tokenptr, SMerrorstr);
57 newart.arrived = (time_t) 0; /* set current time */
58 newart.token = (TOKEN *)NULL;
60 newtoken = SMstore(newart);
61 if (newtoken.type == TOKEN_EMPTY) {
62 fprintf(stderr, "%s: cant store article:%s\n", ME, SMerrorstr);
66 printf("refiled %s ",TokenToText(token));
67 printf("to %s\n", TokenToText(newtoken));
72 main(int argc UNUSED, char *argv[])
79 if (!innconf_read(NULL))
82 if (!SMsetup(SM_PREOPEN, &one) || !SMsetup(SM_RDWR, (void *)&one)) {
83 fprintf(stderr, "can't init storage manager");
87 fprintf(stderr, "Can't init storage manager: %s", SMerrorstr);
89 while (fgets(buff, SMBUF, stdin)) {
92 printf("\nYou will now need to rebuild history and overview for the moved"
93 "\narticles to be visible again.\n");