19b50d902SRodney W. Grimes /*- 29b50d902SRodney W. Grimes * Copyright (c) 1980, 1993 39b50d902SRodney W. Grimes * The Regents of the University of California. All rights reserved. 49b50d902SRodney W. Grimes * 59b50d902SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 69b50d902SRodney W. Grimes * modification, are permitted provided that the following conditions 79b50d902SRodney W. Grimes * are met: 89b50d902SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 99b50d902SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 109b50d902SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 119b50d902SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 129b50d902SRodney W. Grimes * documentation and/or other materials provided with the distribution. 139b50d902SRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 149b50d902SRodney W. Grimes * must display the following acknowledgement: 159b50d902SRodney W. Grimes * This product includes software developed by the University of 169b50d902SRodney W. Grimes * California, Berkeley and its contributors. 179b50d902SRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 189b50d902SRodney W. Grimes * may be used to endorse or promote products derived from this software 199b50d902SRodney W. Grimes * without specific prior written permission. 209b50d902SRodney W. Grimes * 219b50d902SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 229b50d902SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 239b50d902SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 249b50d902SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 259b50d902SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 269b50d902SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 279b50d902SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 289b50d902SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 299b50d902SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 309b50d902SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 319b50d902SRodney W. Grimes * SUCH DAMAGE. 329b50d902SRodney W. Grimes */ 339b50d902SRodney W. Grimes 349b50d902SRodney W. Grimes #ifndef lint 359b50d902SRodney W. Grimes static char sccsid[] = "@(#)cmd1.c 8.1 (Berkeley) 6/6/93"; 369b50d902SRodney W. Grimes #endif /* not lint */ 379b50d902SRodney W. Grimes 389b50d902SRodney W. Grimes #include "rcv.h" 399b50d902SRodney W. Grimes #include "extern.h" 409b50d902SRodney W. Grimes 419b50d902SRodney W. Grimes /* 429b50d902SRodney W. Grimes * Mail -- a mail program 439b50d902SRodney W. Grimes * 449b50d902SRodney W. Grimes * User commands. 459b50d902SRodney W. Grimes */ 469b50d902SRodney W. Grimes 479b50d902SRodney W. Grimes /* 489b50d902SRodney W. Grimes * Print the current active headings. 499b50d902SRodney W. Grimes * Don't change dot if invoker didn't give an argument. 509b50d902SRodney W. Grimes */ 519b50d902SRodney W. Grimes 529b50d902SRodney W. Grimes static int screen; 539b50d902SRodney W. Grimes 549b50d902SRodney W. Grimes int 559b50d902SRodney W. Grimes headers(msgvec) 569b50d902SRodney W. Grimes int *msgvec; 579b50d902SRodney W. Grimes { 589b50d902SRodney W. Grimes register int n, mesg, flag; 599b50d902SRodney W. Grimes register struct message *mp; 609b50d902SRodney W. Grimes int size; 619b50d902SRodney W. Grimes 629b50d902SRodney W. Grimes size = screensize(); 639b50d902SRodney W. Grimes n = msgvec[0]; 649b50d902SRodney W. Grimes if (n != 0) 659b50d902SRodney W. Grimes screen = (n-1)/size; 669b50d902SRodney W. Grimes if (screen < 0) 679b50d902SRodney W. Grimes screen = 0; 689b50d902SRodney W. Grimes mp = &message[screen * size]; 699b50d902SRodney W. Grimes if (mp >= &message[msgCount]) 709b50d902SRodney W. Grimes mp = &message[msgCount - size]; 719b50d902SRodney W. Grimes if (mp < &message[0]) 729b50d902SRodney W. Grimes mp = &message[0]; 739b50d902SRodney W. Grimes flag = 0; 749b50d902SRodney W. Grimes mesg = mp - &message[0]; 759b50d902SRodney W. Grimes if (dot != &message[n-1]) 769b50d902SRodney W. Grimes dot = mp; 779b50d902SRodney W. Grimes for (; mp < &message[msgCount]; mp++) { 789b50d902SRodney W. Grimes mesg++; 799b50d902SRodney W. Grimes if (mp->m_flag & MDELETED) 809b50d902SRodney W. Grimes continue; 819b50d902SRodney W. Grimes if (flag++ >= size) 829b50d902SRodney W. Grimes break; 839b50d902SRodney W. Grimes printhead(mesg); 849b50d902SRodney W. Grimes } 859b50d902SRodney W. Grimes if (flag == 0) { 869b50d902SRodney W. Grimes printf("No more mail.\n"); 879b50d902SRodney W. Grimes return(1); 889b50d902SRodney W. Grimes } 899b50d902SRodney W. Grimes return(0); 909b50d902SRodney W. Grimes } 919b50d902SRodney W. Grimes 929b50d902SRodney W. Grimes /* 939b50d902SRodney W. Grimes * Scroll to the next/previous screen 949b50d902SRodney W. Grimes */ 959b50d902SRodney W. Grimes int 969b50d902SRodney W. Grimes scroll(arg) 979b50d902SRodney W. Grimes char arg[]; 989b50d902SRodney W. Grimes { 999b50d902SRodney W. Grimes register int s, size; 1009b50d902SRodney W. Grimes int cur[1]; 1019b50d902SRodney W. Grimes 1029b50d902SRodney W. Grimes cur[0] = 0; 1039b50d902SRodney W. Grimes size = screensize(); 1049b50d902SRodney W. Grimes s = screen; 1059b50d902SRodney W. Grimes switch (*arg) { 1069b50d902SRodney W. Grimes case 0: 1079b50d902SRodney W. Grimes case '+': 1089b50d902SRodney W. Grimes s++; 1099b50d902SRodney W. Grimes if (s * size > msgCount) { 1109b50d902SRodney W. Grimes printf("On last screenful of messages\n"); 1119b50d902SRodney W. Grimes return(0); 1129b50d902SRodney W. Grimes } 1139b50d902SRodney W. Grimes screen = s; 1149b50d902SRodney W. Grimes break; 1159b50d902SRodney W. Grimes 1169b50d902SRodney W. Grimes case '-': 1179b50d902SRodney W. Grimes if (--s < 0) { 1189b50d902SRodney W. Grimes printf("On first screenful of messages\n"); 1199b50d902SRodney W. Grimes return(0); 1209b50d902SRodney W. Grimes } 1219b50d902SRodney W. Grimes screen = s; 1229b50d902SRodney W. Grimes break; 1239b50d902SRodney W. Grimes 1249b50d902SRodney W. Grimes default: 1259b50d902SRodney W. Grimes printf("Unrecognized scrolling command \"%s\"\n", arg); 1269b50d902SRodney W. Grimes return(1); 1279b50d902SRodney W. Grimes } 1289b50d902SRodney W. Grimes return(headers(cur)); 1299b50d902SRodney W. Grimes } 1309b50d902SRodney W. Grimes 1319b50d902SRodney W. Grimes /* 1329b50d902SRodney W. Grimes * Compute screen size. 1339b50d902SRodney W. Grimes */ 1349b50d902SRodney W. Grimes int 1359b50d902SRodney W. Grimes screensize() 1369b50d902SRodney W. Grimes { 1379b50d902SRodney W. Grimes int s; 1389b50d902SRodney W. Grimes char *cp; 1399b50d902SRodney W. Grimes 1409b50d902SRodney W. Grimes if ((cp = value("screen")) != NOSTR && (s = atoi(cp)) > 0) 1419b50d902SRodney W. Grimes return s; 1429b50d902SRodney W. Grimes return screenheight - 4; 1439b50d902SRodney W. Grimes } 1449b50d902SRodney W. Grimes 1459b50d902SRodney W. Grimes /* 1469b50d902SRodney W. Grimes * Print out the headlines for each message 1479b50d902SRodney W. Grimes * in the passed message list. 1489b50d902SRodney W. Grimes */ 1499b50d902SRodney W. Grimes int 1509b50d902SRodney W. Grimes from(msgvec) 1519b50d902SRodney W. Grimes int *msgvec; 1529b50d902SRodney W. Grimes { 1539b50d902SRodney W. Grimes register int *ip; 1549b50d902SRodney W. Grimes 155d030d2d2SPoul-Henning Kamp for (ip = msgvec; *ip != 0; ip++) 1569b50d902SRodney W. Grimes printhead(*ip); 1579b50d902SRodney W. Grimes if (--ip >= msgvec) 1589b50d902SRodney W. Grimes dot = &message[*ip - 1]; 1599b50d902SRodney W. Grimes return(0); 1609b50d902SRodney W. Grimes } 1619b50d902SRodney W. Grimes 1629b50d902SRodney W. Grimes /* 1639b50d902SRodney W. Grimes * Print out the header of a specific message. 1649b50d902SRodney W. Grimes * This is a slight improvement to the standard one. 1659b50d902SRodney W. Grimes */ 1669b50d902SRodney W. Grimes void 1679b50d902SRodney W. Grimes printhead(mesg) 1689b50d902SRodney W. Grimes int mesg; 1699b50d902SRodney W. Grimes { 1709b50d902SRodney W. Grimes struct message *mp; 1719b50d902SRodney W. Grimes char headline[LINESIZE], wcount[LINESIZE], *subjline, dispc, curind; 1729b50d902SRodney W. Grimes char pbuf[BUFSIZ]; 1739b50d902SRodney W. Grimes struct headline hl; 1749b50d902SRodney W. Grimes int subjlen; 1759b50d902SRodney W. Grimes char *name; 1769b50d902SRodney W. Grimes 1779b50d902SRodney W. Grimes mp = &message[mesg-1]; 1789b50d902SRodney W. Grimes (void) readline(setinput(mp), headline, LINESIZE); 1799b50d902SRodney W. Grimes if ((subjline = hfield("subject", mp)) == NOSTR) 1809b50d902SRodney W. Grimes subjline = hfield("subj", mp); 1819b50d902SRodney W. Grimes /* 1829b50d902SRodney W. Grimes * Bletch! 1839b50d902SRodney W. Grimes */ 1849b50d902SRodney W. Grimes curind = dot == mp ? '>' : ' '; 1859b50d902SRodney W. Grimes dispc = ' '; 1869b50d902SRodney W. Grimes if (mp->m_flag & MSAVED) 1879b50d902SRodney W. Grimes dispc = '*'; 1889b50d902SRodney W. Grimes if (mp->m_flag & MPRESERVE) 1899b50d902SRodney W. Grimes dispc = 'P'; 1909b50d902SRodney W. Grimes if ((mp->m_flag & (MREAD|MNEW)) == MNEW) 1919b50d902SRodney W. Grimes dispc = 'N'; 1929b50d902SRodney W. Grimes if ((mp->m_flag & (MREAD|MNEW)) == 0) 1939b50d902SRodney W. Grimes dispc = 'U'; 1949b50d902SRodney W. Grimes if (mp->m_flag & MBOX) 1959b50d902SRodney W. Grimes dispc = 'M'; 1969b50d902SRodney W. Grimes parse(headline, &hl, pbuf); 19722694ebaSBruce Evans sprintf(wcount, "%3ld/%-5ld", mp->m_lines, mp->m_size); 1989b50d902SRodney W. Grimes subjlen = screenwidth - 50 - strlen(wcount); 1999b50d902SRodney W. Grimes name = value("show-rcpt") != NOSTR ? 2009b50d902SRodney W. Grimes skin(hfield("to", mp)) : nameof(mp, 0); 2019b50d902SRodney W. Grimes if (subjline == NOSTR || subjlen < 0) /* pretty pathetic */ 2029b50d902SRodney W. Grimes printf("%c%c%3d %-20.20s %16.16s %s\n", 2039b50d902SRodney W. Grimes curind, dispc, mesg, name, hl.l_date, wcount); 2049b50d902SRodney W. Grimes else 2059b50d902SRodney W. Grimes printf("%c%c%3d %-20.20s %16.16s %s \"%.*s\"\n", 2069b50d902SRodney W. Grimes curind, dispc, mesg, name, hl.l_date, wcount, 2079b50d902SRodney W. Grimes subjlen, subjline); 2089b50d902SRodney W. Grimes } 2099b50d902SRodney W. Grimes 2109b50d902SRodney W. Grimes /* 2119b50d902SRodney W. Grimes * Print out the value of dot. 2129b50d902SRodney W. Grimes */ 2139b50d902SRodney W. Grimes int 2149b50d902SRodney W. Grimes pdot() 2159b50d902SRodney W. Grimes { 2169b50d902SRodney W. Grimes printf("%d\n", dot - &message[0] + 1); 2179b50d902SRodney W. Grimes return(0); 2189b50d902SRodney W. Grimes } 2199b50d902SRodney W. Grimes 2209b50d902SRodney W. Grimes /* 2219b50d902SRodney W. Grimes * Print out all the possible commands. 2229b50d902SRodney W. Grimes */ 2239b50d902SRodney W. Grimes int 2249b50d902SRodney W. Grimes pcmdlist() 2259b50d902SRodney W. Grimes { 2269b50d902SRodney W. Grimes register struct cmd *cp; 2279b50d902SRodney W. Grimes register int cc; 2289b50d902SRodney W. Grimes extern struct cmd cmdtab[]; 2299b50d902SRodney W. Grimes 2309b50d902SRodney W. Grimes printf("Commands are:\n"); 2319b50d902SRodney W. Grimes for (cc = 0, cp = cmdtab; cp->c_name != NULL; cp++) { 2329b50d902SRodney W. Grimes cc += strlen(cp->c_name) + 2; 2339b50d902SRodney W. Grimes if (cc > 72) { 2349b50d902SRodney W. Grimes printf("\n"); 2359b50d902SRodney W. Grimes cc = strlen(cp->c_name) + 2; 2369b50d902SRodney W. Grimes } 2379b50d902SRodney W. Grimes if ((cp+1)->c_name != NOSTR) 2389b50d902SRodney W. Grimes printf("%s, ", cp->c_name); 2399b50d902SRodney W. Grimes else 2409b50d902SRodney W. Grimes printf("%s\n", cp->c_name); 2419b50d902SRodney W. Grimes } 2429b50d902SRodney W. Grimes return(0); 2439b50d902SRodney W. Grimes } 2449b50d902SRodney W. Grimes 2459b50d902SRodney W. Grimes /* 2469b50d902SRodney W. Grimes * Paginate messages, honor ignored fields. 2479b50d902SRodney W. Grimes */ 2489b50d902SRodney W. Grimes int 2499b50d902SRodney W. Grimes more(msgvec) 2509b50d902SRodney W. Grimes int *msgvec; 2519b50d902SRodney W. Grimes { 2529b50d902SRodney W. Grimes return (type1(msgvec, 1, 1)); 2539b50d902SRodney W. Grimes } 2549b50d902SRodney W. Grimes 2559b50d902SRodney W. Grimes /* 2569b50d902SRodney W. Grimes * Paginate messages, even printing ignored fields. 2579b50d902SRodney W. Grimes */ 2589b50d902SRodney W. Grimes int 2599b50d902SRodney W. Grimes More(msgvec) 2609b50d902SRodney W. Grimes int *msgvec; 2619b50d902SRodney W. Grimes { 2629b50d902SRodney W. Grimes 2639b50d902SRodney W. Grimes return (type1(msgvec, 0, 1)); 2649b50d902SRodney W. Grimes } 2659b50d902SRodney W. Grimes 2669b50d902SRodney W. Grimes /* 2679b50d902SRodney W. Grimes * Type out messages, honor ignored fields. 2689b50d902SRodney W. Grimes */ 2699b50d902SRodney W. Grimes int 2709b50d902SRodney W. Grimes type(msgvec) 2719b50d902SRodney W. Grimes int *msgvec; 2729b50d902SRodney W. Grimes { 2739b50d902SRodney W. Grimes 2749b50d902SRodney W. Grimes return(type1(msgvec, 1, 0)); 2759b50d902SRodney W. Grimes } 2769b50d902SRodney W. Grimes 2779b50d902SRodney W. Grimes /* 2789b50d902SRodney W. Grimes * Type out messages, even printing ignored fields. 2799b50d902SRodney W. Grimes */ 2809b50d902SRodney W. Grimes int 2819b50d902SRodney W. Grimes Type(msgvec) 2829b50d902SRodney W. Grimes int *msgvec; 2839b50d902SRodney W. Grimes { 2849b50d902SRodney W. Grimes 2859b50d902SRodney W. Grimes return(type1(msgvec, 0, 0)); 2869b50d902SRodney W. Grimes } 2879b50d902SRodney W. Grimes 2889b50d902SRodney W. Grimes /* 2899b50d902SRodney W. Grimes * Type out the messages requested. 2909b50d902SRodney W. Grimes */ 2919b50d902SRodney W. Grimes jmp_buf pipestop; 2929b50d902SRodney W. Grimes int 2939b50d902SRodney W. Grimes type1(msgvec, doign, page) 2949b50d902SRodney W. Grimes int *msgvec; 2959b50d902SRodney W. Grimes int doign, page; 2969b50d902SRodney W. Grimes { 2979b50d902SRodney W. Grimes register *ip; 2989b50d902SRodney W. Grimes register struct message *mp; 2999b50d902SRodney W. Grimes register char *cp; 3009b50d902SRodney W. Grimes int nlines; 3019b50d902SRodney W. Grimes FILE *obuf; 3029b50d902SRodney W. Grimes 3039b50d902SRodney W. Grimes obuf = stdout; 3049b50d902SRodney W. Grimes if (setjmp(pipestop)) 3059b50d902SRodney W. Grimes goto close_pipe; 3069b50d902SRodney W. Grimes if (value("interactive") != NOSTR && 3079b50d902SRodney W. Grimes (page || (cp = value("crt")) != NOSTR)) { 3089b50d902SRodney W. Grimes nlines = 0; 3099b50d902SRodney W. Grimes if (!page) { 3109b50d902SRodney W. Grimes for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) 3119b50d902SRodney W. Grimes nlines += message[*ip - 1].m_lines; 3129b50d902SRodney W. Grimes } 3139b50d902SRodney W. Grimes if (page || nlines > (*cp ? atoi(cp) : realscreenheight)) { 3149b50d902SRodney W. Grimes cp = value("PAGER"); 3159b50d902SRodney W. Grimes if (cp == NULL || *cp == '\0') 3169b50d902SRodney W. Grimes cp = _PATH_MORE; 3179b50d902SRodney W. Grimes obuf = Popen(cp, "w"); 3189b50d902SRodney W. Grimes if (obuf == NULL) { 3199b50d902SRodney W. Grimes perror(cp); 3209b50d902SRodney W. Grimes obuf = stdout; 3219b50d902SRodney W. Grimes } else 3229b50d902SRodney W. Grimes signal(SIGPIPE, brokpipe); 3239b50d902SRodney W. Grimes } 3249b50d902SRodney W. Grimes } 3259b50d902SRodney W. Grimes for (ip = msgvec; *ip && ip - msgvec < msgCount; ip++) { 3269b50d902SRodney W. Grimes mp = &message[*ip - 1]; 3279b50d902SRodney W. Grimes touch(mp); 3289b50d902SRodney W. Grimes dot = mp; 3299b50d902SRodney W. Grimes if (value("quiet") == NOSTR) 3309b50d902SRodney W. Grimes fprintf(obuf, "Message %d:\n", *ip); 3319b50d902SRodney W. Grimes (void) send(mp, obuf, doign ? ignore : 0, NOSTR); 3329b50d902SRodney W. Grimes } 3339b50d902SRodney W. Grimes close_pipe: 3349b50d902SRodney W. Grimes if (obuf != stdout) { 3359b50d902SRodney W. Grimes /* 3369b50d902SRodney W. Grimes * Ignore SIGPIPE so it can't cause a duplicate close. 3379b50d902SRodney W. Grimes */ 3389b50d902SRodney W. Grimes signal(SIGPIPE, SIG_IGN); 3399b50d902SRodney W. Grimes Pclose(obuf); 3409b50d902SRodney W. Grimes signal(SIGPIPE, SIG_DFL); 3419b50d902SRodney W. Grimes } 3429b50d902SRodney W. Grimes return(0); 3439b50d902SRodney W. Grimes } 3449b50d902SRodney W. Grimes 3459b50d902SRodney W. Grimes /* 3469b50d902SRodney W. Grimes * Respond to a broken pipe signal -- 3479b50d902SRodney W. Grimes * probably caused by quitting more. 3489b50d902SRodney W. Grimes */ 3499b50d902SRodney W. Grimes void 3509b50d902SRodney W. Grimes brokpipe(signo) 3519b50d902SRodney W. Grimes int signo; 3529b50d902SRodney W. Grimes { 3539b50d902SRodney W. Grimes longjmp(pipestop, 1); 3549b50d902SRodney W. Grimes } 3559b50d902SRodney W. Grimes 3569b50d902SRodney W. Grimes /* 3579b50d902SRodney W. Grimes * Print the top so many lines of each desired message. 3589b50d902SRodney W. Grimes * The number of lines is taken from the variable "toplines" 3599b50d902SRodney W. Grimes * and defaults to 5. 3609b50d902SRodney W. Grimes */ 3619b50d902SRodney W. Grimes int 3629b50d902SRodney W. Grimes top(msgvec) 3639b50d902SRodney W. Grimes int *msgvec; 3649b50d902SRodney W. Grimes { 3659b50d902SRodney W. Grimes register int *ip; 3669b50d902SRodney W. Grimes register struct message *mp; 3679b50d902SRodney W. Grimes int c, topl, lines, lineb; 3689b50d902SRodney W. Grimes char *valtop, linebuf[LINESIZE]; 3699b50d902SRodney W. Grimes FILE *ibuf; 3709b50d902SRodney W. Grimes 3719b50d902SRodney W. Grimes topl = 5; 3729b50d902SRodney W. Grimes valtop = value("toplines"); 3739b50d902SRodney W. Grimes if (valtop != NOSTR) { 3749b50d902SRodney W. Grimes topl = atoi(valtop); 3759b50d902SRodney W. Grimes if (topl < 0 || topl > 10000) 3769b50d902SRodney W. Grimes topl = 5; 3779b50d902SRodney W. Grimes } 3789b50d902SRodney W. Grimes lineb = 1; 3799b50d902SRodney W. Grimes for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) { 3809b50d902SRodney W. Grimes mp = &message[*ip - 1]; 3819b50d902SRodney W. Grimes touch(mp); 3829b50d902SRodney W. Grimes dot = mp; 3839b50d902SRodney W. Grimes if (value("quiet") == NOSTR) 3849b50d902SRodney W. Grimes printf("Message %d:\n", *ip); 3859b50d902SRodney W. Grimes ibuf = setinput(mp); 3869b50d902SRodney W. Grimes c = mp->m_lines; 3879b50d902SRodney W. Grimes if (!lineb) 3889b50d902SRodney W. Grimes printf("\n"); 3899b50d902SRodney W. Grimes for (lines = 0; lines < c && lines <= topl; lines++) { 3909b50d902SRodney W. Grimes if (readline(ibuf, linebuf, LINESIZE) < 0) 3919b50d902SRodney W. Grimes break; 3929b50d902SRodney W. Grimes puts(linebuf); 3939b50d902SRodney W. Grimes lineb = blankline(linebuf); 3949b50d902SRodney W. Grimes } 3959b50d902SRodney W. Grimes } 3969b50d902SRodney W. Grimes return(0); 3979b50d902SRodney W. Grimes } 3989b50d902SRodney W. Grimes 3999b50d902SRodney W. Grimes /* 4009b50d902SRodney W. Grimes * Touch all the given messages so that they will 4019b50d902SRodney W. Grimes * get mboxed. 4029b50d902SRodney W. Grimes */ 4039b50d902SRodney W. Grimes int 4049b50d902SRodney W. Grimes stouch(msgvec) 4059b50d902SRodney W. Grimes int msgvec[]; 4069b50d902SRodney W. Grimes { 4079b50d902SRodney W. Grimes register int *ip; 4089b50d902SRodney W. Grimes 4099b50d902SRodney W. Grimes for (ip = msgvec; *ip != 0; ip++) { 4109b50d902SRodney W. Grimes dot = &message[*ip-1]; 4119b50d902SRodney W. Grimes dot->m_flag |= MTOUCH; 4129b50d902SRodney W. Grimes dot->m_flag &= ~MPRESERVE; 4139b50d902SRodney W. Grimes } 4149b50d902SRodney W. Grimes return(0); 4159b50d902SRodney W. Grimes } 4169b50d902SRodney W. Grimes 4179b50d902SRodney W. Grimes /* 4189b50d902SRodney W. Grimes * Make sure all passed messages get mboxed. 4199b50d902SRodney W. Grimes */ 4209b50d902SRodney W. Grimes int 4219b50d902SRodney W. Grimes mboxit(msgvec) 4229b50d902SRodney W. Grimes int msgvec[]; 4239b50d902SRodney W. Grimes { 4249b50d902SRodney W. Grimes register int *ip; 4259b50d902SRodney W. Grimes 4269b50d902SRodney W. Grimes for (ip = msgvec; *ip != 0; ip++) { 4279b50d902SRodney W. Grimes dot = &message[*ip-1]; 4289b50d902SRodney W. Grimes dot->m_flag |= MTOUCH|MBOX; 4299b50d902SRodney W. Grimes dot->m_flag &= ~MPRESERVE; 4309b50d902SRodney W. Grimes } 4319b50d902SRodney W. Grimes return(0); 4329b50d902SRodney W. Grimes } 4339b50d902SRodney W. Grimes 4349b50d902SRodney W. Grimes /* 4359b50d902SRodney W. Grimes * List the folders the user currently has. 4369b50d902SRodney W. Grimes */ 4379b50d902SRodney W. Grimes int 4389b50d902SRodney W. Grimes folders() 4399b50d902SRodney W. Grimes { 4409b50d902SRodney W. Grimes char dirname[BUFSIZ]; 4419b50d902SRodney W. Grimes char *cmd; 4429b50d902SRodney W. Grimes 4439b50d902SRodney W. Grimes if (getfold(dirname) < 0) { 4449b50d902SRodney W. Grimes printf("No value set for \"folder\"\n"); 4459b50d902SRodney W. Grimes return 1; 4469b50d902SRodney W. Grimes } 4479b50d902SRodney W. Grimes if ((cmd = value("LISTER")) == NOSTR) 4489b50d902SRodney W. Grimes cmd = "ls"; 4499b50d902SRodney W. Grimes (void) run_command(cmd, 0, -1, -1, dirname, NOSTR, NOSTR); 4509b50d902SRodney W. Grimes return 0; 4519b50d902SRodney W. Grimes } 452