本文整理汇总了C++中STlength函数的典型用法代码示例。如果您正苦于以下问题:C++ STlength函数的具体用法?C++ STlength怎么用?C++ STlength使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了STlength函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: Val_Value
/*
** 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);
}
示例3: gwsxachkrcb
/*
** 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 );
}
示例4: WTSOpenUpLoad
/*
** 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);
}
示例5: ascs_avformat
/*
** 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.
[@[email protected]]...
*/
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);
}
示例6: sxf_set_activity
/*
** 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);
}
}
示例7: GM_mk_conn_instance
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 );
}
示例8: psl_lm2_setlockkey
/*
** 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);
}
示例9: ParseHTMLVariables
/*
** 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);
}
示例10: 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);
}