/***********************************************************************
* *
* This software is part of the BSD package *
*Copyright (c) 1978-2012 The Regents of the University of California an*
* *
* 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 *
* materials provided with the distribution. *
* *
* 3. Neither the name of The Regents of the University of California*
* 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. *
* *
* 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 *
* distribution. *
* 3. 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. *
* *
* Kurt Shoens (UCB) *
* gsf *
* *
***********************************************************************/
#pragma prototyped
/*
* Mail -- a mail program
*
* User commands.
*/
#include "mailx.h"
/*
* Print out the header of a specific message.
* This is a slight improvement to the standard one.
*/
static void
{
char* name;
char* sizes;
char* subjline;
int curind;
int dispc;
int subjlen;
dispc = 'M';
dispc = 'P';
dispc = '*';
{
dispc = 'X';
{
register int c;
register char* s;
register char* t;
register char* u;
s = t = subjline;
while (c = *s++)
{
if (!isalnum(c) && c == *s)
{
while (*s == c)
s++;
for (u = s; *u && *u != c; u++);
if (*u == c && *(u + 1) == c)
{
for (s = u; *s == c; s++);
if (t == subjline)
while (isspace(*s))
s++;
continue;
}
}
*t++ = c;
}
*t = 0;
}
}
dispc = 'U';
dispc = 'N';
else
if (who)
{
else
}
else
{
name = grab(mp, (state.var.news ? GNEWS : state.var.showto && sender(state.var.user, mesg) ? GTO : GREPLY)|GDISPLAY, NiL);
printf("%c%c%3d %-20.20s %16.16s %s %.*s\n",
else
printf("%c%c%3d %-20.20s %16.16s %s\n",
}
}
/*
* Print the current active headings.
* Don't change dot if invoker didn't give an argument.
*/
int
{
register int n;
register int mesg;
register int flag;
int m;
flag = 1;
}
else {
flag = 0;
m = 1;
if (n != 0)
}
mesg++;
continue;
if (++flag >= m)
break;
}
if (!flag) {
note(0, "No more mail");
return 1;
}
return 0;
}
/*
*/
int
{
register int s;
switch (*arg) {
case 0:
case '+':
s++;
note(0, "On last screenful of messages");
return 0;
}
break;
case '-':
if (--s < 0) {
note(0, "On first screenful of messages");
return 0;
}
break;
default:
return 1;
}
}
/*
* from or From
*/
static int
{
return 0;
}
/*
* Print out the headlines for each message
* in the passed message list.
*/
int
{
}
/*
* Print out the status, message number, and sender
* in the passed message list.
*/
int
{
}
/*
* Print out the value of dot.
*/
int
dot(void)
{
return 0;
}
/*
* Print out all the possible commands.
*/
int
list(void)
{
register int i;
register int j;
register int cmds;
register int cols;
register int rows;
cols = 5;
for (i = 0; i < rows; i++) {
putchar('\n');
}
return 0;
}
/*
* Type out the messages requested.
*/
static int
{
int nlines;
int sig;
else {
nlines = 0;
if (!page) {
}
}
}
}
}
return 0;
}
/*
* Paginate messages, honor ignored fields.
*/
int
{
}
/*
* Paginate messages, even printing ignored fields.
*/
int
{
}
/*
* Type out messages, honor ignored fields.
*/
int
{
}
/*
* Type out messages, even printing ignored fields.
*/
int
{
}
/*
* 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
{
int c;
int lines;
int lineb;
lineb = 1;
if (!lineb)
printf("\n");
break;
}
}
return 0;
}
/*
* List the folders the user currently has.
*/
int
folders(void)
{
char* cmd;
return imap_folders();
return 1;
}
cmd = "ls";
return 0;
}
/*
* Pipe messages through command.
*/
int
{
int f;
char* cmd;
char* s;
char* mode;
fp = 0;
resume(f);
if (fp)
return 1;
}
if (f < 0)
return 1;
note(0, "\"cmd\" variable not set");
return 1;
}
}
if (!f) {
return 1;
}
}
else if (getmsglist(str, 0) < 0)
return 1;
*s = 0;
mode = "JNw";
}
else
mode = "Jw";
return 1;
return 1;
return 1;
}
}
if (fp)
return 0;
}
/*
* Single quote s to fp.
*/
static void
{
register int c;
for (;;) {
switch (c = *s++) {
case 0:
break;
case '\'':
continue;
default:
continue;
}
break;
}
}
/*
* Dump the blasted header fields.
*/
static int
{
printf("'\n");
return 0;
}
/*
* Low level for blast, Blast.
*/
static int
{
register int n;
int first;
char* next;
/*
* Collect the header names and sizes.
*/
/*
* Collect the header values.
*/
printf("from='");
printf("'\n");
note(0, "Too many headers");
goto skip;
}
}
}
}
/*
* Dump the header values.
*/
/*
* Dump the message text.
*/
first = 1;
printf("text='");
}
if (first)
first = 0;
else
putchar('\n');
}
printf("'\n");
skip: ;
}
return 0;
}
/*
* Blast message into name=value pairs.
*/
int
{
}
/*
* Blast message into name=value pairs, including ignored fields.
*/
int
{
}
/*
*/
int
{
register char* s;
register char* t;
if (!mime(1))
return 0;
if (!(s = *argv++))
else {
if ((t = s + strlen(s)) > s && *--t == ';')
*t = 0;
else
t = 0;
if (!*argv) {
if (t)
note(0, "\"%s\": unknown capability", s);
}
else if (streq(s, "<")) {
while (s = *argv++)
}
else {
while (s = *argv++)
}
}
return 0;
}
/*
* Mark names.
*/
struct mark {
const char* name;
int flag;
int set;
int clear;
};
};
/*
* Mark the indicated messages with the named mark or flags by default.
*/
static int
{
register char* mark;
register char* next;
int f;
int no;
do {
*next++ = 0;
no = 0;
case 'n':
no = 2;
break;
case 'u':
no = 2;
break;
}
if (!(kp = (struct mark*)strsearch(marks, elementsof(marks), sizeof(*marks), strcasecmp, mark, NiL))) {
return 1;
}
if (no) {
}
else {
}
}
else if (f < 0)
return 1;
else {
if (f)
else if (mark)
f = 1;
if (!clr) {
if (!set)
else
}
}
}
if (!f) {
return 1;
}
}
else if (getmsglist(str, 0) < 0)
return 1;
}
if (mp) {
}
}
return 0;
}
/*
* Mark all given messages to the given state.
*/
int
{
}
/*
* Touch all the given messages so that they will
* get mboxed.
*/
int
{
}
/*
* Make sure all passed messages get mboxed.
*/
int
{
}
/*
* Preserve the named messages, so that they will be sent
* back to the system mailbox.
*/
int
{
}
/*
* Mark all given messages as unread.
*/
int
{
}
/*
* For unimplemented commands.
*/
int
{
return 0;
}
/*
* Duplicate messages to address preserving the original senders.
*/
int
{
int f;
note(0, "Recipent address required");
return 1;
}
if (getmsglist(str, 0) < 0)
return 1;
return 0;
}
addr[1] = 0;
return 1;
}
return 0;
}