1994-05-27 12:33:43 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1980, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef lint
|
2001-03-25 04:57:05 +00:00
|
|
|
#if 0
|
2001-12-18 20:52:09 +00:00
|
|
|
static char sccsid[] = "@(#)cmd1.c 8.2 (Berkeley) 4/20/95";
|
2001-03-25 04:57:05 +00:00
|
|
|
#endif
|
1994-05-27 12:33:43 +00:00
|
|
|
#endif /* not lint */
|
2002-06-30 05:25:07 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
1994-05-27 12:33:43 +00:00
|
|
|
|
|
|
|
#include "rcv.h"
|
|
|
|
#include "extern.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mail -- a mail program
|
|
|
|
*
|
|
|
|
* User commands.
|
|
|
|
*/
|
|
|
|
|
2001-05-27 20:26:22 +00:00
|
|
|
extern const struct cmd cmdtab[];
|
|
|
|
|
1994-05-27 12:33:43 +00:00
|
|
|
/*
|
|
|
|
* Print the current active headings.
|
|
|
|
* Don't change dot if invoker didn't give an argument.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int screen;
|
|
|
|
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
headers(int *msgvec)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
2001-05-27 20:26:22 +00:00
|
|
|
int n, mesg, flag, size;
|
|
|
|
struct message *mp;
|
1994-05-27 12:33:43 +00:00
|
|
|
|
|
|
|
size = screensize();
|
|
|
|
n = msgvec[0];
|
|
|
|
if (n != 0)
|
|
|
|
screen = (n-1)/size;
|
|
|
|
if (screen < 0)
|
|
|
|
screen = 0;
|
|
|
|
mp = &message[screen * size];
|
|
|
|
if (mp >= &message[msgCount])
|
|
|
|
mp = &message[msgCount - size];
|
|
|
|
if (mp < &message[0])
|
|
|
|
mp = &message[0];
|
|
|
|
flag = 0;
|
|
|
|
mesg = mp - &message[0];
|
|
|
|
if (dot != &message[n-1])
|
|
|
|
dot = mp;
|
|
|
|
for (; mp < &message[msgCount]; mp++) {
|
|
|
|
mesg++;
|
|
|
|
if (mp->m_flag & MDELETED)
|
|
|
|
continue;
|
|
|
|
if (flag++ >= size)
|
|
|
|
break;
|
|
|
|
printhead(mesg);
|
|
|
|
}
|
|
|
|
if (flag == 0) {
|
|
|
|
printf("No more mail.\n");
|
2001-05-27 20:26:22 +00:00
|
|
|
return (1);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
2001-05-27 20:26:22 +00:00
|
|
|
return (0);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Scroll to the next/previous screen
|
|
|
|
*/
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
scroll(char arg[])
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
2001-05-27 20:26:22 +00:00
|
|
|
int s, size;
|
1994-05-27 12:33:43 +00:00
|
|
|
int cur[1];
|
|
|
|
|
|
|
|
cur[0] = 0;
|
|
|
|
size = screensize();
|
|
|
|
s = screen;
|
|
|
|
switch (*arg) {
|
|
|
|
case 0:
|
|
|
|
case '+':
|
|
|
|
s++;
|
2001-12-18 20:52:09 +00:00
|
|
|
if (s * size >= msgCount) {
|
1994-05-27 12:33:43 +00:00
|
|
|
printf("On last screenful of messages\n");
|
2001-05-27 20:26:22 +00:00
|
|
|
return (0);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
screen = s;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '-':
|
|
|
|
if (--s < 0) {
|
|
|
|
printf("On first screenful of messages\n");
|
2001-05-27 20:26:22 +00:00
|
|
|
return (0);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
screen = s;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
printf("Unrecognized scrolling command \"%s\"\n", arg);
|
2001-05-27 20:26:22 +00:00
|
|
|
return (1);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
2001-05-27 20:26:22 +00:00
|
|
|
return (headers(cur));
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Compute screen size.
|
|
|
|
*/
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
screensize(void)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
|
|
|
int s;
|
|
|
|
char *cp;
|
|
|
|
|
2001-05-27 20:26:22 +00:00
|
|
|
if ((cp = value("screen")) != NULL && (s = atoi(cp)) > 0)
|
|
|
|
return (s);
|
|
|
|
return (screenheight - 4);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print out the headlines for each message
|
|
|
|
* in the passed message list.
|
|
|
|
*/
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
from(int *msgvec)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
2001-05-27 20:26:22 +00:00
|
|
|
int *ip;
|
1994-05-27 12:33:43 +00:00
|
|
|
|
1997-09-18 14:08:40 +00:00
|
|
|
for (ip = msgvec; *ip != 0; ip++)
|
1994-05-27 12:33:43 +00:00
|
|
|
printhead(*ip);
|
|
|
|
if (--ip >= msgvec)
|
|
|
|
dot = &message[*ip - 1];
|
2001-05-27 20:26:22 +00:00
|
|
|
return (0);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print out the header of a specific message.
|
|
|
|
* This is a slight improvement to the standard one.
|
|
|
|
*/
|
|
|
|
void
|
2010-12-19 14:18:07 +00:00
|
|
|
printhead(int mesg)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
|
|
|
struct message *mp;
|
|
|
|
char headline[LINESIZE], wcount[LINESIZE], *subjline, dispc, curind;
|
|
|
|
char pbuf[BUFSIZ];
|
|
|
|
struct headline hl;
|
|
|
|
int subjlen;
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
mp = &message[mesg-1];
|
2001-05-27 20:26:22 +00:00
|
|
|
(void)readline(setinput(mp), headline, LINESIZE);
|
|
|
|
if ((subjline = hfield("subject", mp)) == NULL)
|
1994-05-27 12:33:43 +00:00
|
|
|
subjline = hfield("subj", mp);
|
|
|
|
/*
|
|
|
|
* Bletch!
|
|
|
|
*/
|
|
|
|
curind = dot == mp ? '>' : ' ';
|
|
|
|
dispc = ' ';
|
|
|
|
if (mp->m_flag & MSAVED)
|
|
|
|
dispc = '*';
|
|
|
|
if (mp->m_flag & MPRESERVE)
|
|
|
|
dispc = 'P';
|
|
|
|
if ((mp->m_flag & (MREAD|MNEW)) == MNEW)
|
|
|
|
dispc = 'N';
|
|
|
|
if ((mp->m_flag & (MREAD|MNEW)) == 0)
|
|
|
|
dispc = 'U';
|
|
|
|
if (mp->m_flag & MBOX)
|
|
|
|
dispc = 'M';
|
|
|
|
parse(headline, &hl, pbuf);
|
1998-07-06 21:01:54 +00:00
|
|
|
sprintf(wcount, "%3ld/%-5ld", mp->m_lines, mp->m_size);
|
1994-05-27 12:33:43 +00:00
|
|
|
subjlen = screenwidth - 50 - strlen(wcount);
|
2001-05-27 20:26:22 +00:00
|
|
|
name = value("show-rcpt") != NULL ?
|
1994-05-27 12:33:43 +00:00
|
|
|
skin(hfield("to", mp)) : nameof(mp, 0);
|
2001-05-27 20:26:22 +00:00
|
|
|
if (subjline == NULL || subjlen < 0) /* pretty pathetic */
|
1994-05-27 12:33:43 +00:00
|
|
|
printf("%c%c%3d %-20.20s %16.16s %s\n",
|
|
|
|
curind, dispc, mesg, name, hl.l_date, wcount);
|
|
|
|
else
|
|
|
|
printf("%c%c%3d %-20.20s %16.16s %s \"%.*s\"\n",
|
|
|
|
curind, dispc, mesg, name, hl.l_date, wcount,
|
|
|
|
subjlen, subjline);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print out the value of dot.
|
|
|
|
*/
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
pdot(void)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
|
|
|
printf("%d\n", dot - &message[0] + 1);
|
2001-05-27 20:26:22 +00:00
|
|
|
return (0);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print out all the possible commands.
|
|
|
|
*/
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
pcmdlist(void)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
2001-05-27 20:26:22 +00:00
|
|
|
const struct cmd *cp;
|
|
|
|
int cc;
|
1994-05-27 12:33:43 +00:00
|
|
|
|
|
|
|
printf("Commands are:\n");
|
|
|
|
for (cc = 0, cp = cmdtab; cp->c_name != NULL; cp++) {
|
|
|
|
cc += strlen(cp->c_name) + 2;
|
|
|
|
if (cc > 72) {
|
|
|
|
printf("\n");
|
|
|
|
cc = strlen(cp->c_name) + 2;
|
|
|
|
}
|
2001-05-27 20:26:22 +00:00
|
|
|
if ((cp+1)->c_name != NULL)
|
1994-05-27 12:33:43 +00:00
|
|
|
printf("%s, ", cp->c_name);
|
|
|
|
else
|
|
|
|
printf("%s\n", cp->c_name);
|
|
|
|
}
|
2001-05-27 20:26:22 +00:00
|
|
|
return (0);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Paginate messages, honor ignored fields.
|
|
|
|
*/
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
more(int *msgvec)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
2001-05-27 20:26:22 +00:00
|
|
|
|
1994-05-27 12:33:43 +00:00
|
|
|
return (type1(msgvec, 1, 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Paginate messages, even printing ignored fields.
|
|
|
|
*/
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
More(int *msgvec)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
return (type1(msgvec, 0, 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Type out messages, honor ignored fields.
|
|
|
|
*/
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
type(int *msgvec)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
|
|
|
|
2001-05-27 20:26:22 +00:00
|
|
|
return (type1(msgvec, 1, 0));
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Type out messages, even printing ignored fields.
|
|
|
|
*/
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
Type(int *msgvec)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
|
|
|
|
2001-05-27 20:26:22 +00:00
|
|
|
return (type1(msgvec, 0, 0));
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Type out the messages requested.
|
|
|
|
*/
|
2007-11-08 11:13:03 +00:00
|
|
|
static jmp_buf pipestop;
|
1994-05-27 12:33:43 +00:00
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
type1(int *msgvec, int doign, int page)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
2001-05-27 20:26:22 +00:00
|
|
|
int nlines, *ip;
|
|
|
|
struct message *mp;
|
|
|
|
char *cp;
|
1994-05-27 12:33:43 +00:00
|
|
|
FILE *obuf;
|
|
|
|
|
|
|
|
obuf = stdout;
|
|
|
|
if (setjmp(pipestop))
|
|
|
|
goto close_pipe;
|
2001-05-27 20:26:22 +00:00
|
|
|
if (value("interactive") != NULL &&
|
|
|
|
(page || (cp = value("crt")) != NULL)) {
|
1994-05-27 12:33:43 +00:00
|
|
|
nlines = 0;
|
|
|
|
if (!page) {
|
|
|
|
for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++)
|
|
|
|
nlines += message[*ip - 1].m_lines;
|
|
|
|
}
|
|
|
|
if (page || nlines > (*cp ? atoi(cp) : realscreenheight)) {
|
|
|
|
cp = value("PAGER");
|
|
|
|
if (cp == NULL || *cp == '\0')
|
|
|
|
cp = _PATH_MORE;
|
|
|
|
obuf = Popen(cp, "w");
|
|
|
|
if (obuf == NULL) {
|
2001-03-25 04:57:05 +00:00
|
|
|
warnx("%s", cp);
|
1994-05-27 12:33:43 +00:00
|
|
|
obuf = stdout;
|
|
|
|
} else
|
2001-05-27 20:26:22 +00:00
|
|
|
(void)signal(SIGPIPE, brokpipe);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
}
|
2001-05-27 20:26:22 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Send messages to the output.
|
|
|
|
*
|
|
|
|
*/
|
1994-05-27 12:33:43 +00:00
|
|
|
for (ip = msgvec; *ip && ip - msgvec < msgCount; ip++) {
|
|
|
|
mp = &message[*ip - 1];
|
|
|
|
touch(mp);
|
|
|
|
dot = mp;
|
2001-05-27 20:26:22 +00:00
|
|
|
if (value("quiet") == NULL)
|
1994-05-27 12:33:43 +00:00
|
|
|
fprintf(obuf, "Message %d:\n", *ip);
|
2001-05-27 20:26:22 +00:00
|
|
|
(void)sendmessage(mp, obuf, doign ? ignore : 0, NULL);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
2001-05-27 20:26:22 +00:00
|
|
|
|
1994-05-27 12:33:43 +00:00
|
|
|
close_pipe:
|
|
|
|
if (obuf != stdout) {
|
|
|
|
/*
|
|
|
|
* Ignore SIGPIPE so it can't cause a duplicate close.
|
|
|
|
*/
|
2001-05-27 20:26:22 +00:00
|
|
|
(void)signal(SIGPIPE, SIG_IGN);
|
|
|
|
(void)Pclose(obuf);
|
|
|
|
(void)signal(SIGPIPE, SIG_DFL);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
2001-05-27 20:26:22 +00:00
|
|
|
return (0);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Respond to a broken pipe signal --
|
|
|
|
* probably caused by quitting more.
|
|
|
|
*/
|
2001-05-27 20:26:22 +00:00
|
|
|
/*ARGSUSED*/
|
1994-05-27 12:33:43 +00:00
|
|
|
void
|
2010-12-19 14:18:07 +00:00
|
|
|
brokpipe(int signo __unused)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
|
|
|
longjmp(pipestop, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print the top so many lines of each desired message.
|
|
|
|
* The number of lines is taken from the variable "toplines"
|
|
|
|
* and defaults to 5.
|
|
|
|
*/
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
top(int *msgvec)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
2001-05-27 20:26:22 +00:00
|
|
|
int *ip;
|
|
|
|
struct message *mp;
|
1994-05-27 12:33:43 +00:00
|
|
|
int c, topl, lines, lineb;
|
|
|
|
char *valtop, linebuf[LINESIZE];
|
|
|
|
FILE *ibuf;
|
|
|
|
|
|
|
|
topl = 5;
|
|
|
|
valtop = value("toplines");
|
2001-05-27 20:26:22 +00:00
|
|
|
if (valtop != NULL) {
|
1994-05-27 12:33:43 +00:00
|
|
|
topl = atoi(valtop);
|
|
|
|
if (topl < 0 || topl > 10000)
|
|
|
|
topl = 5;
|
|
|
|
}
|
|
|
|
lineb = 1;
|
|
|
|
for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) {
|
|
|
|
mp = &message[*ip - 1];
|
|
|
|
touch(mp);
|
|
|
|
dot = mp;
|
2001-05-27 20:26:22 +00:00
|
|
|
if (value("quiet") == NULL)
|
1994-05-27 12:33:43 +00:00
|
|
|
printf("Message %d:\n", *ip);
|
|
|
|
ibuf = setinput(mp);
|
|
|
|
c = mp->m_lines;
|
|
|
|
if (!lineb)
|
|
|
|
printf("\n");
|
|
|
|
for (lines = 0; lines < c && lines <= topl; lines++) {
|
2001-03-25 04:57:05 +00:00
|
|
|
if (readline(ibuf, linebuf, sizeof(linebuf)) < 0)
|
1994-05-27 12:33:43 +00:00
|
|
|
break;
|
|
|
|
puts(linebuf);
|
2001-03-25 04:57:05 +00:00
|
|
|
lineb = strspn(linebuf, " \t") == strlen(linebuf);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
}
|
2001-05-27 20:26:22 +00:00
|
|
|
return (0);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Touch all the given messages so that they will
|
|
|
|
* get mboxed.
|
|
|
|
*/
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
stouch(int msgvec[])
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
2001-05-27 20:26:22 +00:00
|
|
|
int *ip;
|
1994-05-27 12:33:43 +00:00
|
|
|
|
|
|
|
for (ip = msgvec; *ip != 0; ip++) {
|
|
|
|
dot = &message[*ip-1];
|
|
|
|
dot->m_flag |= MTOUCH;
|
|
|
|
dot->m_flag &= ~MPRESERVE;
|
|
|
|
}
|
2001-05-27 20:26:22 +00:00
|
|
|
return (0);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure all passed messages get mboxed.
|
|
|
|
*/
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
mboxit(int msgvec[])
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
2001-05-27 20:26:22 +00:00
|
|
|
int *ip;
|
1994-05-27 12:33:43 +00:00
|
|
|
|
|
|
|
for (ip = msgvec; *ip != 0; ip++) {
|
|
|
|
dot = &message[*ip-1];
|
|
|
|
dot->m_flag |= MTOUCH|MBOX;
|
|
|
|
dot->m_flag &= ~MPRESERVE;
|
|
|
|
}
|
2001-05-27 20:26:22 +00:00
|
|
|
return (0);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* List the folders the user currently has.
|
|
|
|
*/
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
folders(void)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
2001-03-25 04:57:05 +00:00
|
|
|
char dirname[PATHSIZE];
|
1994-05-27 12:33:43 +00:00
|
|
|
char *cmd;
|
|
|
|
|
2001-03-25 04:57:05 +00:00
|
|
|
if (getfold(dirname, sizeof(dirname)) < 0) {
|
1994-05-27 12:33:43 +00:00
|
|
|
printf("No value set for \"folder\"\n");
|
2001-05-27 20:26:22 +00:00
|
|
|
return (1);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
2001-05-27 20:26:22 +00:00
|
|
|
if ((cmd = value("LISTER")) == NULL)
|
1994-05-27 12:33:43 +00:00
|
|
|
cmd = "ls";
|
2001-05-27 20:26:22 +00:00
|
|
|
(void)run_command(cmd, 0, -1, -1, dirname, NULL, NULL);
|
|
|
|
return (0);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
2001-12-18 20:52:09 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Update the mail file with any new messages that have
|
|
|
|
* come in since we started reading mail.
|
|
|
|
*/
|
|
|
|
int
|
2010-12-19 14:18:07 +00:00
|
|
|
inc(void *v __unused)
|
2001-12-18 20:52:09 +00:00
|
|
|
{
|
|
|
|
int nmsg, mdot;
|
|
|
|
|
|
|
|
nmsg = incfile();
|
|
|
|
|
|
|
|
if (nmsg == 0)
|
|
|
|
printf("No new mail.\n");
|
|
|
|
else if (nmsg > 0) {
|
|
|
|
mdot = newfileinfo(msgCount - nmsg);
|
|
|
|
dot = &message[mdot - 1];
|
|
|
|
} else
|
|
|
|
printf("\"inc\" command failed...\n");
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|