Exemple #1
0
/*
** Name: scs_broadcast_mesg 
**
** Description:
**	Sends a broadcast message to a particular session
**
** 	The current implementation queues a TRACE message for the
**	session, sent out  during later communications.
**
** History:
**	15-dec-93 (robf)
**	    Created
**
*/
static STATUS
scs_broadcast_mesg(SCD_SCB *scb, PTR  mesgptr)
{
    char sendmesg[1024];
    SCF_CB	scf_cb;
    char *m=(char*)mesgptr;
    static char *broadcast_hdr = 
"********************************************************************\nBroadcast message:\n\t";

    DB_STATUS status;

   if( scb != NULL && scb->cs_scb.cs_client_type == SCD_SCB_TYPE &&
      	 (scb->scb_sscb.sscb_stype == SCS_SNORMAL ||
       	  scb->scb_sscb.sscb_stype == SCS_SMONITOR ))
    {
	if(STlength(mesgptr)>sizeof(sendmesg)-sizeof(broadcast_hdr))
		mesgptr[sizeof(sendmesg)-sizeof(broadcast_hdr)]= EOS;
	/*
	** Format broadcast
	*/
	STprintf(sendmesg,"%s%s", broadcast_hdr, m);
	/*
	** Send message to scc.
	*/
	scf_cb.scf_len_union.scf_blength=STlength(sendmesg);
	scf_cb.scf_ptr_union.scf_buffer=sendmesg;
	scf_cb.scf_session = (SCF_SESSION)scb;

	status = scc_trace(&scf_cb, scb);
	/* scc_trace already logs errors, so don't duplicate here */
    }
    return OK;
}
Exemple #2
0
static VOID
seedToDigits(
    DB_TAB_ID	*seed,
    char	*digitString,
    QEF_RCB	*qef_rcb
)
{
    i4		leadingZeroes;
    i4		firstStringLength;
    i4		secondStringLength;
    char	firstString[ DIGITS_IN_I4 + 1 ];
    char	secondString[ DIGITS_IN_I4 + 1 ];

    CVlx( seed->db_tab_base, firstString );
    firstString[ DIGITS_IN_I4 ] = 0;	/* just in case */
    firstStringLength = STlength( firstString );

    CVlx( seed->db_tab_index, secondString );
    secondString[ DIGITS_IN_I4 ] = 0;	/* just in case */
    secondStringLength = STlength( secondString );

    leadingZeroes = DIGITS_IN_I4 - firstStringLength;
    STmove( "", '0', leadingZeroes, digitString );
    STcopy( firstString, &digitString[ leadingZeroes ] );

    leadingZeroes = DIGITS_IN_I4 - secondStringLength;
    STmove( "", '0', leadingZeroes, &digitString[ DIGITS_IN_I4 ] );
    STcopy( secondString, &digitString[ DIGITS_IN_I4 + leadingZeroes ] );
}
Exemple #3
0
/*
** Name: Val_Value
**
** Decription:
**      A value should be extracted from the buffer and appended to the
**      variables list.
**      Format of the variable list is variable=value&variable=value.
**
** Inputs:
**      sess        ice session structure
**      line        pointer to the current line
**      linelen     length of the line
**
** Outputs:
**      pos         number of characters handled.
**
** Return:
**      GSTAT_OK    success
**      other       failure
**
** History:
**      23-Oct-98 (fanra01)
**          Created.
*/
static GSTATUS
Val_Value (WTS_SESSION* sess, char* line, i4  linelen, i4 * pos)
{
    GSTATUS     err = GSTAT_OK;
    PWTS_UPLOAD load= sess->load;
    i4          nlen = STlength (load->varname);

    err = GAlloc((PTR*)&sess->variable,
        sess->vlen + nlen + linelen + 2, TRUE);
    if (err == GSTAT_OK && sess->variable != NULL)
    {
        if (sess->vlen > 0)
        {
            sess->variable[sess->vlen++] = '&';
        }
        MECOPY_VAR_MACRO(load->varname, nlen, sess->variable + sess->vlen);
        sess->vlen += STlength (load->varname);
        if (linelen)
        {
            MECOPY_VAR_MACRO(line, linelen,
                sess->variable + sess->vlen);
            sess->vlen += linelen;
            load->varcmplt = 1;
        }
        sess->variable[sess->vlen] = EOS;
    }
    load->state = US_VAL;
    *pos = linelen;
    return (err);
}
Exemple #4
0
/*{
** Name:	MO_mon_id_get	-- get method for monitor id.
**
** Description:
**	A get method to make the monitor id visible.
**
** Re-entrancy:
**	yes.
**
** Inputs:
**	offset		ignored
**	objsize		ignored
**	object		an MO_MON_BLOCK
**	luserbuf	length of out buf
**
** Outputs:
**	userbuf		out buf
**
** Returns:
**	OK
**	MO_VALUE_TRUNCATED
**
** Side Effects:
**	May temporarily allocated some memory, freed before return.
**
** History:
**	24-sep-92 (daveb)
**	    documented
**	7-sep-93 (swm)
**	    call MOptrout() rather than MOulongout() for mp->mon_data to
**	    avoid i4/pointer truncation errors.
*/
STATUS
MO_mon_id_get(i4 offset,
	     i4  objsize,
	     PTR object,
	     i4  luserbuf,
	     char *userbuf)
{
    STATUS ret_val = OK;
    MO_MON_BLOCK *mp = (MO_MON_BLOCK *)object;
    char localbuf[ MO_MAX_NUM_BUF * 3 + 2 ];
    char numbuf[ MO_MAX_NUM_BUF ];
    i4  len;
    char *outbuf;

    (void)MOptrout( 0, mp->mon_data, sizeof( numbuf ), numbuf );
    len = (i4)(STlength( mp->mo_class->node.key ) + STlength(numbuf) + 2);
    if(  len <= sizeof( localbuf ) )
	outbuf = localbuf;
    else
	outbuf = MO_alloc( len, &ret_val );

    if( ret_val == OK )
    {
	STprintf( outbuf, "%s.%s", mp->mo_class->node.key, numbuf );
	ret_val = MOstrout( MO_VALUE_TRUNCATED, outbuf, luserbuf, userbuf );
	if( outbuf != localbuf )
	    MO_free( outbuf, len );
    }
# if 0
    if( ret_val != OK )
	/* FIXME */
# endif

    return( ret_val );
}
Exemple #5
0
/*
**	gwsxachkrcb - Check the RCB to make sure it makes sense
**
** Description:
**	Checks a GWX_RCB pointer to see if it makes sense
**
** Returns
**	E_DB_OK		If valid
**	E_DB_ERROR 	If Invalid
**
** History:
**	14-sep-92 (robf)
**	    Created
*/
DB_STATUS
gwsxachkrcb( GWX_RCB *gwx_rcb, char *routine)
{
	if ( gwx_rcb == (GWX_RCB*)0)
	{
		/*
		**	NULL pointer, error
		*/
		/* E_GW4050 The SXA Gateway routine %0c was passed a NULL RCB. This is an
		internal error*/
		gwsxa_error(gwx_rcb,E_GW4050_SXA_NULL_RCB,
				SXA_ERR_INTERNAL, 1, 
			STlength(routine),routine);
		return ( E_DB_ERROR);
	}

	if ( gwx_rcb->xrcb_gw_id != DMGW_SEC_AUD)
	{
		/*
		**	Not our gateway, internal error
		*/
		/* E_GW4051 The SXA Gateway routine %0c was passed an RCB referring to another gateway (%1d) */
		 gwsxa_error(gwx_rcb,E_GW4051_SXA_BAD_GW_ID,
				SXA_ERR_INTERNAL, 2,
				STlength(routine), routine,
				sizeof(gwx_rcb->xrcb_gw_id),
				(PTR)&(gwx_rcb->xrcb_gw_id));
		return ( E_DB_ERROR);
	}
	return ( E_DB_OK );
}
Exemple #6
0
static void
display_err(char *etxt, STATUS status)
{
    if (OK != ERreport(status, &etxt[STlength(etxt)]))
        STprintf(&etxt[STlength(etxt)],
	    "(Reason unknown)", status);
    SIprintf("%s\n",etxt);
}
Exemple #7
0
static char *
ns_login( API_PARSE *parse, i4 buflen, char *buffer )
{
    char	*user, *pwd, *value;
    i4		usrlen, pwdlen, len;
    STATUS	status;

    if ( parse->opcode == API_KW_ADD )
    {
	/*
	** Password required and must be sent encrypted.
	*/
	user = ns_resolve_param( parse, API_FIELD_PARM, FALSE );
	usrlen = STlength( user );
	pwd  = ns_resolve_param( parse, API_FIELD_PARM + 1, FALSE );
	pwdlen = (STlength( pwd ) + 8) * 2;	/* estimate encrypted length */
    }
    else
    {
	/*
	** Use GCN wild card format for password.
	*/
	user = ns_resolve_param( parse, API_FIELD_PARM, TRUE );
	usrlen = STlength( user );
	pwd = empty;
	pwdlen = 0;
    }

    /* Allow room for EOS and separating ',' */
    len = usrlen + pwdlen + 2;

    /*
    ** Allocate storage for the final value
    ** and build it from the parameters
    ** retrieved above.
    */
    value = (len <= buflen) ? buffer
    			    : (char *)MEreqmem( 0, len, FALSE, &status );
    if ( ! value )
    {
	IIAPI_TRACE( IIAPI_TR_FATAL )
	    ( "ns_login: can't allocate value buffer\n" );
	return( NULL );
    }

    if ( parse->opcode != API_KW_ADD )
	STpolycat( 3, user, ",", pwd, value );
    else
    {
	/*
	** Encrypt password directly into formatted output.
	*/
	STpolycat( 2, user, ",", value );
	gcu_encode( user, pwd, &value[ usrlen + 1 ] );
    }

    return( value );
}
Exemple #8
0
char *
xfaddpath(char *filename, i4  in_or_out)
{
    auto char	*wholename;

    if (filename == NULL)
    {
	wholename = NULL;
    }
    else if (in_or_out == XF_INTOFILE && Xf_into_path != NULL)
    {
	STcopy(Xf_into_path, Whole_name);

# ifdef UNIX
	if (Whole_name[STlength(Whole_name)-1] != '/')
	    STcat(Whole_name, ERx("/"));
# else 
# ifdef DESKTOP
	if (Whole_name[STlength(Whole_name)] != '\\')
	    STcat(Whole_name, ERx("\\"));
# endif /* DESKTOP */
# endif

	wholename = STcat(Whole_name, filename);
    }
    else if (in_or_out == XF_FROMFILE && Xf_from_path != NULL)
    {
	STcopy(Xf_from_path, Whole_name);

# ifdef UNIX
	if (Whole_name[STlength(Whole_name)-1] != '/') 
	    STcat(Whole_name, ERx("/"));
# else
# ifdef DESKTOP
	if (Whole_name[STlength(Whole_name)] != '\\')
	    STcat(Whole_name, ERx("\\"));
# endif /* DESKTOP */
# endif
	wholename = STcat(Whole_name, filename);
    }
    else
    {
	LOcopy(&Xf_dir, Tmppath_buf, &Tmppath);

	/* add the file name to location */
	LOfstfile(filename, &Tmppath);

	LOtos(&Tmppath, &wholename);
    }
# ifdef NT_GENERIC
    xlate_backslash(wholename);
# endif /* NT_GENERIC */
    return (wholename);
}
Exemple #9
0
/*
** Name: WTSOpenUpLoad() -
**
** Description:
**
** Inputs:
**      contentType
**      session
**
** Outputs:
**
** Returns:
**	GSTATUS	:	GSTAT_OK
**
** Exceptions:
**	None
**
** Side Effects:
**	None
**
** History:
*/
GSTATUS
WTSOpenUpLoad(
    char        *contentType,
    WTS_SESSION *session)
{
    GSTATUS     err;
    i4          length = STlength(MULTIPART);
    PWTS_UPLOAD load = NULL;
    char*       bound;
    i4          blen;

    if (contentType != NULL &&
        STscompare(contentType, length, MULTIPART, length) == 0)
    {
        session->status = UPLOAD;
        if ((err = GAlloc ((char**)&load, sizeof(WTS_UPLOAD),
            FALSE)) == GSTAT_OK)
        {
            session->load = load;
            bound = STindex (contentType, BOUNDARY, 0) + STlength(BOUNDARY);
            blen  = STlength (bound);

            /*
            ** Allocate space for a start boundary and and en boundary
            ** each having the delimiters and null terminator.
            */
            if (((err = GAlloc (&load->start, blen + 3, FALSE)) == GSTAT_OK) &&
                ((err = GAlloc (&load->end, blen + 5, FALSE)) == GSTAT_OK))
            {
                STcopy ("--",load->start);
                STlcopy (bound, load->start + 2, blen);
                STcopy (load->start, load->end);
                STcat (load->end, "--");
            }
            load->state = US_BEGIN;
        }
    }
    else
    {
        session->status = NO_UPLOAD;
        session->load   = NULL;
    }
    session->list = NULL;
    session->variable = NULL;
    session->vlen = 0;

    return(GSTAT_OK);
}
Exemple #10
0
/*
** Name: ascs_avformat	- Show info on the current thread during an AV
**
** Description:
**	This routine calls scs_iformat to show what thread was running
**	when the server got an AV.
**
** Inputs:
**	None.
**
** Outputs:
**	Returns:
**	    STATUS
**	Exceptions:
**	    none
**
** Side Effects:
**	    none
**
** History:
**	27-feb-1992 (rog)
**	    Created.
**	29-Jun-1993 (daveb)
**	    correctly cast arg to CSget_scb().
**	02-Jul-1993 (daveb)
**	    prototyped.
**	07-jul-1993 (rog)
**	    Changed the message from saying a fatal error occurred to just
**	    saying that an error occurred.
[@history_template@]...
*/
STATUS
ascs_avformat(void)
{
	STATUS		ret_val;
	EX_CONTEXT	ex;

    if (EXdeclare(ascs_fhandler, &ex) != OK)
    {
	ret_val = FAIL;
    }
    else
    {
	SCD_SCB		*scb;
	i4		err_code;
	char 		*msg_buffer;
	i4		msg_length;

	msg_buffer = "An error occurred in the following session:";
	msg_length = STlength(msg_buffer);

	CSget_scb((CS_SCB **)&scb);
	ule_format(0, 0, ULE_MESSAGE, 0, msg_buffer, msg_length,0,&err_code,0);
	ret_val = ascs_iformat(scb, 1, 0, 1);
    }

    EXdelete();
    return(ret_val);
}
Exemple #11
0
/*
** sxf_set_activity - Set up the server activity, so user can see
** what we are doing.
**
** Inputs:
**	A string corrosponding to the activity to be set. The user will
**	see this in the output of "iimonitor" etc for the thread's activity.
**
** Outputs:
**	None
**
** History:
**	11-dec-92 (robf) 
**		Created
*/
VOID
sxf_set_activity(char *mesg)
{
	SCF_CB 	  scb;
	DB_STATUS status;
	i4   error;

	scb.scf_type=SCF_CB_TYPE;
	scb.scf_length=SCF_CB_SIZE;
	scb.scf_session=DB_NOSESSION;
	scb.scf_len_union.scf_blength=STlength(mesg);
	scb.scf_nbr_union.scf_atype = SCS_A_MAJOR;
	scb.scf_ptr_union.scf_buffer=mesg;
	scb.scf_facility=DB_SXF_ID;

	status=scf_call(SCS_SET_ACTIVITY, &scb);
	if (status!=E_DB_OK)
	{
		/*
		**	Log something went wrong and continue.
		*/
		_VOID_ ule_format(scb.scf_error.err_code, NULL, ULE_LOG,
			NULL, NULL, 0L, NULL, &error, 0);
		_VOID_ ule_format(E_SX1062_SCF_SET_ACTIVITY, NULL, ULE_LOG,
			NULL, NULL, 0L, NULL, &error, 0);
	}
}
Exemple #12
0
STATUS
GM_mk_conn_instance( PTR srvr_key,
		    PTR conn_key,
		    i4  linstance,
		    char *instance )
{
    i4		len;
    STATUS	cl_stat;

    len = STlength( (char *)srvr_key );
    cl_stat = MOstrout( MO_INSTANCE_TRUNCATED, (char *)srvr_key,
		       linstance, instance );
    if( cl_stat == OK )
    {
	if( len >= linstance - 1 )
	{
	    cl_stat = MO_INSTANCE_TRUNCATED;
	}
	else
	{
	    instance[ len ] = '.';
	    cl_stat = MOptrout( MO_INSTANCE_TRUNCATED, conn_key,
			    linstance - len - 1, &instance[ len + 1 ] );
	}
    }
    return( cl_stat );
}
Exemple #13
0
STATUS
append_line(char *aline,i4 newline)
{
    char                   buffer [TEST_LINE+5] ;
    char                  *cp = aline ;

    /*
	line is printed long enough to accomodate SCR output
    */

/*
	This loop breaks up long lines and puts the continuation character
	at the TEST_LINE+2 position.
*/

    while (STlength(cp) > TEST_LINE+3)
    {
	STprintf(buffer, ERx("%.*s%s\n"), TEST_LINE+2, cp, cont_char);
	SIputrec(buffer,logptr);
	cp += TEST_LINE+2;
    }

    if (newline)
    {
	STpolycat(2,cp,ERx("\n"),buffer);
	return(SIputrec(buffer,logptr));
    }
    else
	return(SIputrec(cp,logptr));

}
Exemple #14
0
/*
** Name psl_lm2_setlockkey() - perform semantic action for SETLOCKKEY production
**
** Description:
**	perform semantic action for SETLOCKKEY production in QUEL and SQL
**	grammars
**
** Input:
**	sess_cb		    PSF session CB
**	    pss_distrib	    DB_3_DDB_SESS if distributed thread
**	    pss_stmt_flags  PSS_SET_LOCKMODE_SESS if SET LOCKMODE SESSION
**			    (distributed thread only)
**	char_name	    name of a characteristic
**
** Output:
**	char_type	    a number corresponding to this characteristic type
**	err_blk		    filled in if an error occurred
**
** Returns:
**	E_DB_{OK, ERROR}
**
** Side effects:
**	none
**
**  History:
**	07-mar-91 (andre)
**	    plagiarized from SETLOCKKEY production
**	20-apr-92 (barbara)
**	    Updated for Sybil.  Added session cb to interface.  For the
**	    distributed thread, TIMEOUT is the only option supported on a
**	    SESSION basis.
**	06-oct-93 (barbara)
**	    Fixed bug 53492.  Star now supports all set lockmode session
**	    statements.
**      04-apr-1995 (dilma04) 
**          Add support for READLOCK=READ_COMMITTED/REPEATABLE_READ.
**      14-oct-97 (stial01)
**          psl_lm2_setlockkey() Isolation levels are not valid readlock values.
**	    
*/
DB_STATUS
psl_lm2_setlockkey(
	PSS_SESBLK  *sess_cb,
	char	    *char_name,
	i4	    *char_type,
	DB_ERROR    *err_blk)
{
    i4                err_code;

    /* Decode "set lockmode" parameter.  Error if unknown. */
    if (!STcompare(char_name, "level"))
    {
	*char_type = LOCKLEVEL;
    }
    else if (!STcompare(char_name, "readlock"))
    {
	*char_type = READLOCK;
    }
    else if (!STcompare(char_name, "maxlocks"))
    {
	*char_type = MAXLOCKS;
    }
    else if (!STcompare(char_name, "timeout"))
    {
    	*char_type = TIMEOUT;
    }
    else
    {
	(VOID) psf_error(5928L, 0L, PSF_USERERR, &err_code,
	    err_blk, 1, (i4) STlength(char_name), char_name);
	return (E_DB_ERROR);    /* non-zero return means error */
    }

    return(E_DB_OK);
}
Exemple #15
0
bool
adu_1monthcheck(
char    *input,
i4	*output)
{
    i4			    month;

    /* month can be an integer, or an alphanumeric code */

    if (CVal(input, &month) == OK)
    {
        *output = month;
        return (month < 1 || month > MONTHS_PER_YR);
    }
    else
    {
	const ADU_DATENAME *d;

        _VOID_ CVlower(input);

	d = adu_monthname_lookup(input,STlength(input));
	if (d == NULL)
	{
	    *output = 0;
	    return 1;
	}

	*output = d->d_value; 
	return (d->d_class != 'm'); /* TWISTED LOGIC! */
    }
}
Exemple #16
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;
}
Exemple #17
0
STATUS
NMpathIng(
char	**name)
{
	static	char	t_Pathname[255] = "";
		char	*t_PathPtr;
		STATUS	status = OK;

	if ((t_PathPtr = NMgetenv(SystemLocationVariable)) == NULL)
	{
		status = NM_INGUSR;
	}
	else
	{
	    /* If the path is a rooted logical, overwrite the last ']' */
	    size_t l = STlength(t_PathPtr);
	    if (t_PathPtr[l - 2] == '.' && t_PathPtr[l - 1] == ']')
	    {
		t_PathPtr[l - 1] = EOS;
		STpolycat(3, t_PathPtr, SystemLocationSubdirectory, "]",
		    t_Pathname);
	    }
	    else
	    {
		t_PathPtr  = STpolycat(4, t_PathPtr, "[", 
				SystemLocationSubdirectory, "]",  t_Pathname);
	    }
	}

	*name = t_Pathname;

	return(status);
}
Exemple #18
0
/*
** Name: ParseHTMLVariables() - Entry point
**
** Description:
**
** Inputs:
**	ACT_PSESSION	active session
**	char*			var
**
** Outputs:
**
** Returns:
**	GSTATUS	:	GSTAT_OK
**
** Exceptions:
**	None
**
** Side Effects:
**	None
**
** History:
**      11-Sep-1998 (fanra01)
**          Separate declaration and initialisation for building on unix.
**      20-Aug-2003 (fanra01)
**          Additional output information if parse error encountered.
*/
GSTATUS 
ParseHTMLVariables(
	ACT_PSESSION act_session, 
	char *var) 
{
	GSTATUS err = GSTAT_OK;	
	if (var != NULL) 
	{
		PARSER_IN in;
		VAR_PARSER_OUT out;

		MEfill (sizeof(PARSER_IN), 0, (PTR)&in);
		in.first_node = FIRST_VARIABLE_NODE;
		in.buffer = var;
		in.length = STlength(var);
		
		MEfill (sizeof(VAR_PARSER_OUT), 0, (PTR)&out);
		out.act_session = act_session;
		out.HexProcessing = FALSE;
		out.type = WSM_ACTIVE;
		
		err = ParseOpen(Variable, &in, (PPARSER_OUT) &out);
		if (err == GSTAT_OK)
			err = Parse(Variable, &in, (PPARSER_OUT) &out);
		if (err == GSTAT_OK)
			err = ParseClose(Variable, &in, (PPARSER_OUT) &out);
        if (err != GSTAT_OK)
        {
            DDFStatusInfo( err, "Variable name = %s\n", var );
        }
	}
return(err);
}
Exemple #19
0
/*
** Name: apiprompt_func		For prompt Messages
**
** Description:
** 	Prompt callback function
**
** History:
**      03-Feb-99 (rajus01)
**          Created.
*/
static II_VOID 
apiprompt_func( IIAPI_PROMPTPARM *promptParm )
{

    SIfprintf( outputf, "\t===== Prompt Message =====\n" );

    STcopy(password, promptParm->pd_reply);
    promptParm->pd_rep_len = STlength( promptParm->pd_reply );
    promptParm->pd_rep_flags = 0;

    if ( verboseLevel > 1 )
    {
        SIfprintf( outputf, "\tpd_envHandle\t= 0x%lx\n",
					promptParm->pd_envHandle ); 
        SIfprintf( outputf, "\tpd_connHandle\t= 0x%lx\n",
					promptParm->pd_connHandle ); 
    }
    
    if( promptParm->pd_flags & IIAPI_PR_NOECHO )
 	SIfprintf( outputf, "\tpd_flags\t= IIAPI_PR_NOECHO \n" );
    if( promptParm->pd_flags & IIAPI_PR_TIMEOUT )
    {
 	SIfprintf( outputf, "\tpd_flags\t= IIAPI_PR_TIMEOUT \n" );
 	SIfprintf( outputf, "\tpd_timeout\t= %d\n", promptParm->pd_timeout );
    }

    SIfprintf( outputf, "\tpd_msg_len\t= %d\n", promptParm->pd_msg_len );
    SIfprintf( outputf, "\tpd_message\t= %s\n", promptParm->pd_message );
    SIfprintf( outputf, "\tpd_max_reply\t= %d\n", promptParm->pd_max_reply );

    SIfprintf( outputf, "\t=========================\n" );

    return;   
}
Exemple #20
0
static char *
saveloc(char	*path)
{
    char	*rval = NULL;
    char	ptmp[MAX_PATH_LEN + 2];

    if (STlength(path) > MAX_PATH_LEN)
    {
	i4 maxl = MAX_PATH_LEN;

	IIUGmsg(ERget(E_XF0130_Path_Too_Long), FALSE, 2, path, &maxl);

	/* Truncate and save */
	(void) STlcopy(path, ptmp, MAX_PATH_LEN);
	rval = STalloc(ptmp);
    }
    else
    {
	rval = STalloc(path);
    }

    /* Truncate and save */
    (void) STlcopy(path, ptmp, MAX_PATH_LEN);
    rval = STalloc(ptmp);

    return (rval);
}
Exemple #21
0
STATUS
MOlongout( STATUS errstat, i8 val, i4  destlen, char *dest )
{
    char bufa[ MO_MAX_NUM_BUF ];
    char bufb[ MO_MAX_NUM_BUF ];
    char *p;
    char *q;
    i4  padlen;
    
    bufa[0] = EOS;

    /* Ignore errors in CVla8 -- force to 0 */
    (void)CVla8( val, bufa );
    padlen = MAX_I8_DIGITS_AND_SIGN - (i4)STlength( bufa );

    p = bufb;
    q = bufa;
    /* put sign first, before pad */
    if( bufa[0] == '-' )
	*p++ = *q++;
    while( padlen-- > 0 )
	*p++ = '0';
    STcopy( q, p );
	
    return( MOstrout( errstat, bufb, destlen, dest ) );
}
Exemple #22
0
static i4
ns_keyword( char *token, KEYWORD_TBL *tbl )
{
    i4  keyword = INVALID_KEYWORD;

    for( ; tbl->full != NULL; tbl++ )
	if ( ! STbcompare( token, 0, tbl->abbr, STlength(tbl->abbr), TRUE )  &&
	     STlength( token ) <= STlength( tbl->full )  &&
	     ! STbcompare( token, STlength( token ), tbl->full, 0, TRUE ) )
	{
	    keyword = tbl->code;
	    break;
	}

    return( keyword );
}
Exemple #23
0
DB_STATUS
adu_uuid_to_char(
ADF_CB          *adf_scb,
DB_DATA_VALUE   *dv1,
DB_DATA_VALUE   *rdv)
{
    char		d[100];
    DB_STATUS		db_stat;
    UUID                u1;
    UUID                *uuid;

    /* Verify the operand is a UUID */
    if (dv1->db_datatype != DB_BYTE_TYPE)
    {
       db_stat = adu_error(adf_scb, E_AD9998_INTERNAL_ERROR, 2, 0 ,"uuid_to_char type");
       return(db_stat);
    }

    if ((ME_ALIGN_MACRO((PTR)dv1->db_data, sizeof(ALIGN_RESTRICT))
		!= (PTR)dv1->db_data) ||
		(dv1->db_length != sizeof(UUID)))
    {
	uuid = &u1;
	uuid_format(dv1, uuid);
    }
    else
	uuid = (UUID *)dv1->db_data;

    db_stat = IDuuid_to_string(uuid, d);

    if (db_stat = adu_movestring(adf_scb, (u_char *)d,(i4) STlength(d), dv1->db_datatype, rdv))
       return (db_stat);

    return(E_DB_OK);
}
Exemple #24
0
/*{
** Name: CS_destroy_serv_segment() - Destroy the server segment.
**
** Description:
**      Destroy the server shared memory segment.  This should be called when
**      server is shut down (ie. should be put into the last chance exception
**      handler of CS).
**
**      Eventually the abnormal exit code must take care of cleaning up this
**      shared memory segment.
**
**      This call is internal to CS is meant only to be called by CS, and may
**      only exist on unix systems supporting shared memory.
**
** Inputs:
**      id                              id of server segment.
**
** Outputs:
**      address                         on success, set to point to segment
**      err_code                        system dependent error information.
**
**      Returns:
**          E_DB_OK
**
**      Exceptions:
**          none
**
** Side Effects:
**          none
**
** History:
**      08-sep-88 (mmm)
**          First Version
**      12-jun-89 (rogerk)
**          Changed MEsmdestroy to take character memory key, not LOCATION ptr.
*/
STATUS
CS_destroy_serv_segment(u_i4 serv_seg_num, CL_ERR_DESC *err_code)
{
    STATUS      status = OK;
    char        segname[48];

    STcopy("server.", segname);
    CVna((i4)serv_seg_num, segname+STlength(segname));

#ifdef xCL_NEED_SEM_CLEANUP
        CS_cp_sem_cleanup(segname,err_code);
#endif
    status = MEsmdestroy(segname, err_code);
    if (status)
    {
        /* Unable to attach allocated shared memory segment. */
        status = FAIL;
    }

    Cs_sm_cb->css_servinfo[serv_seg_num].csi_in_use = FALSE;

    /* FIX ME - probably add code to update system control stuctures to
    ** keep track of when a shared memory segment is mapped.
    */

    return(status);
}
Exemple #25
0
char
*FIND_SEPstring(char *token,char *string)
{
    i4                     token_len ;
    i4                     string_len ;
    char                  *cp = NULL ;
    char                  *pp = NULL ;
    char                  *tp = NULL ;

    if (token == NULL || *token == EOS)
    {
        if (tracing&TRACE_PARM)
            SIfprintf(traceptr,ERx("FIND_SEPstring> token is null\n"));
        return (NULL);
    }
    if (string == NULL || *string == EOS)
    {
        if (tracing&TRACE_PARM)
            SIfprintf(traceptr,ERx("FIND_SEPstring> string is null\n"));
        return (NULL);
    }
    string_len = STlength(string);

    if ((token_len = STlength(token)) < string_len)
    {
        if (tracing&TRACE_PARM)
            SIfprintf(traceptr
                      ,ERx("FIND_SEPstring> token <%s> is too small (%d chars)\n")
                      ,token,token_len);

        return (NULL);
    }

    for (tp = token, cp = NULL, pp = NULL
                                     ; (*tp != EOS)&&(cp == NULL)&&(token_len-- >= string_len)
            ; CMnext(tp))
    {
        if ((STbcompare(tp, string_len, string, string_len, TRUE) == 0)
                &&((pp == NULL)||CMoper(pp)||CMwhite(pp)))
        {
            cp = tp;
        }
        pp = tp;
    }

    return (cp);
}
Exemple #26
0
/*
** Name: CS_cp_mbx_create	- mailbox creation and initialization
**
** Description:
**	This subroutine is called from CSinitiate().
**
**	It does the following:
**	    a) establishes a mailbox, with the name II_CPRES_xx_pid, where
**		xx is the (optional) installation code, and pid is the
**		process ID in hex.
**	    b) queues a read on the mailbox, with completion routine set to
**		CS_cp_mbx_complete
**	    c) deletes the mailbox, so it'll go away when the process dies.
**
** Inputs:
**	num_sessions    - Number of sessions for the process.
**
** Outputs:
**	sys_err		- reason for error
**
** Returns:
**	OK, !OK
**
** Side Effects:
**	Sets cpres_mbx_chan to the mailbox's channel
**	Defines the system-wide logical name II_CPRES_xx_pid
**
** History:
**	Summer, 1992 (bryanp)
**	    Working on the new portable logging and locking system.
**	08-Nov-2007 (jonj)
**	    Use of "num_sessions" is totally bogus. CS_cp_mbx_create() is called
**	    before the startup parms are determined from config.dat (where we'd
**	    find "connect_limit"), so SCD hard-codes num_sessions = 32, resulting
**	    in CS_CP_MIN_MSGS == 5 always being used, which is way too small.
**	    Instead, default to the (configurable) VMS sysgen parameter
**	    DEFMBXBUFQUO.
**	    Also, create mailbox as read-only. Writers will assign write-only
**	    channels.
*/
STATUS
CS_cp_mbx_create(i4 num_sessions, CL_ERR_DESC	*sys_err)
{
    struct	dsc$descriptor_s    name_desc;
    i4		vms_status;
    char	mbx_name[100];
    char	*inst_id;
    PID		pid;

    CL_CLEAR_ERR(sys_err);
    /*
    ** Build the mailbox logical name:
    */
    PCpid(&pid);
    NMgtAt("II_INSTALLATION", &inst_id);
    if (inst_id && *inst_id)
	STprintf(mbx_name, "II_CPRES_%s_%x", inst_id, (i4)pid);
    else
	STprintf(mbx_name, "II_CPRES_%x", (i4)pid);

    name_desc.dsc$a_pointer = mbx_name;
    name_desc.dsc$w_length = STlength(mbx_name);
    name_desc.dsc$b_dtype = DSC$K_DTYPE_T;
    name_desc.dsc$b_class = DSC$K_CLASS_S;

    vms_status = sys$crembx(
		1,		    /* Mailbox is "permanent" */
		&cpres_mbx_chan,    /* where to put channel */
		(i4)sizeof(CS_CP_WAKEUP_MSG),
				    /* maximum message size */
		0,		    /* buffer quota (DEFMBXBUFQUO) */
		0,		    /* prot mask = all priv */
		PSL$C_USER,	    /* acmode */
		&name_desc,	    /* logical name descriptor */
		CMB$M_READONLY,	    /* flags */
		0);		    /* nullarg */

    if ( vms_status != SS$_NORMAL )
    {
	sys_err->error = vms_status;
	if (vms_status == SS$_NOPRIV)
	    return (E_CS00F8_CSMBXCRE_NOPRIV);
	else
	    return (E_CS00F7_CSMBXCRE_ERROR);
    }

    /* Hang a read */
    cpres_q_read_io();

    /* Mark for deletion, so it disappears when we exit. */

    sys$delmbx(cpres_mbx_chan);

    cpres_channels_sem = 0;

    cpres_num_channels_assigned = 0;

    return (OK);
}
Exemple #27
0
STATUS
ERmsg_hdr( char *svr_id, SCALARP session, char *msg_header)
{
    char        host_name[65];
    i4		length;
    SYSTIME	stime;

    GChostname( host_name, sizeof( host_name ) );
    STprintf( msg_header, "%-8.8s::[%-16.16s, %08.8x]: ",
	host_name, svr_id, session );
    TMnow(&stime);
    TMstr(&stime,msg_header + STlength(msg_header));
    length = STlength(msg_header);
    msg_header[length++] = ' ';
    msg_header[length] = EOS;
    return (OK);
}
Exemple #28
0
bool
ask_for_conditional(WINDOW *askW,char edCAns)
{
    char                   cond_exp ;

    cond_exp  = EOS;
    if (conditional_str == NULL)
	conditional_str = SEP_MEalloc(SEP_ME_TAG_NODEL, TEST_LINE+1, TRUE,
				      (STATUS *) NULL);
    if (conditional_old == NULL)
	conditional_old = SEP_MEalloc(SEP_ME_TAG_NODEL, TEST_LINE+1, TRUE,
				      (STATUS *) NULL);
    if (conditional_prompt == NULL)
	conditional_prompt = SEP_MEalloc(SEP_ME_TAG_NODEL, TEST_LINE+1, TRUE,
					 (STATUS *) NULL);

    if ((*conditional_str == EOS) && (SEP_IF_EXPRESSION != NULL) &&
        (*SEP_IF_EXPRESSION != EOS))
	STcopy(SEP_IF_EXPRESSION, conditional_str);

    STcopy(conditional_str, conditional_old);
#ifdef NT_GENERIC
    STprintf(conditional_prompt,ERx(" IF (%s) >"),conditional_str);
#else
    STprintf(conditional_prompt,ERx("%s%s%s%s%s IF (%s) >%s"),REG_CHAR,
	     ATTR_OFF, PROMPT_POS, DEL_EOL, REV_VIDEO, conditional_str,
	     ATTR_OFF);
#endif

    if (edCAns == EOS)
	get_string(askW, conditional_prompt, conditional_str);

    if ((conditional_str == NULL) || (*conditional_str == EOS))
    {
	if (*conditional_old == EOS)
	{
	    if (edCAns == EOS)
		put_message(askW,
			    ERx("No conditional expression for this Canon."));
	    return (FALSE);
	}
	else
	{
	    STcopy(conditional_old, conditional_str);
	}
    }
    else if (STskipblank(conditional_str, STlength(conditional_str)) == NULL)
    {
	*conditional_str = EOS;
	*conditional_old = EOS;
	if (edCAns == EOS)
	    put_message(askW, ERx("No conditional expression for this Canon."));
	return (FALSE);
    }

    STpolycat(3, ERx(" IF ("), conditional_str, ERx(") "), conditional_prompt);
    return (TRUE);
}
Exemple #29
0
static STATUS
myintget( i4  offset,
	 i4  objsize,
	 PTR object,
	 i4  luserbuf,
	 char *userbuf )
{
    STATUS stat = OK;

    char buf[ 20 ];

    CVla( private_num, buf );
    STncpy( userbuf, buf, luserbuf ) ;
    userbuf[ luserbuf ] = EOS;
    if( STlength( buf ) != STlength( userbuf ) )
	stat = MO_VALUE_TRUNCATED;
    return( stat );
}
Exemple #30
0
void
FEapply_null(ADF_CB *cb, char *null)
{
    if ( (cb->adf_nullstr.nlst_string = STalloc(null)) == NULL )
    {
	EXsignal(EXFEBUG, 1, ERx("FEadfcb(alloc2)"));
    }
    cb->adf_nullstr.nlst_length = STlength(null);	    
}