/***********************************************************************
* *
* This software is part of the BSD package *
*Copyright (c) 1978-2011 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
*
* More user commands.
*/
#include "mailx.h"
/*
* If any arguments were given, go to the next applicable argument
* following dot, otherwise, go to the next applicable message.
* If given as first command with no arguments, print first message.
*/
int
{
register int skip;
int mdot;
/*
* If some messages were supplied, find the
* first applicable one following dot using
* wrap around.
*/
/*
* Find the first message in the supplied
* message list which follows dot.
*/
break;
}
break;
do {
goto hitit;
}
ip2++;
note(0, "No messages applicable");
return 1;
}
/*
* If this is the first command, select message 1.
* Note that this must exist for us to get here at all.
*/
goto hitit;
/*
* Just find the next good message after dot, no
* wraparound.
*/
break;
note(0, "At EOF");
return 0;
}
/*
* Print dot.
*/
}
/*
* Snarf the file from the end of the command line and
* return a pointer to it. If there is no file attached,
* just return 0. Put a null in front of the file
* name so that the message list processing won't see it,
* If the file name is the only thing on the line return 0
* in the reference flag variable.
*/
char*
{
register char* s;
register int quote;
if (!*line) {
*flag = 0;
return 0;
}
/*
* Strip away trailing blanks.
*/
s--;
*++s = 0;
/*
* cmdpipe() allows quoted string as last arg.
*/
quote = *--s;
*s = 0;
do {
if (s <= line) {
*flag = -1;
return 0;
}
} while (*--s != quote);
*s++ = 0;
return s;
}
/*
* Now search for the beginning of the file name.
*/
s--;
if (!*s) {
*flag = 0;
return 0;
}
if (isspace(*s)) {
*s++ = 0;
*flag = 1;
}
else
*flag = 0;
return s;
}
/*
* If mark is true, mark the message "saved."
*/
static int
{
char* file;
char* disp;
char* temp;
int f;
int folder;
if (f < 0)
return 1;
}
file = 0;
}
if (!f) {
return 1;
}
}
else if (getmsglist(str, 0) < 0)
return 1;
file = record(file ? file : grab(state.msg.list + state.msg.list->m_index - 1, GREPLY, NiL), flags);
if (!file)
return 1;
return 0;
}
if (*file == '@') {
disp = "[Imap]";
}
else
disp = "[New file]";
}
disp = "[Added]";
}
else {
return 1;
}
switch (folder) {
case FFILE:
return 1;
return 1;
}
}
break;
case FIMAP:
return 1;
}
}
break;
case FMH:
}
}
break;
}
return 0;
}
/*
* Save a message in a file. Mark the message as saved
* so we can discard when the user quits.
*/
int
{
}
/*
* Save a message in a FOLLOWUP file. Mark the message as saved
* so we can discard when the user quits.
*/
int
{
}
/*
* Copy a message to a file without affected its saved-ness
*/
int
{
}
/*
* Copy a message to a FOLLOWUP file without affected its saved-ness
*/
int
{
}
/*
* Write the indicated messages at the end of the passed
* file name, minus header and trailing blank line.
*/
int
{
}
/*
* Delete the indicated messages.
* Set dot to some nice place afterwards.
* Internal interface.
*/
static int
{
int last;
last = 0;
}
if (last) {
if (last) {
return 0;
}
else {
return -1;
}
}
/*
* Following can't happen -- it keeps lint happy
*/
return -1;
}
/*
* Delete messages.
*/
int
{
return 0;
}
/*
* Delete messages, then type the new dot.
*/
int
{
int lastdot;
}
note(0, "At EOF");
}
else
note(0, "No more messages");
return 0;
}
/*
* Undelete the indicated messages.
*/
int
{
}
return 0;
}
/*
* Print out all currently retained fields.
*/
static int
{
}
return 0;
}
/*
* Low level for ignore and retain.
*/
static int
{
register char** ap;
if (*list) {
if (*ignore)
}
else {
}
return 0;
}
/*
* Add the given header fields to the retained list.
* If no arguments, print the current list of retained fields.
*/
int
{
}
int
{
}
/*
* Add the given header fields to the ignored list.
* If no arguments, print the current list of ignored fields.
*/
int
{
}
int
{
}
/*
* Send mail to a bunch of user names.
*/
int
{
return 0;
}
/*
* Low level for map().
*/
static int
{
return 0;
}
/*
* List mapped user names by expanding aliases.
*/
int
{
printf("\n");
return 0;
}
/*
* Get an attachment from ap in the current message.
*/
static int
getatt(register struct part* ap, register char* name, unsigned long flags, off_t* lines, off_t* chars)
{
register char* s;
register int n;
char* cmd;
cmd = 0;
}
else
}
return 1;
s++;
else
}
}
if (cmd)
}
else
{
}
n = 1;
}
else if (cmd) {
s = cmd;
n = -1;
}
n = 1;
}
else {
n = -1;
}
}
else {
s = name;
n = 0;
}
return 1;
if (!lines)
if (!chars)
return 0;
}
/*
*/
static int
{
register int i;
register char* s;
char* name;
char* a;
char* e;
int n;
int r;
note(0, "No current message");
return 1;
}
note(0, "No attachments in current message");
return 1;
}
if (!*argv) {
do {
printf("(attachment %2d %s %20s \"%s\")\n", ap->count, counts(1, ap->lines, ap->size), ap->type, ap->name);
return 0;
}
s = *argv++;
r = 0;
for (;;) {
while (isspace(*s))
s++;
if (!*s)
break;
else if (*s == ',') {
s++;
r = 0;
}
else if (*s == '*') {
if (!r)
r = 1;
a[i] = 1;
r = 0;
}
else if (*s == '-') {
s++;
r = 1;
}
else {
n = strtol(s, &e, 0);
if (r) {
for (i = r; i <= n; i++)
a[i] = 1;
r = 0;
}
else
a[n] = 1;
}
else
{
note(0, "%s: invalid attachment number", s);
while (*e && !isspace(*e))
e++;
}
s = e;
if (*s == '-') {
s++;
r = n;
}
}
}
r = 0;
if (a[i]) {
note(0, "%d: attachment number out of range", i);
r = 1;
goto done;
}
argv++;
else
r = 1;
}
done:
free(a);
return r;
}
/*
* Get an attachment from the current message.
* Execute content view command if found.
*/
int
{
}
/*
* Get an attachment from the current message.
* Don't execute content view command.
*/
int
{
}
/*
* Low level for split.
*/
static int
{
char* s;
char* file;
s = dir;
note(0, "\"%s\": directory argument expected", s);
return 1;
}
if (getmsglist(str, 0) < 0)
return 1;
else {
if (verbose)
do {
}
}
if (verbose)
note(0, "");
}
}
num++;
}
return 0;
}
/*
* Split messages into idividual files.
* low level for split and Split
*/
static int
{
long num;
int f;
char* file;
char* start;
char* e;
note(0, "file argument expected");
return 1;
}
note(0, "numeric argument expected");
return 1;
}
return 1;
}
}
/*
* Split messages into idividual files.
* Ignore all headers.
*/
int
{
}
/*
* Split messages into idividual files.
* Keep all headers.
*/
int
{
}
/*
* Update the mail file with any new messages that have
* come in since we started reading mail.
*/
int
incorporate(void)
{
int sawcom = 0;
long count;
long dot;
long next;
if (!setfolder("%")) {
if (!setfolder("#")) {
}
}
state.incorporating = 0;
}
else {
int eof;
int n;
if ((n = incfile()) < 0)
else if (!n)
note(0, "No new mail");
else {
if (eof)
}
}
return 0;
}