home *** CD-ROM | disk | FTP | other *** search
- #ifdef RCSID
- static char *RCSid =
- "$Header: iapxit.c,v 6.1 88/11/18 16:08:01 lchan Exp $ iapxit.c Copyr (c) 1986 Oracle";
- #endif /* RCSID */
-
- #include <stdio.h>
- #include "usrxit.h"
- #include <string.h>
-
- extf int CHKVAL();
-
- /* *************************************************************************
-
- CHKVAL is called with the following syntax for the parameter string p:
-
- CHKVAL fieldname value1 value2 ... valueN
-
- Currently, only upper case, string values are able to be processed.
- CHKVAL will return FAILURE if the field matches one of the values in the list,
- otherwise it will return SUCCESS.
-
- The User Exit Table, iapxtb[], is defined in iapxtb.c, which in turn is
- usually generated by pgm "genxtb". See the "Installation and User's Guide"
- for details.
-
- *************************************************************************** */
-
- #define MAXARGS 128
- #define ARBUFSIZ 512
-
- int CHKVAL(p, paramlen, erm, ermlen, query)
- register char *p; /* Parameter string */
- int *paramlen; /* Ptr to param string length */
- char *erm; /* Error message if doesnt match */
- int *ermlen; /* Ptr to error message length */
- int *query; /* Ptr to query status flag */
-
- {
- extf int iapprs(); /* IAP command parser */
- extf int countargs(); /* Puts "words" into an array */
- extf char *cpystr(); /* Copies one string to another */
- extf char *upper(); /* Makes a string uppercase */
- extf char *rblank(); /* Get rid of extra whitespace */
- extf int strcmp(); /* Compares two strings */
- extf int exiterr(); /* Display usrxit error */
- extd char *wordb[]; /* Holds the blank separated */
- register int listsiz; /* Number of values */
- register int i; /* Temp counter */
- char iapcmd[128]; /* To construct the GET command */
- char arbuf[ARBUFSIZ]; /* To hold string that is passed */
-
- rblank( p ); /* Remove leading, trailing, and
- and double spaces */
-
- strncpy(arbuf, p, ARBUFSIZ-1 );
- listsiz = countargs( arbuf ); /* get fieldname and value list
- in wordb[] */
-
- if ( listsiz < 3 ) /* Check for minimum # of args */
- {
- exiterr( "CHKVAL: Not enough arguments!" );
- return FATAL_ERR;
- }
-
- if ( listsiz >= MAXARGS ) /* Check for maximum # of args */
- {
- exiterr( "CHKVAL: Too many arguments!" );
- return FATAL_ERR;
- }
-
- /* NOTE: This method is unsupported. Use "EXEC IAF GET ..." within a Pro*C */
- /* module to obtain this functionality. */
-
- cpystr( iapcmd, "GET ", wordb[1], /* Make GET fieldname string */
- (char *) 0 ); /* Last parameter must be NULL */
-
- if ( iapprs( iapcmd ) ) /* Get field value into iaprval */
- return FATAL_ERR; /* Fieldname error */
-
- listsiz -= 2;
- for ( i = 2; listsiz--; i++ ) /* Check field value against each
- value until we have a match
- or run out of values */
-
- if ( !strcmp( wordb[i], iaprval ) ) /* Value matches? */
- return SUCCESS; /* Yes, return success code */
- exiterr( erm ); /* Display error message */
- return FAILURE; /* Return failure code */
- }
-
-
- /* End of example iapxit.c */
-