/***********************************************************************
* *
* 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
*
* File I/O.
*/
#include "mailx.h"
#include <fts.h>
/*
* Return next msg struct for current folder.
*/
struct msg*
{
unsigned long dot;
}
return mp;
}
/*
* Set up the input pointers while copying the mail file into /tmp.
*/
void
{
register int c;
register int count;
register int prevcount;
register char* cp;
register char* cp2;
int maybe;
int inhead;
/* Seek into the file to get to the new messages */
/*
* We need to make "offset" a pointer to the end of
* the temp file that has the copy of the mail file.
* If any messages have been edited, this will be
* different from the offset into the mail file.
*/
}
else
maybe = 1;
inhead = 0;
mp = 0;
count = 0;
for (;;) {
}
break;
}
count--;
}
if (state.bodymatch && !inhead && mp && !(mp->m_flag & MSCAN) && count >= state.bodymatch->minline && state.bodymatch->beg[cp[0]] && state.bodymatch->mid[cp[state.bodymatch->minline/2]] && state.bodymatch->end[cp[state.bodymatch->minline-1]])
if (count >= xp->length && cp[0] == xp->beg && cp[xp->length/2] == xp->mid && cp[xp->length-1] == xp->end && !memcmp(cp, xp->string, xp->length))
{
if (TRACING('x'))
break;
}
inhead = 1;
}
inhead = 0;
else if (inhead) {
if ((c = *cp2++) == 0) {
;
break;
for (;;) {
switch (*cp++) {
case 0:
break;
case 'O':
goto scanned;
case 'R':
goto scanned;
case 'X':
goto scanned;
default:
continue;
continue;
}
break;
}
inhead = 0;
break;
}
break;
}
}
if (mp) {
}
}
}
/*
* fts sort order to find max entry
*/
static int
{
}
/*
* mh context file names
*/
static const char* mh_context[] = {
".current",
".mh_sequences",
".exmhcontext",
"../.exmhcontext",
"../../.exmhcontext",
};
/*
* Return the mh message context for folder name.
*/
void
{
register char* s;
register int n;
register int i;
char* e;
for (n = 0; n < elementsof(mh_context); n++) {
for (s = e; isspace(*s); s++);
next = 0;
break;
}
break;
}
break;
}
}
}
}
if (!*e)
break;
}
}
}
/*
* Update the mh message context for folder name.
*/
void
{
}
}
}
}
}
}
/*
* fts sort order
*/
static int
{
}
/*
* Set up pointers to folder directory.
*/
int
{
register char* s;
register int n;
unsigned long index;
unsigned long next;
int status;
char* e;
return -1;
}
holdsigs();
next = 0;
mp = 0;
if (!*e) {
for (;;) {
break;
}
status = 0;
if (!status) {
n = strlen(s);
if (n <= 1)
status = 1;
status = 1;
for (s += 7;;) {
switch (*s++) {
case 0:
break;
case 'O':
continue;
case 'R':
continue;
case 'X':
continue;
default:
continue;
}
break;
}
}
}
}
}
else
}
}
while (state.msg.mh.dot < state.msg.count && ((state.msg.list + state.msg.mh.dot - 1)->m_flag & MNONE))
newmsg(0);
}
relsesigs();
return 0;
}
/*
* Drop the passed line onto the passed output buffer.
* If a write error occurs, return -1, else the count of
* characters written, including the newline.
*/
int
{
register int c;
register int x;
x = 1;
return -1;
x++;
}
return -1;
return c + x;
}
/*
* Read up a line from the specified input into the line
* buffer. Return the number of characters read. Do not
* include the newline at the end.
*/
int
{
register int n;
return -1;
buf[--n] = 0;
buf[--n] = 0;
}
return n;
}
/*
* Return a file buffer all ready to read up the
* passed message pointer.
*/
FILE*
{
offset = 0;
}
}
else {
if (!(state.msg.ap = fileopen(struse(state.path.temp), "EIr")) && !(state.msg.ap = fileopen("/dev/null", "EIr")))
}
offset = 0;
}
}
}
return fp;
}
/*
* Delete a file, but only if the file is a plain file.
*/
int
{
return -1;
}
}
/*
* Determine the size of the file possessed by
* the passed buffer.
*/
{
return 0;
}
#if !_lib_ftruncate
int
{
return 0;
}
#endif
/*
* Truncate a file to the last character written. This is
* useful just before closing an old file that was opened
*/
int
{
}
/*
* Evaluate the string given as a new mailbox name.
* Supported meta characters:
* % for my system mail box
* %user for user's system mail box
* # for previous file
* & invoker's mbox file
* +file file in folder directory
* @name IMAP folder
* any shell meta character
* Return the file name as a dynamic string.
*/
char*
{
register int n;
/*
* The order of evaluation is "%" and "#" expand into constants.
* "&" can expand into "+". "+" can expand into shell meta characters.
* Shell meta characters expand into constants.
* This way, we make no recursive expansion.
*/
switch (name[0]) {
case '%':
if (!*++name)
goto again;
case '#':
if (name[1])
break;
note(0, "No previous file");
return 0;
}
case '&':
if (!name[1])
break;
}
}
}
}
return 0;
return 0;
}
if (n < 0) {
return 0;
}
if (n >= sizeof(buf)) {
n = sizeof(buf) - 1;
}
n--;
buf[n] = 0;
if (verify) {
if (!n) {
return 0;
}
return 0;
}
}
}
/*
* Determine the current folder directory name.
*/
int
{
char* folder;
return -1;
if (*folder == '/')
else
return 0;
}
#if MORE_DISCIPLINE
/*
* For mail purposes it's safe to assume line-at-a-time input.
*/
static ssize_t
{
}
/*
* Simple (but fast) more style pager.
*/
static ssize_t
{
register char* b;
register char* s;
register char* e;
register ssize_t w;
register size_t m;
register int r;
return n;
w = 0;
b = (char*)buf;
s = b;
e = s + n;
if (s >= e)
return n;
if (*s == '\n')
b = s + 1;
else if (*s == r && (e - s) >= state.more.match && !strncmp(s, state.more.pattern, state.more.match))
break;
}
s = b;
w += b - (char*)buf;
}
while (s < e) {
switch (*s++) {
case '\t':
/*FALLTHROUGH*/
default:
continue;
/*FALLTHROUGH*/
case '\n':
continue;
break;
case '\b':
continue;
case '\r':
continue;
}
b = s;
if (r == '/' || r == 'n') {
if (r == '/') {
}
}
goto match;
}
}
switch (r) {
case '\n':
case '\r':
break;
case ' ':
break;
default:
return n;
}
}
if (s > b)
return w;
}
#endif
/*
* Trap more variable assignment.
*/
void
{
#if MORE_DISCIPLINE
if (value) {
}
}
}
}
moretop();
}
#else
}
#endif
}
/*
* clear signal and io state before resuming from interrupt
*/
void
{
#if MORE_DISCIPLINE
#endif
}