# 2.11BSD#431 - /usr/src/libexec/popper/pop_parse.c

##### Functions

    pop_parse         X

       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_parse.c	2.1  2.1 3/18/91";
      10: #endif not lint
      11:
      12: #include <stdio.h>
      13: #include <sys/types.h>
      14: #include <ctype.h>
      15: #include "popper.h"
      16:
      17: /*
      18:  *  parse:  Parse a raw input line from a POP client
      19:  *  into null-delimited tokens
      20:  */
      21:
      22: pop_parse(p,buf)
      23: POP         *   p;
      24: char        *   buf;        /*  Pointer to a message containing
      25:                                 the line from the client */
      26: {
      27:     char            *   mp;
      28:     register int        i;
      29:
      30:     /*  Loop through the POP command array */
      31:     for (mp = buf, i = 0; ; i++) {
      32:
      33:         /*  Skip leading spaces and tabs in the message */
      34:         while (isspace(*mp))mp++;
      35:
      36:         /*  Are we at the end of the message? */
      37:         if (*mp == 0) break;
      38:
      39:         /*  Have we already obtained the maximum allowable parameters? */
      40:         if (i >= MAXPARMCOUNT) {
      41:             pop_msg(p,POP_FAILURE,"Too many arguments supplied.");
      42:             return(-1);
      43:         }
      44:
      45:         /*  Point to the start of the token */
      46:         p->pop_parm[i] = mp;
      47:
      48:         /*  Search for the first space character (end of the token) */
      49:         while (!isspace(*mp) && *mp) mp++;
      50:
      51:         /*  Delimit the token with a null */
      52:         if (*mp) *mp++ = 0;
      53:     }
      54:
      55:     /*  Were any parameters passed at all? */
      56:     if (i == 0) return (-1);
      57:
      58:     /*  Convert the first token (POP command) to lower case */
      59:     pop_lower(p->pop_command);
      60:
      61:     /*  Return the number of tokens extracted minus the command itself */
      62:     return (i-1);
      63:
      64: }

#### Defined functions

pop_parse defined in line 22; used 1 times

- in /usr/src/libexec/popper/pop_get_command.c line 56

#### 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: 980 |