本文整理汇总了C++中check_id函数的典型用法代码示例。如果您正苦于以下问题:C++ check_id函数的具体用法?C++ check_id怎么用?C++ check_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: do_test
static int
do_test (int argc, char *argv[])
{
int result = 0;
utmpname (name);
result |= do_init ();
result |= do_check ();
result |= simulate_login ("tty1", "erwin");
result |= do_check ();
result |= simulate_login ("ttyp1", "paul");
result |= do_check ();
result |= simulate_logout ("tty2");
result |= do_check ();
result |= simulate_logout ("ttyp0");
result |= do_check ();
result |= simulate_login ("ttyp2", "richard");
result |= do_check ();
result |= check_login ("tty1");
result |= check_logout ("ttyp0");
result |= check_id ("p1");
result |= check_id ("2");
result |= check_id ("si");
result |= check_type (BOOT_TIME);
result |= check_type (RUN_LVL);
return result;
}
开发者ID:jameshilliard,项目名称:WECB-BH-GPL,代码行数:35,代码来源:tst-utmp.c
示例2: cfg_
unit_type::unit_type(const config &cfg, const std::string & parent_id) :
cfg_(cfg),
unit_cfg_(),
built_unit_cfg_(false),
id_(cfg_.has_attribute("id") ? cfg_["id"].str() : parent_id),
debug_id_(),
base_id_(!parent_id.empty() ? parent_id : id_),
type_name_(cfg_["name"].t_str()),
description_(),
hitpoints_(0),
hp_bar_scaling_(0.0),
xp_bar_scaling_(0.0),
level_(0),
recall_cost_(),
movement_(0),
vision_(-1),
jamming_(0),
max_attacks_(0),
cost_(0),
usage_(),
undead_variation_(),
image_(cfg_["image"].str()),
icon_(),
small_profile_(),
profile_(),
flag_rgb_(cfg_["flag_rgb"].str()),
num_traits_(0),
gender_types_(),
variations_(),
default_variation_(cfg_["variation"]),
variation_name_(cfg_["variation_name"].t_str()),
race_(&unit_race::null_race),
alpha_(ftofxp(1.0)),
abilities_(),
adv_abilities_(),
ability_tooltips_(),
adv_ability_tooltips_(),
zoc_(false),
hide_help_(false),
do_not_list_(cfg_["do_not_list"].to_bool(false)),
advances_to_(),
experience_needed_(0),
in_advancefrom_(false),
alignment_(unit_type::ALIGNMENT::NEUTRAL),
movement_type_(),
possible_traits_(),
genders_(),
animations_(),
build_status_(NOT_BUILT)
{
check_id(id_);
check_id(base_id_);
gender_types_[0] = nullptr;
gender_types_[1] = nullptr;
}
开发者ID:PoignardAzur,项目名称:wesnoth,代码行数:55,代码来源:types.cpp
示例3: inst_put_obj
static VALUE
inst_put_obj(VALUE self, VALUE arg, const char *field)
{
struct ngraph_instance *inst1, *inst2;
ngraph_value str;
char buf[128];
const char *name, *ptr;
int *ids;
struct objlist *obj;
switch (TYPE(arg)) {
case T_NIL:
ptr = NULL;
break;
case T_STRING:
ptr = StringValueCStr(arg);
obj = ngraph_get_object_instances_by_str(ptr, NULL, &ids);
if (obj == NULL) {
rb_raise(rb_eArgError, "%s#%s: illegal instance representation (%s).", rb_obj_classname(self), field, ptr);
}
ngraph_free(ids);
break;
default:
if (! rb_obj_is_kind_of(arg, NgraphClass)) {
rb_raise(rb_eArgError, "%s#%s: illegal type of the argument (%s).", rb_obj_classname(self), field, rb_obj_classname(arg));
}
inst2 = check_id(arg);
if (inst2 == NULL) {
return Qnil;
}
name = ngraph_get_object_name(inst2->obj);
#if 0
snprintf(buf, sizeof(buf), "%s:%d", name, inst2->id);
#else
snprintf(buf, sizeof(buf), "%s:^%d", name, inst2->oid); /* shoud instance be tighten? */
#endif
ptr = buf;
}
inst1 = check_id(self);
if (inst1 == NULL) {
return Qnil;
}
str.str = ptr;
inst1->rcode = ngraph_object_put(inst1->obj, field, inst1->id, &str);
if (inst1->rcode < 0) {
return Qnil;
}
return arg;
}
开发者ID:htrb,项目名称:ngraph-gtk,代码行数:54,代码来源:ngraph.c
示例4: req_key_h
bool req_key_h(connection_t *c) {
char from_name[MAX_STRING_SIZE];
char to_name[MAX_STRING_SIZE];
node_t *from, *to;
if(sscanf(c->buffer, "%*d " MAX_STRING " " MAX_STRING, from_name, to_name) != 2) {
logger(LOG_ERR, "Got bad %s from %s (%s)", "REQ_KEY", c->name,
c->hostname);
return false;
}
if(!check_id(from_name) || !check_id(to_name)) {
logger(LOG_ERR, "Got bad %s from %s (%s): %s", "REQ_KEY", c->name, c->hostname, "invalid name");
return false;
}
from = lookup_node(from_name);
if(!from) {
logger(LOG_ERR, "Got %s from %s (%s) origin %s which does not exist in our connection list",
"REQ_KEY", c->name, c->hostname, from_name);
return true;
}
to = lookup_node(to_name);
if(!to) {
logger(LOG_ERR, "Got %s from %s (%s) destination %s which does not exist in our connection list",
"REQ_KEY", c->name, c->hostname, to_name);
return true;
}
/* Check if this key request is for us */
if(to == myself) { /* Yes, send our own key back */
if (!send_ans_key(from))
return false;
} else {
if(tunnelserver)
return true;
if(!to->status.reachable) {
logger(LOG_WARNING, "Got %s from %s (%s) destination %s which is not reachable",
"REQ_KEY", c->name, c->hostname, to_name);
return true;
}
send_request(to->nexthop->connection, "%s", c->buffer);
}
return true;
}
开发者ID:95ulisse,项目名称:tinc,代码行数:52,代码来源:protocol_key.c
示例5: load_all_nodes
void load_all_nodes(meshlink_handle_t *mesh) {
DIR *dir;
struct dirent *ent;
char dname[PATH_MAX];
snprintf(dname,PATH_MAX, "%s" SLASH "hosts", mesh->confbase);
dir = opendir(dname);
if(!dir) {
logger(mesh, MESHLINK_ERROR, "Could not open %s: %s", dname, strerror(errno));
return;
}
while((ent = readdir(dir))) {
if(!check_id(ent->d_name))
continue;
node_t *n = lookup_node(mesh, ent->d_name);
if(n)
continue;
n = new_node();
n->name = xstrdup(ent->d_name);
node_read_devclass(mesh, n);
node_add(mesh, n);
}
closedir(dir);
}
开发者ID:meshlink,项目名称:meshlink,代码行数:28,代码来源:net_setup.c
示例6: server
void
server(struct sockaddr_un *sun)
{
int s, fd;
struct sockaddr_storage client_addr;
socklen_t client_len;
char *problem;
s = socket(AF_UNIX, SOCK_STREAM, 0);
if (s == -1)
err(1, "Bad socket");
if (bind(s, (struct sockaddr *)sun, sizeof(*sun)) != 0)
err(1, "bind");
if (listen(s, 5) != 0) {
unlink(path);
rmdir(dir);
err(1, "listen");
}
fd = accept(s, (struct sockaddr *)&client_addr, &client_len);
if (fd == -1) {
unlink(path);
rmdir(dir);
err(1, "accept");
}
problem = check_id(fd);
if (problem) {
unlink(path);
rmdir(dir);
errx(1, problem);
}
unlink(path);
rmdir(dir);
}
开发者ID:appleorange1,项目名称:bitrig,代码行数:34,代码来源:getpeereid_test.c
示例7: client
void
client(struct sockaddr_un *sun)
{
int s;
int i;
int r;
char *problem;
s = socket(AF_UNIX, SOCK_STREAM, 0);
if (s == -1)
err(1, "Bad socket");
/* XXX make sure the server started alright */
for (i = 0; i < 10; i++) {
r = connect(s, (struct sockaddr *)sun, sizeof(*sun));
if (r == 0) {
problem = check_id(s);
if (problem)
errx(1, problem);
exit(0);
}
sleep(5);
}
errx(1, "Could not connect after 10 tries");
}
开发者ID:appleorange1,项目名称:bitrig,代码行数:25,代码来源:getpeereid_test.c
示例8: cmdScanSensor
int cmdScanSensor(CLISESSION *pSession, int argc, char **argv, void *pHandler)
{
EUI64 id;
int idx=0;
int major=0, minor=0, build=0;
if (!Confirm(pSession, MSG_DEFAULT))
return CLIERR_OK;
CIF4Invoke invoke("127.0.0.1", m_nLocalAgentPort, 50*60);
if(check_id(NULL, argv[idx])) { // EUI64 ID
StrToEUI64(argv[idx], &id);
invoke.AddParamFormat("4.3.1", VARSMI_EUI64, (void *)&id, sizeof(EUI64));
}else { // Parser
invoke.AddParam("1.11", argv[idx]);
}
idx ++;
if(argc > 1) {
major = minor = 0;
sscanf(argv[idx],"%d.%d", &major, &minor);
invoke.AddParam("1.5",(WORD) (((major & 0xff) << 8) + (minor & 0xff)));
idx++;
}
if(argc > 2) {
build = (int) strtol(argv[idx],(char **)NULL,10);
invoke.AddParam("1.5",(WORD)build);
idx++;
}
if (!CLIAPI_Command(pSession, invoke.GetHandle(), "102.35"))
return CLIERR_OK;
return CLIERR_OK;
}
开发者ID:bearxiong99,项目名称:new_swamm,代码行数:35,代码来源:cmd_default.cpp
示例9: create_obj_arg
static VALUE
create_obj_arg(VALUE args)
{
int i, n;
VALUE arg, str, uniq_args;
struct ngraph_instance *inst;
struct objlist *obj = NULL;
const char *name;
uniq_args = rb_funcall(args, Uniq, 0);
n = RARRAY_LEN(uniq_args);
str = rb_str_new2("");
for (i = 0; i < n; i++) {
arg = rb_ary_entry(uniq_args, i);
if (! rb_obj_is_kind_of(arg, NgraphClass)) {
return Qnil;
}
inst = check_id(arg);
if (inst == NULL) {
return Qnil;
}
if (obj == NULL) {
obj = inst->obj;
name = ngraph_get_object_name(inst->obj);
rb_str_cat2(str, name);
} else if (obj != inst->obj) {
return Qnil;
}
rb_str_catf(str, "%c%d", (i) ? ',' : ':', inst->id);
}
return str;
}
开发者ID:htrb,项目名称:ngraph-gtk,代码行数:34,代码来源:ngraph.c
示例10: xml_start
bool Button::xml_start(const QString & qName, const QXmlAttributes & atts)
{
//printf("Procesando botón %s\n",qName.toLocal8Bit().data() );
//mButton *w=(mButton *)widget;
if(qName=="button" && check_id(atts) )
{
//QString icon=atts.value("icon");
//if(!title.isEmpty()) widget->setWindowTitle ( atts.value("title") );
widget_properties(atts,this);
return true;
}
else if(qName=="text")
{
return true;
}
else if(qName=="icon")
{
return true;
}
else if(qName=="signal")
{
QString signal=atts.value("name");
if(signal=="clicked")
QObject::connect((mButton*)widget, SIGNAL(clicked()), (mButton*)widget, SLOT(clicked_cb()) );
return true;
}
return false;
}
开发者ID:OpticaMonografia,项目名称:QtOctave,代码行数:32,代码来源:button.cpp
示例11: ruby_ngraph_exec_loginshell
static VALUE
ruby_ngraph_exec_loginshell(VALUE module, VALUE cmd, VALUE nobj)
{
int r;
size_t len;
const char *str;
char *loginshell;
static struct ngraph_instance *inst;
if (! rb_obj_is_kind_of(nobj, NgraphClass)) {
rb_raise(rb_eArgError, "%s: illegal type of the argument (%s).", rb_obj_classname(module), rb_obj_classname(nobj));
}
if (NIL_P(cmd)) {
loginshell = NULL;
} else {
str = StringValueCStr(cmd);
len = strlen(str) + 1;
loginshell = ALLOCA_N(char, len);
if (loginshell == NULL) {
rb_raise(rb_eSysStackError, "%s: cannot allocate enough memory.", rb_obj_classname(module));
}
strcpy(loginshell, str);
}
inst = check_id(nobj);
r = ngraph_exec_loginshell(loginshell, inst->obj, inst->id);
return INT2FIX(r);
}
开发者ID:htrb,项目名称:ngraph-gtk,代码行数:30,代码来源:ngraph.c
示例12: inst_get_sarray
static VALUE
inst_get_sarray(VALUE self, const char *field)
{
struct ngraph_instance *inst;
ngraph_returned_value cary;
ngraph_arg carg;
VALUE ary;
int i;
inst = check_id(self);
if (inst == NULL) {
return Qnil;
}
carg.num = 0;
inst->rcode = ngraph_object_get(inst->obj, field, inst->id, &carg, &cary);
if (inst->rcode < 0) {
return Qnil;
}
ary = rb_ary_new2(cary.ary.num);
for (i = 0; i < cary.ary.num; i++) {
rb_ary_store(ary, i, tainted_utf8_str_new(cary.ary.data.sa[i]));
}
return ary;
}
开发者ID:htrb,项目名称:ngraph-gtk,代码行数:27,代码来源:ngraph.c
示例13: __ocmem_allocate_range
struct ocmem_buf *ocmem_allocate(int client_id, unsigned long size)
{
bool can_block = false;
bool can_wait = true;
if (!check_id(client_id)) {
pr_err("ocmem: Invalid client id: %d\n", client_id);
return NULL;
}
if (size < OCMEM_MIN_ALLOC) {
pr_err("ocmem: requested size %lx must be at least %x\n",
size, OCMEM_MIN_ALLOC);
return NULL;
}
if (!IS_ALIGNED(size, OCMEM_MIN_ALIGN)) {
pr_err("ocmem: Invalid alignment, size must be %x aligned\n",
OCMEM_MIN_ALIGN);
return NULL;
}
return __ocmem_allocate_range(client_id, size, size,
size, can_block, can_wait);
}
开发者ID:Astrali,项目名称:kernel_msm8625q_f1,代码行数:25,代码来源:ocmem_api.c
示例14: check_idparser
int check_idparser(CLISESSION *pSession, char *pszValue)
{
int ret = check_id(pSession, pszValue);
if(!ret) ret = check_string(pSession, pszValue);
return ret;
}
开发者ID:bearxiong99,项目名称:new_swamm,代码行数:8,代码来源:cmd_syntax.cpp
示例15: check_allid
int check_allid(CLISESSION *pSession, char *pszValue)
{
// 'all' Check
if (strcmp(pszValue, "all") == 0)
return 1;
return check_id(pSession, pszValue);
}
开发者ID:bearxiong99,项目名称:new_swamm,代码行数:8,代码来源:cmd_syntax.cpp
示例16: get_max_quota
unsigned long get_max_quota(int client_id)
{
if (!check_id(client_id)) {
pr_err("ocmem: Invalid client id: %d\n", client_id);
return 0x0;
}
return process_quota(client_id);
}
开发者ID:Astrali,项目名称:kernel_msm8625q_f1,代码行数:8,代码来源:ocmem_api.c
示例17: load_all_subnets
/*
Read Subnets from all host config files
*/
void load_all_subnets(void) {
DIR *dir;
struct dirent *ent;
char *dname;
char *fname;
avl_tree_t *config_tree;
config_t *cfg;
subnet_t *s, *s2;
node_t *n;
bool result;
xasprintf(&dname, "%s/hosts", confbase);
dir = opendir(dname);
if(!dir) {
logger(LOG_ERR, "Could not open %s: %s", dname, strerror(errno));
free(dname);
return;
}
while((ent = readdir(dir))) {
if(!check_id(ent->d_name))
continue;
n = lookup_node(ent->d_name);
#ifdef _DIRENT_HAVE_D_TYPE
//if(ent->d_type != DT_REG)
// continue;
#endif
xasprintf(&fname, "%s/hosts/%s", confbase, ent->d_name);
init_configuration(&config_tree);
result = read_config_file(config_tree, fname);
free(fname);
if(!result)
continue;
if(!n) {
n = new_node();
n->name = xstrdup(ent->d_name);
node_add(n);
}
for(cfg = lookup_config(config_tree, "Subnet"); cfg; cfg = lookup_config_next(config_tree, cfg)) {
if(!get_config_subnet(cfg, &s))
continue;
if((s2 = lookup_subnet(n, s))) {
s2->expires = -1;
} else {
subnet_add(n, s);
}
}
exit_configuration(&config_tree);
}
closedir(dir);
}
开发者ID:Rumko,项目名称:tinc,代码行数:61,代码来源:net_setup.c
示例18: process_id
expr_rec process_id(void)
{
expr_rec t;
/*Declare ID and built a corresponding semantic record*/
check_id(token_buffer);
t.kind = IDEXPR;
strcpy(t.name, token_buffer);
return t;
}
开发者ID:aifos29,项目名称:Compiladores-MicroCompiler,代码行数:9,代码来源:genIntermedio.c
示例19: sprintf
char *get_temp(void)
{
/*max temporary allocated so far*/
static int max_temp = 0;
static char tempname[MAXIDLEN];
max_temp++;
sprintf(tempname,"Temp&%d",max_temp);
check_id(tempname);
return tempname;
}
开发者ID:aifos29,项目名称:Compiladores-MicroCompiler,代码行数:11,代码来源:genIntermedio.c
示例20: ngraph_inst_method_rcode
static VALUE
ngraph_inst_method_rcode(VALUE klass)
{
struct ngraph_instance *inst;
inst = check_id(klass);
if (inst == NULL) {
return Qnil;
}
return INT2FIX(inst->rcode);
}
开发者ID:htrb,项目名称:ngraph-gtk,代码行数:12,代码来源:ngraph.c
注:本文中的check_id函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论