1: /*
   2:  * Copyright (c) 1989 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #ifndef lint
   8: static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n";
   9: static char SccsId[] = "@(#)@(#)pop_list.c	2.1  2.1 3/18/91";
  10: #endif not lint
  11: 
  12: #include <stdio.h>
  13: #include <sys/types.h>
  14: #include "popper.h"
  15: 
  16: /*
  17:  *  list:   List the contents of a POP maildrop
  18:  */
  19: 
  20: int pop_list (p)
  21: POP     *   p;
  22: {
  23:     MsgInfoList         *   mp;         /*  Pointer to message info list */
  24:     register int            i;
  25:     register int            msg_num;
  26: 
  27:     /*  Was a message number provided? */
  28:     if (p->parm_count > 0) {
  29:         msg_num = atoi(p->pop_parm[1]);
  30: 
  31:         /*  Is requested message out of range? */
  32:         if ((msg_num < 1) || (msg_num > p->msg_count))
  33:             return (pop_msg (p,POP_FAILURE,
  34:                 "Message %u does not exist.",msg_num));
  35: 
  36:         /*  Get a pointer to the message in the message list */
  37:         mp = &p->mlp[msg_num-1];
  38: 
  39:         /*  Is the message already flagged for deletion? */
  40:         if (mp->del_flag)
  41:             return (pop_msg (p,POP_FAILURE,
  42:                 "Message %u has been deleted.",msg_num));
  43: 
  44:         /*  Display message information */
  45:         return (pop_msg(p,POP_SUCCESS,"%u %ld",msg_num,mp->length));
  46:     }
  47: 
  48:     /*  Display the entire list of messages */
  49:     pop_msg(p,POP_SUCCESS,
  50:         "%u messages (%ld octets)",
  51:             p->msg_count-p->msgs_deleted,p->drop_size-p->bytes_deleted);
  52: 
  53:     /*  Loop through the message information list.  Skip deleted messages */
  54:     for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) {
  55:         if (!mp->del_flag)
  56:             (void)fprintf(p->output,"%u %ld\r\n",mp->number,mp->length);
  57:     }
  58: 
  59:     /*  "." signals the end of a multi-line transmission */
  60:     (void)fprintf(p->output,".\r\n");
  61:     (void)fflush(p->output);
  62: 
  63:     return(POP_SUCCESS);
  64: }

Defined functions

pop_list defined in line 20; used 1 times

Defined variables

SccsId defined in line 9; never used
copyright defined in line 8; never used
Last modified: 1992-06-25
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2561
Valid CSS Valid XHTML 1.0 Strict