本文整理汇总了C++中STprintf函数的典型用法代码示例。如果您正苦于以下问题:C++ STprintf函数的具体用法?C++ STprintf怎么用?C++ STprintf使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了STprintf函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CS_cp_mbx_create
/*
** 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);
}
示例2: qee_p1_dsh_gen
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);
}
示例3: qee_p4_ldb_qid
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);
}
示例4: scs_broadcast_mesg
/*
** 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;
}
示例5: qee_p0_prt_dsh
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);
}
示例6: ascs_chk_priv
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;
}
示例7: opc_eexatts
/*{
** Name: OPC_EEXCATTS - Build atts from eqcs that go to exchange
** buffer
**
** Description:
{@[email protected]}...
**
** Inputs:
[@[email protected]]...
**
** Outputs:
[@[email protected]]...
** Returns:
** {@[email protected]}
** Exceptions:
** [@[email protected]]
**
** Side Effects:
** [@[email protected]]
**
** 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.
[@[email protected]]...
*/
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;
}
示例8: main
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);
}