Example #1
0
void Time2Chars (double dSecond, char* buffer)
{
	char* p;
	char buff1[16];
	char buff2[16];
	int m = 0;
	int h = 0;
	while (dSecond >= 60.0)
	{
		dSecond -= 60.0;
		m++;
	}
	while (m >= 60)
	{
		m -= 60;
		h++;
	}
	dSecond = dSecond*100;
	STprintf(buff1, "%04d", (int)dSecond);
	STlcopy (buff1, buff2, 2);
	p = buff1;
	p += 2;
	STprintf (buffer, "%02d%:%02d:%s", h, m, buff2);

	STcat(buffer, ".");
	STcat(buffer, p);
}
Example #2
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);
}
Example #3
0
DB_STATUS
qee_p1_dsh_gen(
	QEF_RCB		*v_qer_p,
	QEE_DSH		*i_dsh_p)
{
    DB_STATUS	    status = E_DB_OK;
    QEF_QP_CB	    *qp_p = i_dsh_p->dsh_qp_ptr;    /* debugging aid */
    QEE_DDB_CB	    *dde_p = i_dsh_p->dsh_ddb_cb;
    char	    cur_name[DB_CURSOR_MAXNAME + 1];
    char	    *cbuf = v_qer_p->qef_cb->qef_trfmt;
    i4		    cbufsize = v_qer_p->qef_cb->qef_trsize;


    qed_u0_trimtail(i_dsh_p->dsh_qp_id.db_cur_name, DB_CURSOR_MAXNAME, cur_name);

    STprintf(cbuf, 
	"%s %p: ...    query id: %x %x %s\n",
	IIQE_61_qefsess,
	(PTR) v_qer_p->qef_cb,
	i_dsh_p->dsh_qp_id.db_cursor_id[0],
	i_dsh_p->dsh_qp_id.db_cursor_id[1],
	cur_name);
    qec_tprintf(v_qer_p, cbufsize, cbuf);

    if (i_dsh_p->dsh_qp_status & DSH_QP_LOCKED)
    {
 	STprintf(cbuf, 
	    "%s %p: ...     query plan LOCKED by this session\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    if (i_dsh_p->dsh_qp_status & DSH_QP_OBSOLETE)
    {
	STprintf(cbuf, 
	    "%s %p: ...     query plan is OBSOLETE; to be destroyed\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    if (i_dsh_p->dsh_qp_status & DSH_DEFERRED_CURSOR)
    {
	STprintf(cbuf, 
	    "%s %p: ...     query plan contains a DEFERRED cursor\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    if (i_dsh_p->dsh_positioned)
    {
	STprintf(cbuf, 
	    "%s %p: ...     cursor is positioned\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);
    }
    return(E_DB_OK);
}
Example #4
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);
}
Example #5
0
DB_STATUS
qee_p4_ldb_qid(
	QEF_RCB		*v_qer_p,
	QEE_DSH         *i_dsh_p)
{
/*
    DB_STATUS	    status = E_DB_OK;
    QES_DDB_SES	    *dds_p = & v_qer_p->qef_cb->qef_c2_ddb_ses;
    QEF_DDB_REQ     *ddr_p = & v_qer_p->qef_r3_ddb_req;
*/
    QEE_DDB_CB      *qee_p = i_dsh_p->dsh_ddb_cb;
    DB_CURSOR_ID    *ldb_qid_p = & qee_p->qee_d5_local_qid;
    char	    cur_name[DB_CURSOR_MAXNAME + 1];
    char	    *cbuf = v_qer_p->qef_cb->qef_trfmt;
    i4		    cbufsize = v_qer_p->qef_cb->qef_trsize;


    STprintf(cbuf, 
	"%s %p: ...the LDB query id:\n",
        IIQE_61_qefsess,
        (PTR) v_qer_p->qef_cb);
    qec_tprintf(v_qer_p, cbufsize, cbuf);

    STprintf(cbuf, 
	"%s %p: ...   1) DB_CURSOR_ID[0] %x,\n",
	IIQE_61_qefsess,
	(PTR) v_qer_p->qef_cb,
	ldb_qid_p->db_cursor_id[0]);
    qec_tprintf(v_qer_p, cbufsize, cbuf);

    STprintf(cbuf, 
	"%s %p: ...   2) DB_CURSOR_ID[1] %x,\n",
	IIQE_61_qefsess,
	(PTR) v_qer_p->qef_cb,
	ldb_qid_p->db_cursor_id[1]);
    qec_tprintf(v_qer_p, cbufsize, cbuf);

    qed_u0_trimtail(ldb_qid_p->db_cur_name, DB_CURSOR_MAXNAME, cur_name);

    STprintf(cbuf, 
	"%s %p: ...   3) DB_CUR_NAME     %s\n",
	IIQE_61_qefsess,
	(PTR) v_qer_p->qef_cb,
	cur_name);
    qec_tprintf(v_qer_p, cbufsize, cbuf);

    return(E_DB_OK);
}
Example #6
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 #7
0
/*{
** Name:	IIAG4fosFreeObjectStack - Free objects from the Known Obj stack
**
** Description:
**	Pop the Known object stack back to the specified size, which must be
**	non-negative and not more than the current stack size.   This marks
**	the objects as "unknown".  Also, reference count information can
**	be decremented in the previously known objects so that ABF run-time can
**	potentially free up memory (this step is skipped for now).
**
** Inputs:
**	reset_sp	{nat}		value to reset stackpointer to.
**
** Outputs:
**	NONE.
**
** Returns:
**	OK 			- object stack reset
**	E_G42726_NO_INIT	- stack was never initialized.
**	E_G42728_BAD_STACK_POP	- invalid stackpointer value (beyond current).
**
** History:
**	15-dec-92 (davel)
**		 Initial version.
*/
STATUS
IIAG4fosFreeObjectStack(i4 reset_sp)
{
    G4ERRDEF g4errdef;

    if (alloc_stacksize == 0)
    {
	g4errdef.errmsg = E_G42726_NO_INIT;
	g4errdef.numargs = 0;
	IIAG4semSetErrMsg(&g4errdef, TRUE);
	return E_G42726_NO_INIT;
    }
    else if (reset_sp < 0 || reset_sp > stackpointer)
    {
	/* this should never happen.  Show the current and reset stackpointers
	** in the error message.
	*/
	char buf[64];

	g4errdef.errmsg = E_G42728_BAD_STACK_POP;
	g4errdef.numargs = 1;
	STprintf(buf, "%d -> %d", stackpointer, reset_sp);
	g4errdef.args[0] = (PTR)buf;
	IIAG4semSetErrMsg(&g4errdef, TRUE);
	return E_G42728_BAD_STACK_POP;
    }
    else 
    {
	/* XXX just reset the stack for now; no reference count decrementing */
	stackpointer = reset_sp;
	return OK;
    }
}
Example #8
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));

}
Example #9
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 );
}
Example #10
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;
}
Example #11
0
static char *
er_decode( STATUS msg_id )
{
    STATUS old_err;
    STATUS errstat;
    CL_ERR_DESC err_code;
    i4  ret_len;
    char lbuf[ sizeof(ERbuf) ];

    if( msg_id == OK )
    {
	errstat = OK;
	STcopy( "OK", ERbuf );
    }
    else if ((errstat = ERslookup(msg_id,		/* msg num */
			    NULL,		/* input cl err */
			    0,			/* flags */
			    (char *) NULL,	/* sqlstate */
			    ERbuf,		/* buf */
			    sizeof(ERbuf),	/* sizeof buf */
			    -1,			/* language */
			    &ret_len,		/* msg len */
			    &err_code,		/* output err */
			    0,			/* num params */
			    NULL)		/* params */
	 ) != OK)
    {
	/* Recurse to decode ER error.  If we were processing error
	   already, give up to halt recursion */

	old_err = ERstat;	/* OK first time in */
	ERstat = errstat;	/* now not OK second time through */

	if( old_err == OK )
	    STcopy( lbuf, er_decode( errstat ) );
	else
	    STprintf(ERbuf, "ER err 0x%x", errstat );

	STprintf( ERbuf, "0x%x not found: %s", msg_id, lbuf ); 
    }

    /* Clear recursion check */
    ERstat = OK;

    return( ERbuf );
}
Example #12
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);
}
Example #13
0
/*{
** Name: ule_initiate	- Provide server constant info for the server header
**
** Description:
**      This routine takes in the server constant parameters SERVER NAME and
**      NODE NAME, placing them in an area which is easily found to place on 
**      all error messages.
**
** Inputs:
**      node_name                       Pointer to node name, which is
**      l_node_name                     characters long
**      server_name                     Same for server name
**      l_server_name
**
** Outputs:
**      None.
**	Returns:
**	    VOID
**	Exceptions:
**	    none
**
** Side Effects:
**	    none
**
** History:
**      06-Aug-1987 (fred)
**          Created.
**      21-Mar-2005 (mutma03)
**          cleanup of node translation code for clusters.
**	07-jan-2008 (joea)
**	    Undo 28-jun-2001 and 21-mar-2005 cluster nickname changes.
*/
VOID
ule_initiate( char *node_name, i4  l_node_name, char *server_name,
	      i4  l_server_name )
{
    PID proc_id;
    char fmt[20];

    if (Ule_started <= 0)
    {
        PCpid(&proc_id);
	
	MEfill(sizeof(ULE_MHDR), (u_char)' ', (PTR)&Ule_mhdr);	
	MEmove( l_node_name,
		(PTR)  node_name,
		(char) ' ',
		sizeof(Ule_mhdr.ule_node),
		(PTR)  &Ule_mhdr.ule_node[0]);
	MEmove(	l_server_name,
		(PTR)  server_name,
		(char) ' ',
		sizeof(Ule_mhdr.ule_server),
		(PTR)  &Ule_mhdr.ule_server[0]);
	MEfill(	sizeof(Ule_mhdr.ule_session),
		(u_char) '*',
		(PTR)  &Ule_mhdr.ule_session[0]);
	Ule_mhdr.ule_pad1[0] = ':',
	    Ule_mhdr.ule_pad1[1] = ':',
	    Ule_mhdr.ule_pad1[2] = '['; 	
	Ule_mhdr.ule_pad2[0] = ',',
	    Ule_mhdr.ule_pad2[1] = ' '; 	
        STprintf( fmt, "%s", PIDFMT );
        STprintf(Ule_mhdr.ule_pid, fmt, proc_id);
        Ule_mhdr.ule_pad3[0] = ',',
	Ule_mhdr.ule_pad3[1] = ' ';
	Ule_mhdr.ule_pad4[0] = ',';
	Ule_mhdr.ule_pad4[1] = ' ';
	MEfill(	sizeof(Ule_mhdr.ule_source),
		(char) ' ',
		(PTR) &Ule_mhdr.ule_source[0]);
	Ule_mhdr.ule_pad5[0] = ']',
	    Ule_mhdr.ule_pad5[1] = ':',
	    Ule_mhdr.ule_pad5[2] = ' '; 	
	Ule_started = 1;
    }
}
Example #14
0
/*{
** Name: opx_rerror	- this routine will report an optimizer error
**
** Description:
**      This routine will log an optimizer error.  
**
** Inputs:
**      opfcb                           ptr to caller's control block
**      error                           optimizer error code to log
**
** Outputs:
**	Returns:
**	    VOID
**	Exceptions:
**	    none
**
** Side Effects:
**	    none
**
** History:
**	3-jul-86 (seputis)
**          initial creation
**	21-may-89 (jrb)
**	    now passes generic error to opx_sccerror
**	24-oct-92 (andre)
**	    interfaces of ule_format() and opx_sccerror() have been changed to
**	    receive (DB_SQLSTATE *)
**	24-june-03 (inkdo01)
**	    Add OP04C0 to list for which error is NOT returned to user.
**	22-june-06 (dougi)
**	    Make E_OP0018 (timeoutabort) go to log where the query text also
**	    gets dumped.
**	24-jun-08 (hayke02)
**	    Treat E_OP04C1 like E_OP04C0: soft failure, error reported to
**	    errlog.log and retry using non-greedy enumeration, unless op247 is
**	    set.
[@history_line@]...
*/
VOID
opx_rerror(
	OPF_CB             *opfcb,
	OPX_ERROR          error)
{
    DB_STATUS	    ule_status;		/* return status from ule_format */
    i4         ule_error;          /* ule cannot format message */
    char	    msg_buffer[DB_ERR_SIZE]; /* error message buffer */
    i4         msg_buf_length;     /* length of message returned */
    i4         log;                /* should this error be logged */
    DB_SQLSTATE	    sqlstate;
    bool	enumnomsg = FALSE;

    opfcb->opf_errorblock.err_code = error; /* save error code */

    if ((error % 256) < 128 && error != E_OP0018_TIMEOUTABORT)
	log = ULE_LOOKUP;
    else
	log = ULE_LOG;

    ule_status = ule_format( error,  (CL_SYS_ERR *)NULL, log, &sqlstate,
	msg_buffer, (i4) (sizeof(msg_buffer)-1), &msg_buf_length,
	&ule_error, 0);
    if (ule_status != E_DB_OK)
    {
        (VOID)STprintf(msg_buffer, 
	    "ULE error = %x, Optimizer message cannot be found - error no. = %x\n", 
	    ule_error, error );
    }
    else
	msg_buffer[msg_buf_length] = 0;	/* null terminate */
    if ((error == E_OP04C0_NEWENUMFAILURE)
	||
	(error == E_OP04C1_GREEDYCONSISTENCY))
    {
	OPS_CB              *opscb;
	OPS_STATE	*global;
	i4	temp;

	/* Check if new enumeration is result of tp op247 - if not, 
	** message isn't displayed. */
	opscb = ops_getcb();
	global = opscb->ops_state;
	if (!global->ops_cb->ops_check ||
	    !opt_svtrace( global->ops_cb, OPT_F119_NEWENUM, &temp, &temp))
	 enumnomsg = TRUE;
    }
    if (error != E_OP0003_ASYNCABORT && !enumnomsg)
					    /* do not report control C errors
					    ** or "new enumeration" errors
					    ** to the user */
    {
	(VOID) opx_sccerror(E_DB_ERROR, &sqlstate, error, msg_buffer,
						(i4)msg_buf_length);
    }
}
Example #15
0
VOID
history_time(char *timeStr)
{
    SYSTIME                atime ;
    struct TMhuman         htime ;

    TMnow(&atime);
    TMbreak(&atime, &htime);
    STprintf(timeStr, ERx("%s-%s-%s"), htime.day, htime.month, htime.year);
}
Example #16
0
VOID
copyright_year(char *year)
{
	SYSTIME		atime ;
	struct TMhuman	htime ;

	TMnow(&atime);
	TMbreak(&atime, &htime);
	STprintf(year, ERx("%s"), htime.year);

}
Example #17
0
static void
show( char *classid, 
     char *instance, 
     char *sval, 
     i4  perms,
     PTR arg )
{
    char classidbuf[ MAXCLASSID + MAXINSTANCE + 1 ];

    STprintf( classidbuf, "%s:%s:", classid, instance );
    SIprintf(classidbuf, "%-50s '%-12s'\t0%o\n", classidbuf, sval, perms );
}
Example #18
0
STATUS
gcn_request( char *gcn_host, i4  *assoc_no, i4 *protocol )
{
    GCA_RQ_PARMS	request;
    STATUS		status = OK;
    char		tbuff[ GC_HOSTNAME_MAX + 12 ];
    char		*target;
    i4			len;

    /* 
    ** Prepare for GCA_REQUEST service call 
    */
    len = (gcn_host ? STlength( gcn_host ) + 2 : 0) + 10;
    target = (len <= sizeof( tbuff )) 
    	     ? tbuff : (char *)MEreqmem( 0, len, FALSE, NULL );

    if ( ! target )  return( E_GC0013_ASSFL_MEM );

    STprintf( target, "%s%s/IINMSVR", 
	      gcn_host ? gcn_host : "", gcn_host ? "::" : "" );

    MEfill( sizeof( request ), '\0', (PTR)&request );
    request.gca_peer_protocol = GCA_PROTOCOL_LEVEL_63;
    request.gca_partner_name = target;

    /* 
    ** Make GCA_REQUEST service call 
    */
    gca_call( &gcn_gca_cb, GCA_REQUEST, (GCA_PARMLIST *)&request,
	      GCA_SYNC_FLAG, NULL, GCN_RCV_TIMEOUT, &status );

    gcn_checkerr( "GCA_REQUEST", 
		  &status, request.gca_status, &request.gca_os_status );

    if ( status != OK )  goto done;

    if ( gcn_host  &&  request.gca_peer_protocol < GCA_PROTOCOL_LEVEL_50 )
    {
        gcn_release( request.gca_assoc_id );
	CL_CLEAR_ERR( &request.gca_os_status );
	gcn_checkerr( "GCA_REQUEST", 
		      &status, E_GC000A_INT_PROT_LVL, &request.gca_os_status );
	goto done;
    }

    *assoc_no = request.gca_assoc_id;
    *protocol = request.gca_peer_protocol;

  done :

    if ( target != tbuff )  MEfree( (PTR)target );
    return( status );
}
Example #19
0
/*
** Name: sc0a_qrytext_data(), write query text parameters in one or more 
**	segments to the audit log.
**
** Description:
**	This routine is an interface to SXF to write audit records
**	from SCF. 
**
** Inputs:
**	scb		SCB
**
**	num_data	Number of data elements
**
**	qrydata		query data to be audited
**
** Outputs:
**	Returns:
**	    E_DB_OK
**	    E_DB_ERROR
**	Exceptions:
**	    none
**
** Side Effects:
**	    none
**
** History:
**	6-jul-93 (robf)
**		Created.
*/
DB_STATUS
sc0a_qrytext_data(
	SCD_SCB *scb,
	i4	num_data,
	DB_DATA_VALUE **qrydata
)
{
	i4		i;
	DB_DATA_VALUE   *dbv;
	char		namebuf[DB_MAXNAME+1];
	DB_STATUS	status=E_DB_OK;
	
	if (!(Sc_main_cb->sc_capabilities & SC_C_C2SECURE))
	{
		/*
		**	This is not a C2 server so can just return
		*/
		return E_DB_OK;
	}
	if (!(scb->scb_sscb.sscb_facility & (1 << DB_SXF_ID)))
	{
		/*
		**	SXF not initialized yet so quietly return,
		*/
		return E_DB_OK;
	}
	if (!(scb->scb_sscb.sscb_ics.ics_rustat&DU_UAUDIT_QRYTEXT))
	{
		/*
		** Session doesn't have query text auditing so don't audit
		*/
		return E_DB_OK;
	}
	/*
	** Loop over all data items formatting as parameters
	*/
	for( i=0; i<num_data; i++)
	{
		dbv=qrydata[i];
		STprintf(namebuf,"Param %d",i+1);
		status=sc0a_qrytext_param(scb, 
				namebuf, 
				STlength(namebuf),
				dbv);
		if(status!=E_DB_OK)
			break;
	}
	return status;
}
Example #20
0
DB_STATUS
qee_p0_prt_dsh(
	QEF_RCB		*v_qer_p,
	QEE_DSH		*i_dsh_p)
{
    DB_STATUS	    status = E_DB_OK;
    QEF_CB	    *qecb_p = v_qer_p->qef_cb;
    char	    *cbuf = v_qer_p->qef_cb->qef_trfmt;
    i4		    cbufsize = v_qer_p->qef_cb->qef_trsize;


    if (TRUE)
	return(E_DB_OK);

    STprintf(cbuf, 
	"%s %p: ...1.1) Generic DSH information\n",
	IIQE_61_qefsess,
	(PTR) v_qer_p->qef_cb);
    qec_tprintf(v_qer_p, cbufsize, cbuf);

    status = qee_p1_dsh_gen(v_qer_p, i_dsh_p);
    if (status)
	return(status);

    if (qecb_p->qef_c1_distrib & DB_3_DDB_SESS) 
    {
	STprintf(cbuf, 
	    "%s %p: ...1.2) DDB-specific DSH information\n",
	    IIQE_61_qefsess,
	    (PTR) v_qer_p->qef_cb);
        qec_tprintf(v_qer_p, cbufsize, cbuf);

	status = qee_p2_dsh_ddb(v_qer_p, i_dsh_p);
    }
    return(status);
}
Example #21
0
bool
ascs_chk_priv( char *user_name, char *priv_name )
{
	char	pmsym[128], userbuf[DB_OWN_MAXNAME+1], *value, *valueptr ;
	char	*strbuf = 0;
	int	priv_len;

        /* 
        ** privileges entries are of the form
        **   ii.<host>.*.privilege.<user>:   SERVER_CONTROL,NET_ADMIN,...
	**
	** Currently known privs are:  SERVER_CONTROL,NET_ADMIN,
	**  	    MONITOR,TRUSTED
        */

	STlcopy( user_name, userbuf, DB_OWN_MAXNAME );
	STtrmwhite( userbuf );
	STprintf(pmsym, "$.$.privileges.user.%s", userbuf);
	
	/* check to see if entry for given user */
	/* Assumes PMinit() and PMload() have already been called */

	if( PMget(pmsym, &value) != OK )
	    return FALSE;
	
	valueptr = value ;
	priv_len = STlength(priv_name) ;

	/*
	** STindex the PM value string and compare each individual string
	** with priv_name
	*/
	while ( *valueptr != EOS && (strbuf=STindex(valueptr, "," , 0)))
	{
	    if (!STscompare(valueptr, priv_len, priv_name, priv_len))
		return TRUE ;

	    /* skip blank characters after the ','*/	
	    valueptr = STskipblank(strbuf+1, 10); 
	}

	/* we're now at the last or only (or NULL) word in the string */
	if ( *valueptr != EOS  && 
              !STscompare(valueptr, priv_len, priv_name, priv_len))
		return TRUE ;

	return FALSE;
}
Example #22
0
/*
**  close_log
*/
STATUS
close_log()
{
    STATUS                 ret_val = OK ;
    SYSTIME                atime ;
    char                   buffer [TEST_LINE] ;
    char                   timestr [TEST_LINE] ;

    append_line((char *)ERx("\n"),(i4)1);
    TMnow(&atime);
    TMstr(&atime,timestr);
    STprintf(buffer,ERx("Ending at: %s"),timestr);
    append_line(buffer,1);
    SIclose(logptr);

    return (ret_val);
}
Example #23
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);
}
Example #24
0
/* we need to use the shortest unique subset of the 
** VMS pid for identifying temp files because of
** name length problems.  -tw 
*/
void
PCunique(
char	*numb)
{
	static	char	uniq_str[8] = "\0";
	static	bool	got_uniq = FALSE;
	PID	numbuf;

	if (!got_uniq)
	{
		PCpid(&numbuf);
		numbuf &= 0177777;	/* lower half is unique in VMS V3.x */
		STprintf(uniq_str, "%x", numbuf);
		got_uniq = TRUE;
	}
	STcopy(uniq_str, numb);
}
Example #25
0
/*{
** Name: OPC_EEXCATTS	- Build atts from eqcs that go to exchange
**			buffer
**
** Description:
{@comment_line@}...
**
** Inputs:
[@PARAM_DESCR@]...
**
** Outputs:
[@PARAM_DESCR@]...
**	Returns:
**	    {@return_description@}
**	Exceptions:
**	    [@description_or_none@]
**
** Side Effects:
**	    [@description_or_none@]
**
** History:
**      13-nov-03 (inkdo01)
**	    Written for parallel query processing (cloned from opcsorts.c).
**	7-Apr-2004 (schka24)
**	    Set attr default stuff just in case someone looks at it.
[@history_template@]...
*/
static VOID
opc_eexatts(
	OPS_STATE	*global,
	OPE_BMEQCLS	*eeqcmp,
	OPC_EQ		*ceq,
	DMF_ATTR_ENTRY	***patts,    /* ptr to a ptr to an array of ptrs 
					to atts */
	i4		*pacount )
{
    OPS_SUBQUERY	*subqry = global->ops_cstate.opc_subqry;
    DMF_ATTR_ENTRY	**atts;
    DMF_ATTR_ENTRY	*att;
    i4			attno;
    OPZ_AT		*at = global->ops_cstate.opc_subqry->ops_attrs.opz_base;
    OPE_IEQCLS		eqcno;

    *pacount = BTcount((char *)eeqcmp, (i4)subqry->ops_eclass.ope_ev);
    if (*pacount == 0)
	return;		/* count(*) or sommat - no atts to materialize */
    atts = (DMF_ATTR_ENTRY **) opu_qsfmem(global, 
	*pacount * sizeof (DMF_ATTR_ENTRY *));

    for (attno = 0, eqcno = -1;
	    (eqcno = BTnext((i4)eqcno, (char *)eeqcmp, 
		(i4)subqry->ops_eclass.ope_ev)) != -1;
	    attno += 1
	)
    {
	att = (DMF_ATTR_ENTRY *) opu_qsfmem(global, sizeof (DMF_ATTR_ENTRY));

	STprintf(att->attr_name.db_att_name, "a%x", eqcno);
	STmove(att->attr_name.db_att_name, ' ', 
		sizeof(att->attr_name.db_att_name), att->attr_name.db_att_name);
	att->attr_type = ceq[eqcno].opc_eqcdv.db_datatype;
	att->attr_size = ceq[eqcno].opc_eqcdv.db_length;
	att->attr_precision = ceq[eqcno].opc_eqcdv.db_prec;
	att->attr_flags_mask = 0;
	SET_CANON_DEF_ID(att->attr_defaultID, DB_DEF_NOT_DEFAULT);
	att->attr_defaultTuple = NULL;

	atts[attno] = att;
    }

    *patts = atts;
}
Example #26
0
/*{
** Name: II_GetErrorMessage
**
** Description:
**      Returns the associated error message for the error status.
**
** Inputs:
**      status      Error status.
**      errmsg      Area to be updated with message text.  The maximum length,
**                  in octets, of a returned message is MAX_IIERR_LEN and
**                  does not include the end-of-string marker.
**                  The minimum size of this area should be
**                  (MAX_IIERR_LEN + 1).
**
** Outputs:
**      errmsg      Error text.  If the message text exceeds MAX_IIERR_LEN
**                  then the message is truncated to MAX_IIERR_LEN.
**
** Returns:
**      None.
**
** Example:
**  # include "tngapi.h"
**
**  II_CHAR errmsg[ MAX_IIERR_LEN + 1] = {'\0'};
**  II_INT  status = II_NULL_PARAM;
**
**  II_GetErrorMessage( status, errmsg );
**  printf( "Error message =%s\n", errmsg );
**
** History:
**      24-Jun-2002 (fanra01)
**          Created.
**
}*/
void
II_GetErrorMessage( II_UINT4 status, char* errmsg )
{
    char errormessage[ MAX_IIERR_LEN + 1 ] = { 0 };
#if defined(NT_GENERIC)
    char* p = errormessage;
    int  nlen = 0;

    if (errmsg)
    {
        if (hModule == NULL)
        {
            hModule =  GetModuleHandle( II_MODULENAME );
        }
        if (hModule != NULL)
        {
            FormatMessage(
                FORMAT_MESSAGE_FROM_SYSTEM |
                FORMAT_MESSAGE_FROM_HMODULE |
                FORMAT_MESSAGE_IGNORE_INSERTS,
                (LPCVOID)hModule,
                status,
                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
                (LPTSTR) errormessage,
                MAX_IIERR_LEN,
                NULL
            );
            STlcopy( errormessage, errmsg, MAX_IIERR_LEN );
        }
    }

#else   /* NT_GENERIC */
 
    /* Here is for Unix platforms , Send back error message to the caller */

    if( status != OK )
     {
      STprintf( errormessage, ERget(status) );
      SIfprintf( stderr,  errormessage );
      STlcopy( errormessage, errmsg, STlength(errormessage) );
     }

#endif 
    return;
}
Example #27
0
void
main(int argc, char *argv[])
{
#define 	MAXBUF	4095

	char 	buf[ MAXBUF+1 ];
	int	iarg, ibuf, ichr;

	/*
	 *	Put the program name and first parameter in the buffer.
	 */
	STprintf(buf, ERx( "dmfjsp relocdb" ));

	switch(argc)
	{
	    case 1:
		break;

		/*
		 *	Append any args from the command line, e.g., 
		 *		dmfjsp relocdb -new_ckp_location dbname
		 */
	    default:
		ibuf = sizeof(ERx("dmfjsp relocdb")) - 1;
		for (iarg = 1; (iarg < argc) && (ibuf < MAXBUF); iarg++) {
		    buf[ibuf++] = ' ';
		    for (ichr = 0; 
		    	 (argv[iarg][ichr] != '\0') && (ibuf < MAXBUF); 
		    	 ichr++, ibuf++)
		    	buf[ibuf] = argv[iarg][ichr];
		}
		buf[ibuf] = '\0';
	}

	/*
	 *	Execute the command.
	 */
	if( PCexec_suid(&buf) != OK )
	    PCexit(FAIL);

	PCexit(OK);
}
Example #28
0
void
main(int argc, char *argv[])
{

	char 	buf[ MAXBUF+1 ];
	int	ibuf, ichr;

	/*
	**	Set the set command.
	*/
	STprintf(buf, ERx( "@set " ));

	switch(argc)
	{
		/*
		**	Construct the rest of the command from the 
		** 	command line argument and standard input.
		*/ 
	    case 2:
		ibuf = sizeof(ERx("@set ")) - 1;
		for ( ichr = 0 ;(ibuf < MAXBUF) && argv[1][ichr]; )
		{
			buf[ibuf++] = argv[1][ichr++];
		}	
		buf[ibuf++] = '=';
		/*
		** Set EOS in case there is nothing from standard input.
		*/
		buf[ibuf] = '\0';
		SIgetrec(&buf[ibuf], MAXBUF-ibuf, stdin);
		break;

	    default:
	    	SIprintf(stderr,"echo Usage: ipsetp variable_name"); 
		break;
	}

	/*
	**	Print out the set command.
	*/
	SIprintf("%s\n",buf);
}
Example #29
0
void
main(int argc, char *argv[])
{
#define 	MAXBUF	4095

	char 	buf[ MAXBUF+1 ];
	int		iarg, ibuf, ichr;

	/*
	 *	Put the program name and first parameter in the buffer.
	 */
	STprintf(buf, ERx( "esqlc -cplusplus -extension=cpp" ));

	switch(argc)
	{
	    case 1:
		break;

		/*
		 *	Append any args from the command line, e.g., 
		 *		esqlc -cplusplus -extension=EXT [files]
		 */
	    default:
		ibuf = sizeof(ERx("esqlc -cplusplus -extension=cpp")) - 1;
		for (iarg = 1; (iarg < argc) && (ibuf < MAXBUF); iarg++) {
		    buf[ibuf++] = ' ';
		    for (ichr = 0; 
		    	 (argv[iarg][ichr] != '\0') && (ibuf < MAXBUF); 
		    	 ichr++, ibuf++)
		    	buf[ibuf] = argv[iarg][ichr];
		}
		buf[ibuf] = '\0';
	}

	/*
	 *	Execute the command.
	 */
	if( execute(buf) != OK )
	    PCexit(FAIL);

	PCexit(OK);
}
Example #30
0
void
rfapi_getDateTime( char *dtbuf )
{
    SYSTIME	tm; /* system time in seconds */
    struct TMhuman	dthuman; /* human readable date and time structure */

    /* get the system time */
    TMnow( &tm );

    /* break it up into human readable format */
    TMbreak( &tm, &dthuman );

    STprintf( dtbuf, RFAPI_DATE_FORMAT,
		dthuman.wday,
		dthuman.month,
		dthuman.day,
		dthuman.hour,
		dthuman.mins,
		dthuman.sec,
		dthuman.year );
}