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_get_subcommand.c	2.1  2.1 3/18/91";
  10: #endif not lint
  11: 
  12: #include <stdio.h>
  13: #include <sys/types.h>
  14: #include <strings.h>
  15: #include "popper.h"
  16: 
  17: /*
  18:  *  get_subcommand: Extract a POP XTND subcommand from a client input line
  19:  */
  20: 
  21: static xtnd_table subcommands[] = {
  22:         "xmit",     0,  0,  pop_xmit,
  23:         NULL
  24: };
  25: 
  26: xtnd_table *pop_get_subcommand(p)
  27: POP     *   p;
  28: {
  29:     xtnd_table      *   s;
  30: 
  31:     /*  Search for the POP command in the command/state table */
  32:     for (s = subcommands; s->subcommand; s++) {
  33: 
  34:         if (strcmp(s->subcommand,p->pop_subcommand) == 0) {
  35: 
  36:             /*  Were too few parameters passed to the subcommand? */
  37:             if ((p->parm_count-1) < s->min_parms)
  38:                 return((xtnd_table *)pop_msg(p,POP_FAILURE,
  39:                     "Too few arguments for the %s %s command.",
  40:                         p->pop_command,p->pop_subcommand));
  41: 
  42:             /*  Were too many parameters passed to the subcommand? */
  43:             if ((p->parm_count-1) > s->max_parms)
  44:                 return((xtnd_table *)pop_msg(p,POP_FAILURE,
  45:                     "Too many arguments for the %s %s command.",
  46:                         p->pop_command,p->pop_subcommand));
  47: 
  48:             /*  Return a pointer to the entry for this subcommand
  49:                 in the XTND command table */
  50:             return (s);
  51:         }
  52:     }
  53:     /*  The client subcommand was not located in the XTND command table */
  54:     return((xtnd_table *)pop_msg(p,POP_FAILURE,
  55:         "Unknown command: \"%s %s\".",p->pop_command,p->pop_subcommand));
  56: }

Defined functions

pop_get_subcommand defined in line 26; used 2 times

Defined variables

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