isc-parse.c 631 Bytes
Newer Older
Per Cederqvist's avatar
Per Cederqvist committed
1 2 3 4
/*
 * Generic parse routines.
 */

Per Cederqvist's avatar
Per Cederqvist committed
5 6 7
static char *rcsid = "$Id: isc-parse.c,v 0.2 1991/08/28 02:21:34 ceder Exp $";


Per Cederqvist's avatar
Per Cederqvist committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#include <setjmp.h>
#include <string.h>
#include <stdio.h>
#include "lyskomd.h"
#include <kom-types.h>
#include "com.h"
#include "connections.h"
#include "isc-parse.h"

int
parse_char(Connection *client)
{
    if ( client->unparsed.len <= client->first_to_parse )
	longjmp(parse_env, ISC_MSG_INCOMPLETE);

    return client->unparsed.string[ client->first_to_parse++ ];
}
	

int
parse_nonwhite_char(Connection *client)
{
    int c;

    while ( strchr(" \t\n\r", c=parse_char(client) ) != NULL )
	;
    return c;
}