Example #1
0
int  odxa_errhandler(void)
{
    char buf[257]="";
    char message[513]="        ::[                , 00000000]: ";
    long error_no = 0;
    char error_text[257];
    SYSTIME     time_now;
    i4  len;

//  EXEC SQL INQUIRE_SQL(:error_no = ERRORNO,:error_text = ERRORTEXT);
        IILQisInqSqlio((short *)0,1,30,4,&error_no,2);
        IILQisInqSqlio((short *)0,1,32,256,error_text,63);

    CVlx((u_i4)error_no, buf);
    STprintf(message, ERx("        ::[%-16s, %s]: "), szFuncName, buf);
    TMnow( &time_now );
    TMstr( &time_now, buf );
    STcat(message, buf);
    STcat(message, " MS DTC Ingres XA Interface: ");

    if (STequal(szFuncName,"xa_open"))  /* dump out xa_open's xa_info string */
       {
         len = (i4)STlength(message);
         STcat(message, errlog_xa_info);
         WriteDTCerrToEventLog(S_OK, message);
         message[len] = '\0';   /* chop back to the message header */
       }

    STcat(message, error_text);

    WriteDTCerrToEventLog(S_OK, message);
    return 0;
}
Example #2
0
void
scs_scan_scbs( SCS_SCAN_FUNC *func, PTR arg )
{
    char classbuf[ 80 ];
    char instbuf[ 80 ];
    char valbuf[ 80 ];
    i4	lval;
    PTR	ptr;
    SCD_SCB *scb;
    i4	operms;
    
    instbuf[0] = EOS;
    STcopy( "exp.scf.scs.scb_ptr", classbuf );
    for( lval = sizeof(valbuf);
	OK == MOgetnext( ~0, sizeof(classbuf), sizeof(instbuf),
			classbuf, instbuf, &lval, valbuf, &operms ) &&
	STequal( "exp.scf.scs.scb_ptr", classbuf );
	lval = sizeof(valbuf) )
    {
	CVaptr( instbuf, &ptr );
	scb = (SCD_SCB *)ptr;
	if( OK != (*func)( scb, arg ) )
	    break;
    }
}
Example #3
0
STATUS
MO_ipindex(i4 msg,
	   PTR cdata,
	   i4  linstance,
	   char *instance,
	   PTR *instdata )
{
    STATUS stat = MO_NO_INSTANCE;
    MO_INSTANCE *ip;

    ip = MO_getinstance( (char *)cdata, instance );

    switch( msg )
    {
    case MO_GET:

	if( ip != NULL )
	    stat = OK;
	break;

    case MO_GETNEXT:

	if( ip != NULL )
	{
	    ip = (MO_INSTANCE *) SPnext( &ip->node, MO_instances );
	    if( ip != NULL &&
	       !STequal( (char *)ip->classdef->node.key, (char *)cdata ) )
		ip = NULL;
	}
	else			/* didn't find directly */
	{
	    if( *instance == EOS  )
		ip = MO_getinstance( (char *)cdata, (char *)NULL );
	    else
		break;
	}

	if( ip == NULL )
	    stat = MO_NO_NEXT;
	else
	    stat = MOstrout( MO_INSTANCE_TRUNCATED,
			     ip->instance, linstance, instance );
	break;

    default:

	stat = MO_BAD_MSG;
	break;
    }

    *instdata = (PTR)ip;

    return( stat );
}
Example #4
0
RUNFRM	*
RTfindfrm(char *nm)
{
	reg	RUNFRM	*runf;

	/*
	**	Search the list of initialized forms.
	*/
	for (runf = IIrootfrm; runf != NULL; runf = runf->fdlisnxt)
	{
		if ( STequal(nm, runf->fdfrmnm) )
			break;
	}

	return (runf);
}
Example #5
0
MO_INSTANCE *
MO_getinstance( char *classid, char *instance )
{
    MO_CLASS	cb;
    MO_INSTANCE	ib;
    MO_INSTANCE	*ip;

    cb.node.key = classid;
    ib.classdef = &cb;
    ib.instance = instance;
    ib.node.key = (PTR)&ib;

    if( instance != NULL )	/* find exact match */
    {
	ip = (MO_INSTANCE *)SPlookup( &ib.node, MO_instances );
    }
    else			/* find first of that class */
    {
	/*
	** This relies on the comparison function returning -1
	** when classids are equal, and the input instance is NULL.
	** After the enq, ib is the lowest block of the class; the
	** next one is the old first.
	*/
	(VOID) SPenq( &ib.node, MO_instances );
	ip = (MO_INSTANCE *)SPnext( &ib.node, MO_instances );
	SPdelete( &ib.node, MO_instances );

	if( ip != NULL && !STequal( (char *)ip->classdef->node.key, classid ) )
	    ip = NULL;
    }

# ifdef xDEBUG
    SIprintf("getinstance %s:%s -> %s:%s\n",
	     classid ? classid : "<nil>",
	     instance ? instance : "<nil>",
	     ip ? ip->classdef->node.key : "<nil>",
	     ip ? ip->instance : "<nil>" );
# endif

    return( ip );
}
Example #6
0
static STATUS
is_defined(char *symbol, char *value)
{
	SYMBOL *symptr;

	/* Try and locate the symbol in the list */
	for (symptr = symtab.head;
		symptr != NULL; 
		symptr = symptr->next )
	{
		if( STequal( symbol, symptr->name ) != 0 &&
			symptr->hist_flag == FALSE )
		{
			if (value != NULL)
				STcopy(symptr->value, value);
			return( OK );
		}
	}

	return( FAIL );
}
Example #7
0
static void
undefine( char *symbol )
{
	SYMBOL **symptr_anchor;
	SYMBOL *symptr;

	/* Try and locate the symbol in the list */
	for (symptr_anchor = &symtab.head;
		*symptr_anchor != NULL; 
		symptr_anchor = &symptr->next )
	{
		symptr = *symptr_anchor;
		if( STequal( symbol, symptr->name ) != 0 ) 
		{
			*symptr_anchor = symptr->next;
			MEfree( symptr->name );
			MEfree( symptr->value );
			MEfree( (PTR)symptr );
			symtab.nsym--;
			break;
		}
	}
}
Example #8
0
static void
drivecol( char *colclassid, DRIVE_FUNC *func, PTR arg ) 
{
    STATUS stat;
    i4  lsbuf;
    char classid[ MAXCLASSID ];
    char instance[ MAXINSTANCE ];
    char sbuf[ MAXVAL ];
    i4  perms;

    STcopy( colclassid, classid );
    instance[0] = EOS;

    for( lsbuf = sizeof( sbuf );
	(stat = MOgetnext(  ~0, sizeof(classid), sizeof(instance),
			  classid, instance,
			  &lsbuf, sbuf, &perms ) ) == OK
	&& STequal( colclassid, classid ) ;
	lsbuf = sizeof( sbuf ) )
    {
	(*func)( classid, instance, sbuf, perms, arg );
    } 
}
Example #9
0
static void
driverow( char *instance, char **cols, DRIVE_FUNC *func, PTR arg ) 
{
    STATUS stat;
    char classid[ MAXCLASSID ];
    char rinstance[ MAXINSTANCE ];
    char sbuf[ MAXVAL ];
    i4  lsbuf;
    i4  perms;

    if( cols != NULL )	/* get exact columns */
    {
	for( lsbuf = sizeof(sbuf);
	    *cols != NULL &&
	    OK == (stat = MOget( ~0, *cols, instance, &lsbuf, sbuf, &perms ) );
	    cols++, lsbuf = sizeof( sbuf ) )
	{
	    (*func)( *cols, instance, sbuf, perms, arg );
	}
    }
    else			/* stupid scan for instance match */
    {
	classid[0] = EOS;
	rinstance[0] = EOS;

	for( lsbuf = sizeof(sbuf);
	    OK == MOgetnext( ~0, sizeof(classid), sizeof(rinstance),
			    classid, rinstance,
			    &lsbuf, sbuf, &perms );
	    lsbuf = sizeof( sbuf ) )
	{
	    if( STequal( instance, rinstance ) )
		(*func)( classid, rinstance, sbuf, perms, (PTR) NULL );
	} 
    }
}
Example #10
0
static u_i4 
pp_directive( FILE *input, STACK_FRAME *stack , bool ifdef )
{
	i4 n, len;
	char *words[ MAX_LINE / 2 ], *temp, *p;
	char *parse_val, *parse_end;
	STACK_FRAME stack_frame;
	bool def_dir;
	u_i4 rtn = NONE;

	stack_frame.prev = stack;
	stack_frame.display_mode = TRUE;

	p = temp = STalloc( infile->yytext );
	CMnext( p );
	n = sizeof( words );
	STgetwords( p, &n, words ); 

	/* process the directive, watch out for the empty directive */
	if (n == 0)
	{
		;       /* empty directive */
	}
	else if( STequal( words[ 0 ], ERx( "define" ) ) != 0 )
	{
		/* If a symbol was specified look for the value to give it */
		if (n > 1) 
		{
			/* Scan for the 'define' keyword */
			parse_val = infile->yytext;
			CMnext(parse_val);         /* Skip over the '#' */
			while (CMwhite(parse_val))
				CMnext(parse_val);

			/* Scan past the 'define' keyword */
			while (!CMwhite(parse_val))
				CMnext(parse_val);

			/* Scan over white space separating 'define' */
			/* keyword and the specified symbol name */
			while (CMwhite(parse_val))
				CMnext(parse_val);

			/* Skip over the symbol name */
			while (!CMwhite(parse_val))
				CMnext(parse_val);

			/* Skip over white space after the symbol name */
			while (CMwhite(parse_val))
				CMnext(parse_val);

			/* At this point we have scanned to the beginning */
			/* of the defined value for the symbol, Trim off */
			/* any trailing white space */
			STtrmwhite(parse_val);

			/* Define value found, could be the empty string, "" */
			if( active( &stack_frame ) )
			{
				define( words[ 1 ], parse_val, FALSE );
			}
		}
		rtn = DEFINE;
	}

	else if( active( &stack_frame ) &&
		STequal( words[ 0 ], ERx( "undef" ) ) != 0 )
	{
		if (n > 1)
		{
			undefine( words[ 1 ] );
		}
		rtn = UNDEF;
	}

	else if( STequal( words[ 0 ], ERx( "if" ) ) != 0 )
	{
		/* If an expression was specified look for its evaluation */
		if (n > 1) 
		{
			/* Scan for the 'if' keyword */
			parse_val = infile->yytext;
			CMnext(parse_val);         /* Skip over the '#' */
			while (CMwhite(parse_val))
				CMnext(parse_val);

			/* Scan past the 'if' keyword */
			while (!CMwhite(parse_val))
				CMnext(parse_val);

			/* Scan over white space separating 'if' */
			/* keyword and the expression */
			while (CMwhite(parse_val))
				CMnext(parse_val);

			/* At this point we have scanned to the beginning */
			/* of the expression.*/
			if( active( &stack_frame ) )
			{
				/* Evaluate boolean expression found */
				stack_frame.display_mode = 
					pp_eval_boolexp( &parse_val, ERx("") );
			}
			(void) pp_input( input, &stack_frame, TRUE );
		}
		rtn = IF;
	}

	else if( STequal( words[ 0 ], ERx( "ifdef" ) ) != 0 )
	{
		if( active(&stack_frame) && is_defined(words[1], NULL) == OK)
		{
			stack_frame.display_mode = TRUE;
		}
		else
			stack_frame.display_mode = FALSE;
		(void) pp_input( input, &stack_frame, TRUE );
		rtn = IFDEF;
	}

	else if( STequal( words[ 0 ], ERx( "ifndef" ) ) != 0 )
	{
		if( active(&stack_frame) && is_defined(words[1], NULL) != OK)
		{
			stack_frame.display_mode = TRUE;
		}
		else
			stack_frame.display_mode = FALSE;
		(void) pp_input( input, &stack_frame, TRUE );
		rtn = IFNDEF;
	}

	else if( STequal( words[ 0 ], ERx( "else" ) ) != 0 )
	{
		if( !ifdef )
		{
			SIfprintf( stderr, E_YAPP007 );
			yydump();
		}
		stack_frame.prev->display_mode =
			( stack_frame.prev->display_mode == TRUE ) ?
			FALSE : TRUE;
		rtn = ELSE;
	}

	else if( STequal( words[ 0 ], ERx( "endif" ) ) != 0 )
	{
		rtn = ENDIF;
	}

	else if( STequal( words[ 0 ], ERx( "include" ) ) != 0 )
	{
		/* Look for the include filename */
		if (n > 1) 
		{
			/* Scan for the 'include' keyword */
			parse_val = infile->yytext;
			CMnext(parse_val);         /* Skip over the '#' */
			while (CMwhite(parse_val))
				CMnext(parse_val);

			/* Scan past the include keyword */
			while (!CMwhite(parse_val))
				CMnext(parse_val);

			/* Scan over white space separating 'include' */
			/* keyword and the specified filename */
			while (CMwhite(parse_val))
				CMnext(parse_val);

			/* At this point were expecting "file" or <file> */
			/* remember the character which ends the filename */
			def_dir = TRUE;
			if (CMcmpcase(parse_val, ERx("\"")) == 0)
			{
				parse_end = ERx("\"");
			}
			else if (CMcmpcase(parse_val, ERx("<")) == 0)
			{
				parse_end = ERx(">");
				def_dir = FALSE;
			}
			else
			{
				parse_end = ERx("");
			}

			/* Save the include file name in the temp string. */
			/* Note, this overwrites the parsed words of the  */
			/* record since but these are no longer needed.   */
			p = temp;
			CMnext(parse_val);
			while (*parse_val != EOS)
			{
				if (CMcmpcase(parse_val, parse_end) == 0) 
				{
					/* Terminate the file name and call */
					/* pp_file to process the file. */
					STcopy(ERx(""), p);
					pp_file(stack, temp, def_dir);
					break;
				}
				CMcpychar(parse_val, p);
				CMnext(parse_val);
				CMnext(p);
			}
		}
		rtn = DEFINE;
	}

	/* display everthing but legal directives */ 
	if (rtn == NONE && active( &stack_frame ) )
		yyputline( infile->yytext );

	MEfree( temp );
	return( rtn );
}
Example #11
0
i4
yylex()
{
	bool pattern;
	bool component;
	bool keyword;
	char *keyhead;
	char yytext[ SI_MAX_TXT_REC + 1 ];
	i4 yyleng;

	/* skip whitespace and comments */
	while( CMwhite( yyp ) || *yyp == EOS || *yyp == '-' )
	{
		/* check for comment */
		if( *yyp == '-' )
		{
			if( STbcompare( yyp, 2, ERx( "--" ), 2, FALSE ) == 0 )
			{
				while( *yyp != EOS )
					CMnext( yyp );
			}
			else
				break;
		}

		if( *yyp == EOS )
		{
			if( SIgetrec( yybuf, sizeof( yybuf ), yyin ) != OK &&
				yywrap() )
			{
				return( 0 );
			}
			else
			{
				yyp = yybuf;
				++yylineno;
			}
		}
		else
			CMnext( yyp );
	}

	/* check for a SYMBOL, PATTERN or keyword */
	yyleng = 0;
	pattern = FALSE;
	keyword = TRUE;
	keyhead = yyp;
	while( CMalpha( yyp ) || *yyp == '%' || *yyp == '$' || *yyp == '*' )
	{
		/* check for component of legal SYMBOL or PATTERN */ 
		component = FALSE;

		/* check for single-character component */
		switch( *yyp )
		{
			case '%':
				pattern = TRUE;
			case '*':
			case '$':
				component = TRUE;
				++yyleng;
				CMnext( yyp );
				if( *yyp == '.' )
				{
					++yyleng;
					CMnext( yyp );
					keyword = FALSE;
					continue;
				}
				else if( CMalpha( yyp ) )
					yyerror(); 
				continue;
		}

		while( CMalpha( yyp ) || CMdigit( yyp ) ||
			*yyp == '_' || *yyp == '-' )
		{
			++yyleng;
			CMnext( yyp );
			component = TRUE;
		}
		if( component )
		{
			if( *yyp == '.' )
			{
				++yyleng;
				CMnext( yyp );
				keyword = FALSE;
				continue;
			}
			continue;
		}
	}

	/* check for uneaten '.' */
	if( *yyp == '.' )
		yyerror();

	if( yyleng > 0 )
	{
		/* A keyword, SYMBOL or PATTERN was scanned */
		char *p;
		i4 i;

		/* put NULL-terminated copy in yytext */
		STlcopy( keyhead, yytext, yyleng );	
		for( p = yytext, i = 0; i <= yyleng; CMnext( p ), i++ );
		*p = EOS;	

		/* check for keywords */
		if( CMalpha( keyhead) && keyword )
		{
			if( STequal( ERx( "IF" ), yytext ) != 0 )
				return( IF );

			if( STequal( ERx( "ELSE" ), yytext ) != 0 )
				return( ELSE );

			if( STequal( ERx( "ELSEIF" ), yytext ) != 0 )
				return( ELSEIF );

			if( STequal( ERx( "ENDIF" ), yytext ) != 0 )
				return( ENDIF );

			if( STequal( ERx( "MIN" ), yytext ) != 0 )
				return( MIN );

			if( STequal( ERx( "MAX" ), yytext ) != 0 )
				return( MAX );

			if( STequal( ERx( "VALID" ), yytext ) != 0 )
				return( VALID );

			if( STequal( ERx( "PRIME" ), yytext ) != 0 )
				return( PRIME );

			if( STequal( ERx( "SIGNED_INT" ), yytext ) != 0 )
				return( SIGNED_INT );

			if( STequal( ERx( "DECIMAL" ), yytext ) != 0 )
				return( DECIMAL );

			if( STequal( ERx( "SIZETYPE" ), yytext ) != 0 )
				return( SIZETYPE );

			if( STequal( ERx( "POWER2" ), yytext ) != 0 )
				return( POWER2 );

			if( STequal( ERx( "REQUIRES" ), yytext ) != 0 )
				return( REQUIRES );

			if( STequal( ERx( "UNDEFINED" ), yytext ) != 0 )
				return( UNDEFINED );

			if( STequal( ERx( "SUM" ), yytext ) != 0 )
			{
				yylval.integer = SUM;
				return( SUM );
			}

			if( STequal( ERx( "ON" ), yytext ) != 0 )
			{
				yylval.real = 1;
				return( BOOL_CON );
			}

			if( STequal( ERx( "OFF" ), yytext ) != 0 )
			{
				yylval.real = 0;
				return( BOOL_CON );
			}

			if( STequal( ERx( "IS" ), yytext ) != 0 )
			{
				yylval.string = STalloc( yytext );
				return( COMPARE_OP );
			}

			if( STequal( ERx( "DIRECTORY" ), yytext ) != 0 )
				return( DIRECTORY );

			if( STequal( ERx( "FILE" ), yytext ) != 0 )
				return( FILESPEC );

		}
		/* valid SYMBOL or PATTERN */
		yylval.string = STalloc( yytext );
		if( pattern )
			return( PATTERN );
		/* don't accept a single '*' as SYMBOL */
		if( yyleng != 1 || *yytext != '*' )
			return( SYMBOL );

		/* push '*' back onto the input stream */
		CMprev( yyp, yybuf );
	}

	/* check for EXEC_TEXT, STR_CON, or EXEC_TEXT_STR */
	if( *yyp == '`' || *yyp == '"' )
	{
		int exec_str = 0;
		char *initstr = yyp;
		char *p = yyp, *text, *yyprev;

		if ( *yyp == '"' )
		{
			CMnext( yyp );
			if ( *yyp == '`' )
			{
				CMnext( p );
				exec_str = 1;
			}
			else
				yyp = p;
		}
		for( yyleng = 0, CMnext( yyp ), yyprev = ERx( "" );
			*yyp != *p || *yyprev == '\\';
			yyprev = ( *yyprev == EOS ) ? yyp : CMnext( yyprev ),
			CMnext( yyp ), ++yyleng )
		{
			if( *yyp == *p && *yyprev == '\\' )
			{
				/* remove escape character */
				char *p1, *p2;

				for( p1 = p2 = yyprev, CMprev( p1, p );
					p1 >= p; CMprev( p1, p ),
					CMprev( p2, p ) )
				{
					CMcpychar( p1, p2 );
				}
				--yyleng;
				CMnext( p );
			}

			if( *yyp == EOS )
				yyerror();
		}
		CMnext( yyp );
		if ( exec_str )
		{
			if ( *yyp == '"' )
				CMnext( yyp );
			else
			{
				/* keep scanning to final '"' */
				p = initstr;
				exec_str = 0;
				yyleng++;
				for( ; *yyp != *p || *yyprev == '\\';
					yyprev = ( *yyprev == EOS ) ? yyp : 
					CMnext( yyprev ),
					CMnext( yyp ), ++yyleng )
				{
					if( *yyp == EOS )
						yyerror();
				}
			}
		}
		text = p;
		CMnext( text );
		STlcopy( text, yytext, yyleng );
		yytext[ yyleng ] = EOS;
		yylval.string = STalloc( yytext );
		if( *p == '`' )
		{
			if ( exec_str )
				return( EXEC_TEXT_STR );
			return( EXEC_TEXT );
		}
		return( STR_CON );
	}

	/* check for NUM_CON */
	yyleng = 0;
	if( *yyp == '-' || CMdigit( yyp ) )
	{
		f8 factor;
		char *p = yyp;

		if( *yyp == '-' )
		{
			++yyleng;
			factor = -1;
			CMnext( yyp );
		}
		else
			factor = 1;
		
		if( !CMdigit( yyp ) )
			CMprev( yyp, yybuf );
		else
		{
			if( *yyp == '-' )
			{
				CMnext( yyp );	
				
			}
			else
				factor = 1;

			while( CMdigit( yyp ) )
			{
				++yyleng;
				CMnext( yyp );
			}

			if( *yyp == '.' )
			{
				++yyleng;
				CMnext( yyp );
				if( !CMdigit( yyp ) )
					yyerror();
				while( CMdigit( yyp ) )
				{
					++yyleng;
					CMnext( yyp );
				}
			}
			else if( *yyp == 'K' || *yyp == 'M' )
			{
				++yyleng;
				CMnext( yyp );
			}

			STlcopy( p, yytext, yyleng ); 
			yytext[ yyleng ] = EOS;

			if( yytext[ yyleng - 1 ] == 'K' )
			{
				factor = 1024;
				yytext[ yyleng - 1 ] = EOS;
			}
			else if( yytext[ yyleng - 1 ] == 'M' )
			{
				factor = 1048576;
				yytext[ yyleng - 1 ] = EOS;
			}
			CVaf( yytext, ERx( '.' ), &yylval.real );
			yylval.real *= factor;
			return( NUM_CON );
		}
	}

	if( STbcompare( yyp, 2, ERx( ">=" ), 2, FALSE ) == 0 )
	{
		yylval.string = STalloc( ERx( ">=" ) );
		CMnext( yyp );
		CMnext( yyp );
		return( COMPARE_OP );
	}
	if( STbcompare( yyp, 2, ERx( "<=" ), 2, FALSE ) == 0 )
	{
		yylval.string = STalloc( ERx( "<=" ) );
		CMnext( yyp );
		CMnext( yyp );
		return( COMPARE_OP );
	}
	/* check for COMPARE_OP */
	if( STbcompare( yyp, 1, ERx( "<" ), 1, FALSE ) == 0 )
	{
		yylval.string = STalloc( ERx( "<" ) );
		CMnext( yyp );
		return( COMPARE_OP );
	}
	if( STbcompare( yyp, 1, ERx( ">" ), 1, FALSE ) == 0 ) 
	{
		yylval.string = STalloc( ERx( ">" ) );
		CMnext( yyp );
		return( COMPARE_OP );
	}
	if( STbcompare( yyp, 2, ERx( "==" ), 2, FALSE ) == 0 )
	{
		yylval.string = STalloc( ERx( "==" ) );
		CMnext( yyp );
		CMnext( yyp );
		return( COMPARE_OP );
	}

	/* check for characters which get passed directly */
	switch( *yyp )
	{
		char *p;

		case '(':
		case ')':
		case '[':
		case ']':
		case '{':
		case '}':
		case ':':
		case ';':
		case ',':
		case '=':
			p = yyp;
			CMnext( yyp );
			return( *p );	

		case '+':
			yylval.string = STalloc( ERx( "+" ) );
			CMnext( yyp );
			return( *yylval.string );

		case '-':
			yylval.string = STalloc( ERx( "-" ) );
			CMnext( yyp );
			return( *yylval.string );

		case '*':
			yylval.string = STalloc( ERx( "*" ) );
			CMnext( yyp );
			return( *yylval.string );

		case '/':
			yylval.string = STalloc( ERx( "/" ) );
			CMnext( yyp );
			return( *yylval.string );
	}

	/* check for LOGIC_OP */
	if( STbcompare( yyp, 3, ERx( "&&" ), 3, FALSE ) == 0 )
	{
		yylval.string = STalloc( ERx( "&&" ) );
		CMnext( yyp );
		CMnext( yyp );
		return( LOGIC_OP );
	}
	if( STbcompare( yyp, 3, ERx( "||" ), 3, FALSE ) == 0 )
	{
		yylval.string = STalloc( ERx( "||" ) );
		CMnext( yyp );
		CMnext( yyp );
		return( LOGIC_OP );
	}

	/* anything else is an error */
	yyerror();

}
Example #12
0
FUNC_EXTERN AITCB *
AITinit( int argc, char** argv, void (*msg)() )
{
    STATUS	status;
    char	*inputFileName; 
    char	*outputFileName = default_output;
    char	*tracefile = NULL;
    i4		i = 1;

    ait_cb.state = AIT_DONE;
    ait_cb.msg = msg;

    if ( argc < 2)
    {
	(*ait_cb.msg)( "Usage:\napitest [-db dbname] [-trace level] [-log traceFile] [-user username] [-passwd password] [-verbose] inputfilename outputfilename\n" );
	return( &ait_cb );
    }

    while ( i < argc -1  && argv[i][0] == '-' )
    {
	if ( STequal( argv[i], db_flag ) )
	{
	    i++;
	    dbname = (char *)ait_malloc( STlength( argv[i] ) + 1 );
	    STcopy( argv[i], dbname );
	    i++;
	}
        else  if ( STequal( argv[i], log_flag ) )
	{
	    i++;
	    tracefile = argv[ i++ ];
       	}	      
	else  if ( STequal( argv[i], tr_flag ) )
	{
	    i++;
	    status = CVan( argv[i], &traceLevel );
	    if ( status != OK )
	    {
		(*ait_cb.msg)( "Command line error: trace-level is not an integer.\n" );
		return( &ait_cb );
	    }
	    i++;
	}	    
	else  if ( STequal( argv[i], user_flag ) )
	{
	    i++;
	    username = ( char * )
		       ait_malloc( STlength( argv[i] ) + 1 );
	    STcopy( argv[i], username );
	    i++;
	}
	else  if ( STequal( argv[i], passwd_flag ) )
	{
	    i++;
	    password = ( char * )
		       ait_malloc( STlength( argv[i] ) + 1 );
	    STcopy( argv[i], password );
	    i++;
	}
	else  if ( STequal( argv[i], verbose_flag ) )
	{
	    i++;
	    verboseLevel = 1;
	}
	else
	{
	    STprintf( str, "%s: unknown option.\n", argv[i] );
	    (*ait_cb.msg)( str );
	    (*ait_cb.msg)( "Usage:\napitest [-db dbname] [-trace level] [-log traceFile] inputfilename outputfilename\n" );
	    i++;
	    break;
	}
    }

    if ( i == argc )
    {
	(*ait_cb.msg)( "Command line error: inputfilename unknown.\n" );
	return( &ait_cb );
    }

    inputFileName = argv[ i++ ];

    if ( i < argc )
    {
	outputFileName = argv[ i++ ];

	if ( STequal( inputFileName, outputFileName ) )
	{
	    (*ait_cb.msg)( "input and output file name must not be the same.\n" );
	    return( &ait_cb );
	}
    }

    if ( i < argc )
    {
	for ( ; i < argc; i++ )
	{
	    STprintf( str, "%s ignored\n", argv[i] );
	    (*ait_cb.msg)( str );
	}
    }
   
    if ( tracefile  &&  *tracefile )  ait_initTrace( tracefile );
    AIT_TRACE( AIT_TR_TRACE )( "initialize the api tester...\n" );
    AIT_TRACE( AIT_TR_TRACE )( "inputfile = %s, outputfile = %s\n",
			     inputFileName, outputFileName );
    
    /*
    ** Open input/output files.  Only
    ** enter parsing state if successful.
    */
    if ( ait_openfile( inputFileName, "r", &inputf ) )
        if ( STequal( outputFileName, default_output ) )
	{
	    outputf = stdout;
	    ait_cb.state = AIT_PARSE;
        }
	else  if ( ait_openfile ( outputFileName, "w", &outputf ) )
	    ait_cb.state = AIT_PARSE;

    return( &ait_cb );
}
Example #13
0
STATUS
LOingpath(
char		*area,		/* "device" that the database is on */
char		*dbname,	/* ingres data base name */
char		*what,		/* path to db, ckp, jnl, or sort */
LOCATION	*fullpath)	/* set to full path of database */
{
	static	char	buffer[255];
	register char       *dbptr = dbname;
 	char 	*strptr = buffer;
	SIZE_TYPE try_raw = FALSE;
	STATUS	ret_val = OK;

	/* Only check for RAW if requested by dbname==LO_RAW */
	if ( (try_raw = (SIZE_TYPE)dbptr && STequal( dbptr, LO_RAW)) )
            dbptr = NULL;
	


	/* check for legal arguments */

	if ((area == NULL) || (*area == NULL) || 
             (what == NULL) || (*what == NULL))
		ret_val = LO_NULL_ARG;
	/* set up location */
	fullpath->string = buffer;

	/* create location */
	STcopy(area, strptr);
        strptr += STlength(strptr);

	/* add colon if not there */
	if(*(strptr - 1) != *COLON)
		*strptr++ = *COLON;

	STcopy("[INGRES.", strptr);
        strptr += STlength(strptr);

	/* add 'what' to path */
	STcopy(what, strptr);
        strptr += STlength(strptr);

	/*
        ** Raw locations are identified by the existence of the
        ** file "iirawdevice" (LO_RAW).
        */
        if ( try_raw )
               ret_val = OK;

	if ( !ret_val )
	{
	   /* if dbname exists then insert it */
	   if(dbptr != NULL && *dbptr != EOS)
		STpolycat(3, DOT, dbname, CBRK, strptr);
	   else		
	   {
		*strptr++ = *CBRK;	
		*strptr = NULL;
	   }
	   LOfroms(PATH, fullpath->string, fullpath);
	}
	return(ret_val);

}