- msgvec = (int *) salloc((msgCount + 2) * sizeof *msgvec);
- if ((file = snarf(str, &f)) == NOSTR)
- return(1);
- if ((file = expand(file)) == NOSTR)
- return(1);
- if (!f) {
- *msgvec = first(0, MMNORM);
- if (*msgvec == NULL) {
- printf("No messages to write.\n");
- return(1);
- }
- msgvec[1] = NULL;
- }
- if (f && getmsglist(str, msgvec, 0) < 0)
- return(1);
- printf("\"%s\" ", file);
- fflush(stdout);
- if (stat(file, &statb) >= 0)
- disp = "[Appended]";
- else
- disp = "[New file]";
- if ((obuf = fopen(file, "a")) == NULL) {
- perror(NOSTR);
- return(1);
- }
- cc = lc = 0;
- for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) {
- mesg = *ip;
- touch(mesg);
- mp = &message[mesg-1];
- mesf = setinput(mp);
- t = mp->m_lines - 2;
- readline(mesf, linebuf);
- while (t-- > 0) {
- fgets(linebuf, BUFSIZ, mesf);
- fputs(linebuf, obuf);
- cc += strlen(linebuf);
- }
- lc += mp->m_lines - 2;
- mp->m_flag |= MSAVED;
- }
- fflush(obuf);
- if (ferror(obuf))
- perror(file);
- fclose(obuf);
- printf("%s %d/%d\n", disp, lc, cc);
- return(0);
+ return save1(str, 1, "write", ignoreall);