static char *SccsId
= "@(#)cmd1.c 2.6 %G%";
* Print the current active headings.
* Don't change dot if invoker didn't give an argument.
register int n
, mesg
, flag
;
register struct message
*mp
;
mp
= &message
[screen
* size
];
if (mp
>= &message
[msgCount
])
mp
= &message
[msgCount
- size
];
if (dot
!= &message
[n
-1])
for (; mp
< &message
[msgCount
]; mp
++) {
if (mp
->m_flag
& MDELETED
)
printf("No more mail.\n");
* Scroll to the next/previous screen
if (s
* size
> msgCount
) {
printf("On last screenful of messages\n");
printf("On first screenful of messages\n");
printf("Unrecognized scrolling command \"%s\"\n", arg
);
* Compute what the screen size should be.
* We use the following algorithm:
* If user specifies with screen option, use that.
* If baud rate < 1200, use 5
* If baud rate = 1200, use 10
* If baud rate > 1200, use 20
if ((cp
= value("screen")) != NOSTR
) {
* Print out the headlines for each message
* in the passed message list.
for (ip
= msgvec
; *ip
!= NULL
; ip
++) {
* Print out the header of a specific message.
* This is a slight improvement to the standard one.
char headline
[LINESIZE
], wcount
[10], *subjline
, dispc
, curind
;
readline(ibuf
, headline
);
subjline
= hfield("subject", mp
);
subjline
= hfield("subj", mp
);
if (subjline
!= NOSTR
&& strlen(subjline
) > 28)
curind
= dot
== mp
? '>' : ' ';
if (mp
->m_flag
& MPRESERVE
)
if ((mp
->m_flag
& (MREAD
|MNEW
)) == MNEW
)
if ((mp
->m_flag
& (MREAD
|MNEW
)) == 0)
parse(headline
, &hl
, pbuf
);
sprintf(wcount
, " %d/%d", mp
->m_lines
, mp
->m_size
);
printf("%c%c%3d %-8s %16.16s %s \"%s\"\n", curind
, dispc
, mesg
,
nameof(mp
, 0), hl
.l_date
, wcount
, subjline
);
printf("%c%c%3d %-8s %16.16s %s\n", curind
, dispc
, mesg
,
nameof(mp
, 0), hl
.l_date
, wcount
);
* Print out the value of dot.
printf("%d\n", dot
- &message
[0] + 1);
* Print out all the possible commands.
extern struct cmd cmdtab
[];
printf("Commands are:\n");
for (cc
= 0, cp
= cmdtab
; cp
->c_name
!= NULL
; cp
++) {
cc
+= strlen(cp
->c_name
) + 2;
cc
= strlen(cp
->c_name
) + 2;
if ((cp
+1)->c_name
!= NOSTR
)
printf("%s, ", cp
->c_name
);
printf("%s\n", cp
->c_name
);
* Type out the messages requested.
register struct message
*mp
;
sigset(SIGPIPE
, SIG_DFL
);
if (intty
&& outtty
&& (cp
= value("crt")) != NOSTR
) {
for (ip
= msgvec
, nlines
= 0; *ip
&& ip
-msgvec
< msgCount
; ip
++)
nlines
+= message
[*ip
- 1].m_lines
;
sigset(SIGPIPE
, brokpipe
);
for (ip
= msgvec
; *ip
&& ip
-msgvec
< msgCount
; ip
++) {
sigset(SIGPIPE
, SIG_DFL
);
* Respond to a broken pipe signal --
* probably caused by using quitting more.
signal(SIGPIPE
, brokpipe
);
* Print the indicated message on standard output.
register struct message
*mp
;
if (value("quiet") == NOSTR
)
fprintf(obuf
, "Message %2d:\n", mp
- &message
[0] + 1);
touch(mp
- &message
[0] + 1);
* Print the top so many lines of each desired message.
* The number of lines is taken from the variable "toplines"
register struct message
*mp
;
int c
, topl
, lines
, lineb
;
char *valtop
, linebuf
[LINESIZE
];
valtop
= value("toplines");
if (topl
< 0 || topl
> 10000)
for (ip
= msgvec
; *ip
&& ip
-msgvec
< msgCount
; ip
++) {
if (value("quiet") == NOSTR
)
printf("Message %2d:\n", mesg
);
for (lines
= 0; lines
< c
&& lines
<= topl
; lines
++) {
if (readline(ibuf
, linebuf
) <= 0)
lineb
= blankline(linebuf
);
* Touch all the given messages so that they will
for (ip
= msgvec
; *ip
!= 0; ip
++) {
dot
->m_flag
&= ~MPRESERVE
;
* Make sure all passed messages get mboxed.
for (ip
= msgvec
; *ip
!= 0; ip
++) {
dot
->m_flag
|= MTOUCH
|MBOX
;
dot
->m_flag
&= ~MPRESERVE
;
* List the folders the user currently has.
char dirname
[BUFSIZ
], cmd
[BUFSIZ
];
if (getfold(dirname
) < 0) {
printf("No value set for \"folder\"\n");
switch ((pid
= fork())) {
execlp("ls", "ls", dirname
, 0);
while ((e
= wait(&s
)) != -1 && e
!= pid
)