#ifndef MPLIB1_MATCHTOK #define MPLIB1_MATCHTOK /* ******************************************************************************* * Copyright (c) 1996 Martin Poole * ******************************************************************************* ** ** WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! ** ** Any changes to be made to this file should first be checked with ** mplib1 source control for library integrity. ** ** mplib1 source control can be reached at mplib1@quatermass.co.uk ** * * $Source$ * $Author$ * $Date$ * $Revision$ * ******************************************************************************* * * Change History * * $Log$ * ******************************************************************************* */ #ident "$Header$" /* ------------------------------------------------------------------ Code starts here ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ defines ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ Structure definitions ------------------------------------------------------------------ */ struct match_token { int m_val; const char *m_ptr; }; /* ------------------------------------------------------------------ Function prototypes ------------------------------------------------------------------ */ /* --------------------------------------------------------------------------- Function : match_string Summary : This function return whether the line parameter : contains the string in the match parameter : It will allow the match string to be bound to : the start of the line (ala grep) : It will also return a pointer to the first : non-blank token after the match (or the start : of the string Input Parameters : pointer line buffer : pointer to matching string Output Parameters : pointer to a character pointer for next token : return value Global Variables : None Return Value : 1 == found 0 == not found --------------------------------------------------------------------------*/ extern int match_string ( const char *line_ptr, const char *match_ptr, char ** next_tok ); /* --------------------------------------------------------------------------- Function : match_a_string Summary : This function return whether the line parameter : matches one of the parameters in the match_token : list : It will allow the match string to be bound to : the start of the line (ala grep) : It will also return a pointer to the first : non-blank token after the match (or the start : of the string Input Parameters : pointer line buffer : pointer to match token list : this is a pointer to an array of type match_token : the array is terminated by a entry with a NULL : m_ptr Output Parameters : pointer to a character pointer for next token : return value Global Variables : None Return Value : value specified in matched token or : value on the terminating token --------------------------------------------------------------------------*/ extern int match_a_string ( const char *line_ptr, struct match_token *match_ptr, char ** next_tok ); #endif /* -- End of File -- */