Print this page
8485 Remove set but unused variables in usr/src/cmd


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*

  23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  28 /*        All Rights Reserved   */
  29 
  30 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 
  32 #include "mail.h"
  33 
  34 /*
  35     NAME
  36         copylet - copy a given letter to a file pointer
  37 
  38     SYNOPSIS
  39         int copylet(int letnum, FILE *f, int type)
  40 
  41     DESCRIPTION
  42         Copylet() will copy the letter "letnum" to the
  43         given file pointer.
  44 
  45                 letnum  -> index into: letter table
  46                 f       -> file pointer to copy file to
  47                 type    -> copy type
  48 
  49         Returns TRUE on a completely successful copy.
  50 */
  51 


  73 {
  74         static char     pn[] = "copylet";
  75         char    buf[LSIZE], lastc;
  76         char    wbuf[LSIZE];
  77         int     n;
  78         long    i, k;
  79         int     num;
  80         int     rtrncont = 1;   /* True: nondelivery&content included, or regular mail */
  81         int     suppress = FALSE;
  82         int     sav_suppress = FALSE; /* Did we suppress previous hdr line? */
  83         int     print_from_struct = FALSE; /* print from hdrlines struct */
  84                                            /* rather than fgets() buffer */
  85         int     pushrest = FALSE;
  86         int     ctf = FALSE;
  87         int     didafflines = FALSE;    /* Did we already put out any */
  88                                         /* H_AFWDFROM lines? */
  89         int     didrcvlines = FALSE;    /* Did we already put out any */
  90                                         /* H_RECEIVED lines? */
  91         long    clen = -1L;
  92         int     htype;                  /* header type */
  93         int     sav_htype;      /* Header type of last non-H_CONT header line */
  94         struct hdrs *hptr;
  95 
  96         if (!sending) {
  97                 /* Clear out any saved header info from previous message */
  98                 clr_hinfo();
  99         }
 100 
 101         fseek(tmpf, let[letnum].adr, 0);
 102         /* Get size of message as stored into tempfile by copymt() */
 103         k = let[letnum+1].adr - let[letnum].adr;
 104         Dout(pn, 1, "(letnum = %d, type = %d), k = %ld\n", letnum, type, k);
 105         while (k>0) {        /* process header */
 106                 num = ((k < sizeof(buf)) ? k+1 : sizeof(buf));
 107                 if (fgets (buf, num, tmpf) == NULL) {
 108                         return (FALSE);
 109                 }
 110                 if ((n = strlen (buf)) == 0) {
 111                         k = 0;
 112                         break;
 113                 }


 279                                 /* H_AFWDFROM or H_RECEIVED lines */
 280                                 dumprcv(type, -1,&didrcvlines,&suppress,f);
 281                                 dumpaff(type, -1,&didafflines,&suppress,f);
 282                                 break;
 283                         }
 284                         num = ((k < sizeof(buf)) ? k+1 : sizeof(buf));
 285                         if (fgets (buf, num, tmpf) == NULL) {
 286                                 return (FALSE);
 287                         }
 288                         n = strlen (buf);
 289                         k -= n;
 290                         lastc = buf[n-1];
 291 
 292                         if (pushrest) {
 293                                 pushrest = (lastc != '\n');
 294                                 continue;
 295                         }
 296                         sav_suppress = suppress;
 297                         suppress = FALSE;
 298                         print_from_struct = FALSE;
 299                         sav_htype = htype;
 300                         htype = isheader (buf, &ctf);
 301                         Dout(pn, 5, "loop 2: buf = %s, htype= %d/%s\n", buf, htype, header[htype].tag);
 302                         /* The following order is defined in the MTA documents. */
 303                         switch (htype) {
 304                         case H_CONT:
 305                             if (sending) {
 306                                 suppress = sav_suppress;
 307                             }
 308                             continue;
 309                         case H_TCOPY:
 310                         case H_MIMEVERS:
 311                         case H_CTYPE:
 312                         case H_CLEN:
 313                                 if (!sending) {
 314                                         savehdrs(buf,htype);
 315                                 }
 316                                 hptr = hdrlines[htype].head;
 317                                 if (htype == H_CLEN) {
 318                                         clen = atol (hptr->value);
 319                                 }




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2017 Gary Mills
  24  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  25  * Use is subject to license terms.
  26  */
  27 
  28 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  29 /*        All Rights Reserved   */
  30 


  31 #include "mail.h"
  32 
  33 /*
  34     NAME
  35         copylet - copy a given letter to a file pointer
  36 
  37     SYNOPSIS
  38         int copylet(int letnum, FILE *f, int type)
  39 
  40     DESCRIPTION
  41         Copylet() will copy the letter "letnum" to the
  42         given file pointer.
  43 
  44                 letnum  -> index into: letter table
  45                 f       -> file pointer to copy file to
  46                 type    -> copy type
  47 
  48         Returns TRUE on a completely successful copy.
  49 */
  50 


  72 {
  73         static char     pn[] = "copylet";
  74         char    buf[LSIZE], lastc;
  75         char    wbuf[LSIZE];
  76         int     n;
  77         long    i, k;
  78         int     num;
  79         int     rtrncont = 1;   /* True: nondelivery&content included, or regular mail */
  80         int     suppress = FALSE;
  81         int     sav_suppress = FALSE; /* Did we suppress previous hdr line? */
  82         int     print_from_struct = FALSE; /* print from hdrlines struct */
  83                                            /* rather than fgets() buffer */
  84         int     pushrest = FALSE;
  85         int     ctf = FALSE;
  86         int     didafflines = FALSE;    /* Did we already put out any */
  87                                         /* H_AFWDFROM lines? */
  88         int     didrcvlines = FALSE;    /* Did we already put out any */
  89                                         /* H_RECEIVED lines? */
  90         long    clen = -1L;
  91         int     htype;                  /* header type */

  92         struct hdrs *hptr;
  93 
  94         if (!sending) {
  95                 /* Clear out any saved header info from previous message */
  96                 clr_hinfo();
  97         }
  98 
  99         fseek(tmpf, let[letnum].adr, 0);
 100         /* Get size of message as stored into tempfile by copymt() */
 101         k = let[letnum+1].adr - let[letnum].adr;
 102         Dout(pn, 1, "(letnum = %d, type = %d), k = %ld\n", letnum, type, k);
 103         while (k>0) {        /* process header */
 104                 num = ((k < sizeof(buf)) ? k+1 : sizeof(buf));
 105                 if (fgets (buf, num, tmpf) == NULL) {
 106                         return (FALSE);
 107                 }
 108                 if ((n = strlen (buf)) == 0) {
 109                         k = 0;
 110                         break;
 111                 }


 277                                 /* H_AFWDFROM or H_RECEIVED lines */
 278                                 dumprcv(type, -1,&didrcvlines,&suppress,f);
 279                                 dumpaff(type, -1,&didafflines,&suppress,f);
 280                                 break;
 281                         }
 282                         num = ((k < sizeof(buf)) ? k+1 : sizeof(buf));
 283                         if (fgets (buf, num, tmpf) == NULL) {
 284                                 return (FALSE);
 285                         }
 286                         n = strlen (buf);
 287                         k -= n;
 288                         lastc = buf[n-1];
 289 
 290                         if (pushrest) {
 291                                 pushrest = (lastc != '\n');
 292                                 continue;
 293                         }
 294                         sav_suppress = suppress;
 295                         suppress = FALSE;
 296                         print_from_struct = FALSE;

 297                         htype = isheader (buf, &ctf);
 298                         Dout(pn, 5, "loop 2: buf = %s, htype= %d/%s\n", buf, htype, header[htype].tag);
 299                         /* The following order is defined in the MTA documents. */
 300                         switch (htype) {
 301                         case H_CONT:
 302                             if (sending) {
 303                                 suppress = sav_suppress;
 304                             }
 305                             continue;
 306                         case H_TCOPY:
 307                         case H_MIMEVERS:
 308                         case H_CTYPE:
 309                         case H_CLEN:
 310                                 if (!sending) {
 311                                         savehdrs(buf,htype);
 312                                 }
 313                                 hptr = hdrlines[htype].head;
 314                                 if (htype == H_CLEN) {
 315                                         clen = atol (hptr->value);
 316                                 }