/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "mail.h"
/*
NAME
copylet - copy a given letter to a file pointer
SYNOPSIS
int copylet(int letnum, FILE *f, int type)
DESCRIPTION
Copylet() will copy the letter "letnum" to the
given file pointer.
letnum -> index into: letter table
f -> file pointer to copy file to
type -> copy type
Returns TRUE on a completely successful copy.
*/
int
{
if (fflush(f) != 0)
/*
* On error, truncate the file to its original position so that a
* partial message is not left in the mailbox.
*/
return(rc);
}
int
{
int n;
long i, k;
int num;
/* rather than fgets() buffer */
/* H_AFWDFROM lines? */
/* H_RECEIVED lines? */
if (!sending) {
/* Clear out any saved header info from previous message */
clr_hinfo();
}
/* Get size of message as stored into tempfile by copymt() */
while (k>0) { /* process header */
return (FALSE);
}
k = 0;
break;
}
k -= n;
if (pushrest) {
continue;
}
if (!sending) {
}
}
}
continue;
}
/* end of header. Print non-blank line and bail. */
if (buf[0] != '\n') {
return(FALSE);
}
} else {
n = 0;
}
break;
}
/* Copy From line appropriately */
return(FALSE);
}
if (lastc != '\n') {
return(FALSE);
}
continue;
}
switch(type) {
case REMOTE:
{
return(FALSE);
}
break;
case TTY:
case ORDINARY:
default:
if (fprintf(f, "\n") < 0)
{
return(FALSE);
}
break;
}
rtrncont = 0;
} else {
/* Account for content-type info */
/* of returned msg */
{
return(FALSE);
}
/* Compute Content-Length of what's being */
/* returned... */
i = k;
/* Account for H_AFWDFROM, H_AFWDCNT, */
/* H_TCOPY, or H_RECEIVED lines which may */
/* be added later */
if (affcnt > 0) {
i += (affbytecnt
}
if (orig_tcopy) {
i +=
}
}
i += rcvbytecnt;
}
/* Add in strlen of MIME-Version:, */
/* Content-Length: and Content-Type: */
/* values for msg being returned... */
}
}
}
{
return(FALSE);
}
}
if (fprintf(f, "\n") < 0)
{
return(FALSE);
}
}
if (fflush(f))
{
return(FALSE);
}
break;
}
/* if not ZAP, copy balance of header */
n = 0;
while (k>0 || n>0) {
if ((n > 0) && !suppress) {
if (print_from_struct == TRUE) {
return (FALSE);
}
} else {
return(FALSE);
}
}
}
}
}
if (k <= 0) {
/* Can only get here if k=0 && n>0, which occurs */
/* in a message with header lines but no content. */
/* If we haven't already done it, force out any */
/* H_AFWDFROM or H_RECEIVED lines */
break;
}
return (FALSE);
}
k -= n;
if (pushrest) {
continue;
}
/* The following order is defined in the MTA documents. */
switch (htype) {
case H_CONT:
if (sending) {
}
continue;
case H_TCOPY:
case H_MIMEVERS:
case H_CTYPE:
case H_CLEN:
if (!sending) {
}
}
/*
* Use values saved in hdrlines[] structure
* rather than what was read from tmp file.
*/
/* FALLTHROUGH */
case H_EOH:
case H_AFWDFROM:
case H_AFWDCNT:
case H_RECEIVED:
continue; /* next header line */
default:
continue; /* next header line */
case FALSE: /* end of header */
break;
}
/* Found the blank line after the headers. */
if (n > 0) {
return(FALSE);
}
}
{
return(FALSE);
}
return (TRUE);
}
n = 0;
}
break;
}
if (clen >= 0) {
k = clen - n;
} else {
/* probable content-length mismatch. show it ALL! */
}
}
/* copy balance of message */
if (rtrncont)
while (k > 0) {
return(FALSE);
}
k -= n;
return(FALSE);
}
}
return(FALSE);
}
}
return(TRUE);
}