home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
GLEN
/
IS.ZIP
/
IS_COND.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-10-26
|
1KB
|
44 lines
/*
** is-cond.c source module for condition validation for IS
*/
#include <stdio.h>
#include <string.h>
#include "is.h"
int is_cond(char *cond_in, char *cond_out)
{ int ret;
char *cond_lwr;
cond_lwr = strlwr(strdup(cond_in)); /* convert condition to */
/* lowercase . . . then */
if((strcmp(cond_lwr, "eq")) == 0) /* check for all possible */
ret = OK; /* conditions, set ret = 0 */
else if((strcmp(cond_lwr, "gt")) == 0) /* if ok, or 1 if bad */
ret = OK;
else if((strcmp(cond_lwr, "lt")) == 0)
ret = OK;
else if((strcmp(cond_lwr, "ge")) == 0)
ret = OK;
else if((strcmp(cond_lwr, "le")) == 0)
ret = OK;
else if((strcmp(cond_lwr, "neq")) == 0)
ret = OK;
else if((strcmp(cond_lwr, "ngt")) == 0)
ret = OK;
else if((strcmp(cond_lwr, "nlt")) == 0)
ret = OK;
else if((strcmp(cond_lwr, "nge")) == 0)
ret = OK;
else if((strcmp(cond_lwr, "nle")) == 0)
ret = OK;
else
ret = BAD;
if(ret == OK) /* if good condition, copy */
strcpy(cond_out, cond_lwr); /* it to return string */
return(ret);
}