这篇教程C++ DupString函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DupString函数的典型用法代码示例。如果您正苦于以下问题:C++ DupString函数的具体用法?C++ DupString怎么用?C++ DupString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DupString函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: init_confint init_conf(void){ if (read_configuration_file()) { /* * make sure we're sane to start if the config * file read didn't get everything we need. * XXX - should any of these abort the server? * TODO: add warning messages */ if (0 == localConf.name || 0 == localConf.numeric) return 0; if (conf_error) return 0; if (0 == localConf.location1) DupString(localConf.location1, ""); if (0 == localConf.location2) DupString(localConf.location2, ""); if (0 == localConf.contact) DupString(localConf.contact, ""); return 1; } return 0;}
开发者ID:kisserlb,项目名称:enet-1.0,代码行数:25,
示例2: ServiceModule_do_helpstatic VALUEServiceModule_do_help(VALUE self, VALUE client, VALUE value, VALUE parv){ struct Service *service = get_service(self); struct Client *cclient; int argc = 0; int i; char *cvalue = 0; char **argv = 0; VALUE tmp; Check_OurType(client, cClient); cclient = value_to_client(client); if(!NIL_P(value)) { Check_Type(value, T_STRING); Check_Type(parv, T_ARRAY); DupString(cvalue, StringValueCStr(value)); argc = RARRAY(parv)->len - 1; argv = ALLOCA_N(char *, argc); for(i = 0; i < argc; ++i) { tmp = rb_ary_entry(parv, i); DupString(argv[i], StringValueCStr(tmp)); } }
开发者ID:Adam-,项目名称:oftc-ircservices,代码行数:30,
示例3: check_repeat/* * check for public repeating and keep/replace appropriate last phrase * -demond */static int check_repeat(struct Client *source_p, struct Channel *chptr, char *text){ dlink_node *ptr; struct Repeat *repeatptr; for (ptr = source_p->user->repeat.head; ptr; ptr = ptr->next) { repeatptr = ptr->data; if (repeatptr->chptr == chptr) if (!strcmp(repeatptr->text, text)) { return 1; } else { MyFree(repeatptr->text); DupString(repeatptr->text, text); repeatptr->lastphrase = CurrentTime; return 0; } } repeatptr = (struct Repeat *)MyMalloc(sizeof(struct Repeat)); repeatptr->chptr = chptr; DupString(repeatptr->text, text); repeatptr->lastphrase = CurrentTime; ptr = make_dlink_node(); dlinkAdd(repeatptr, ptr, &source_p->user->repeat); return 0;}
开发者ID:Cloudxtreme,项目名称:ircd-3,代码行数:34,
示例4: make_zline/** Create a Zline structure. * @param[in] mask Mask. * @param[in] reason Reason for Z-line. * @param[in] expire Expiration timestamp. * @param[in] lastmod Last modification timestamp. * @param[in] flags Bitwise combination of ZLINE_* bits. * @return Newly allocated Z-line. */static struct Zline *make_zline(char *mask, char *reason, time_t expire, time_t lastmod, time_t lifetime, unsigned int flags){ struct Zline *zline; assert(0 != expire); zline = (struct Zline *)MyMalloc(sizeof(struct Zline)); /* alloc memory */ assert(0 != zline); DupString(zline->zl_reason, reason); /* initialize zline... */ zline->zl_expire = expire; zline->zl_lifetime = lifetime; zline->zl_lastmod = lastmod; zline->zl_flags = flags & ZLINE_MASK; zline->zl_state = ZLOCAL_GLOBAL; /* not locally modified */ DupString(zline->zl_mask, mask); if (ipmask_parse(mask, &zline->zl_addr, &zline->zl_bits)) { zline->zl_flags |= ZLINE_IPMASK; zline->zl_addr = ipmask_clean(&zline->zl_addr, zline->zl_bits); } zline->zl_next = GlobalZlineList; /* then link it into list */ zline->zl_prev_p = &GlobalZlineList; if (GlobalZlineList) GlobalZlineList->zl_prev_p = &zline->zl_next; GlobalZlineList = zline; return zline;}
开发者ID:evilnet,项目名称:nefarious2,代码行数:41,
示例5: parse_resv_filevoidparse_resv_file(FILE * file){ struct ConfItem *aconf; char *reason_field; char *host_field; char line[BUFSIZE]; char *p; while (fgets(line, sizeof(line), file)) { if((p = strpbrk(line, "/r/n"))) *p = '/0'; if((*line == '/0') || (line[0] == '#')) continue; host_field = getfield(line); if(EmptyString(host_field)) continue; reason_field = getfield(NULL); if(EmptyString(reason_field)) continue; if(IsChannelName(host_field)) { if(hash_find_resv(host_field)) continue; aconf = make_conf(); aconf->status = CONF_RESV_CHANNEL; aconf->port = 0; DupString(aconf->name, host_field); DupString(aconf->passwd, reason_field); add_to_resv_hash(aconf->name, aconf); } else if(clean_resv_nick(host_field)) { if(find_nick_resv(host_field)) continue; aconf = make_conf(); aconf->status = CONF_RESV_NICK; aconf->port = 0; DupString(aconf->name, host_field); DupString(aconf->passwd, reason_field); dlinkAddAlloc(aconf, &resv_conf_list); } }}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:53,
示例6: memsetstatic DOMAIN_PIECE *find_or_add_host_piece(DOMAIN_LEVEL *level_ptr, int flags,char *host_piece){ DOMAIN_PIECE *piece_ptr; DOMAIN_PIECE *cur_piece; DOMAIN_PIECE *new_ptr; DOMAIN_PIECE *last_ptr; DOMAIN_PIECE *ptr; int index; index = *host_piece&(MAX_PIECE_LIST-1); piece_ptr = level_ptr->piece_list[index]; if(piece_ptr == (DOMAIN_PIECE *)NULL) { cur_piece = (DOMAIN_PIECE *)MyMalloc(sizeof(DOMAIN_PIECE)); memset((void *)cur_piece,0,sizeof(DOMAIN_PIECE)); DupString(cur_piece->host_piece,host_piece); level_ptr->piece_list[index] = cur_piece; cur_piece->flags |= flags; return(cur_piece); } last_ptr = (DOMAIN_PIECE *)NULL; for(ptr=piece_ptr; ptr; ptr = ptr->next_piece) { if(!strcasecmp(ptr->host_piece,host_piece)) { ptr->flags |= flags; return(ptr); } last_ptr = ptr; } if(last_ptr) { new_ptr = (DOMAIN_PIECE *)MyMalloc(sizeof(DOMAIN_PIECE)); memset((void *)new_ptr,0,sizeof(DOMAIN_PIECE)); DupString(new_ptr->host_piece,host_piece); last_ptr->next_piece = new_ptr; new_ptr->flags |= flags; return(new_ptr); } else { sendto_realops("Bug: in find_or_add_host_piece. yay."); return(NULL); } /* NOT REACHED */}
开发者ID:grawity,项目名称:ircd-hybrid-5,代码行数:52,
示例7: conf_add_fields/* conf_add_fields() * * inputs - pointer to config item, host/pass/user/operreason fields * output - NONE * side effects - update respective fields with pointers */static voidconf_add_fields(struct ConfItem *aconf, const char *host_field, const char *pass_field, const char *user_field, const char *operreason_field){ if(host_field != NULL) DupString(aconf->host, host_field); if(pass_field != NULL) DupString(aconf->passwd, pass_field); if(user_field != NULL) DupString(aconf->user, user_field); if(operreason_field != NULL) DupString(aconf->spasswd, operreason_field);}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:20,
示例8: GetGenreLPSTR GetGenre(LPSTR lpsz){ int id = atoi(lpsz + 1); int i; if ((*(lpsz + 1) > '0') && (*(lpsz + 1) < '9')) { for (i = 0; i < NUMGENRES; i++) { if (id == ID3Genres[i].id) return DupString(ID3Genres[i].name); } } return DupString(lpsz);}
开发者ID:cmjonze,项目名称:faad,代码行数:15,
示例9: DumpBlockstatic void DumpBlock(const char *type, struct block_t *blk){ uint32 size = (ReadDword((uint32)&blk->size) - sizeof(*blk) - sizeof(uint32)) & ~7; uint32 seq_id = ReadDword((uint32)&blk->seq_id); uint32 line = ReadDword((uint32)&blk->line); char *file = DupString(ReadDword((uint32)&blk->file)); char *func = DupString(ReadDword((uint32)&blk->func)); uint32 ptr = (uint32)blk + sizeof(*blk); printf("%s %08x = seq:%5d, size:%5d, %-30.30s (%4d) %s/n", type, ptr, seq_id, size, func, line, basename(file)); free(file); free(func);}
开发者ID:dennisjenkins75,项目名称:dwj-os,代码行数:15,
示例10: RETURN_ERRORLut_t *GetLut(int nband, Input_meta_t *meta, Img_coord_int_t *input_size) { Lut_t *this; /* Create the lookup table data structure */ this = (Lut_t *)malloc(sizeof(Lut_t)); if (this == NULL) RETURN_ERROR("allocating Input data structure", "OpenInput", NULL); /* Populate the data structure */ this->nband = nband; this->in_fill = meta->fill; this->output_fill = OUTPUT_FILL; this->in_satu = INPUT_SATU; this->output_satu = OUTPUT_SATU; this->aerosol_fill = AEROSOL_FILL; this->ar_region_size.l = AEROSOL_REGION_NLINE; this->ar_region_size.s = AEROSOL_REGION_NSAMP; this->ar_size.l = ((input_size->l - 1) / this->ar_region_size.l) + 1; this->ar_size.s = ((input_size->s - 1) / this->ar_region_size.s) + 1; this->min_valid_sr = MIN_VALID_SR; this->max_valid_sr = MAX_VALID_SR; this->atmos_opacity_scale_factor= ATMOS_OPACITY_SCALE_FACTOR; this->scale_factor= SCALE_FACTOR; /* scale factor */ this->scale_factor_err= SCALE_FACTOR_ERR; /* scale factor error */ this->add_offset= ADD_OFFSET; /* add offset */ this->add_offset_err= ADD_OFFSET_ERR; /* add offset error */ this->calibrated_nt= CALIBRATED_NT; /* calibrated nt */ this->long_name_prefix = DupString(LONG_NAME_PREFIX); if (this->long_name_prefix == NULL) { free(this); RETURN_ERROR("duplicating long name prefix", "GetLut", NULL); } this->units = DupString(UNITS); if (this->units == NULL) { free(this); RETURN_ERROR("duplicating ref units", "GetLut", NULL); } if (!InputMetaCopy(meta, nband, &this->meta)) { free(this); RETURN_ERROR("copying input metadata", "GetLut", NULL); } return this;}
开发者ID:NGenetzky,项目名称:espa-surface-reflectance,代码行数:48,
示例11: m_sxline/* * m_sxline() - add info ban line * * parv[0] = sender prefix * parv[1] = info banned mask */int m_sxline(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) { aConfItem *aconf; char *reason = NULL; char *mask; int len; if (!IsService(sptr) && !IsServer(cptr)) { sendto_one(sptr, form_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; } if(parc<3) { sendto_one(sptr, form_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "SXLINE"); return 0; } len=atoi(parv[1]); mask = parv[2]; if ((strlen(mask) > len) && (mask[len])==':') { mask[len] = '/0'; reason = mask+len+1; } else { /* Bogus */ return 0; } if (!find_sxline(mask)) /* sxline does not exist */ { aconf = make_conf(); DupString(aconf->name, mask); DupString(aconf->passwd, reason); aconf->next = sxlines; sxlines = aconf; sendto_serv_butone(cptr, ":%s SXLINE %d :%s:%s", sptr->name, len, aconf->name,aconf->passwd); } return 0; }
开发者ID:diegoagudo,项目名称:ptlink.ircd,代码行数:54,
示例12: ReplaceString/* * ReplaceString - free a string, then allocate new one */void ReplaceString( char **where, const char *str ){ MemFree( *where ); *where = DupString( str );} /* ReplaceString */
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:10,
示例13: mr_error/* * mr_error - unregistered client message handler * * parv[0] = sender prefix * parv[parc-1] = text */int mr_error(struct Client* cptr, struct Client* sptr, int parc, char* parv[]){ const char *para; if (!IsHandshake(cptr) && !IsConnecting(cptr)) return 0; /* ignore ERROR from regular clients */ para = (parc > 1 && *parv[parc - 1] != '/0') ? parv[parc - 1] : "<>"; Debug((DEBUG_ERROR, "Received ERROR message from %s: %s", cli_name(sptr), para)); if (cptr == sptr) sendto_opmask_butone(0, SNO_OLDSNO, "ERROR :from %C -- %s", cptr, para); else sendto_opmask_butone(0, SNO_OLDSNO, "ERROR :from %C via %C -- %s", sptr, cptr, para); if (cli_serv(sptr)) { MyFree(cli_serv(sptr)->last_error_msg); DupString(cli_serv(sptr)->last_error_msg, para); } return 0;}
开发者ID:briancline,项目名称:virtuanet-ircu2.10.11.07,代码行数:31,
示例14: do_query_name/** Send a query to look up the address for a name. * @param[in] query Callback information. * @param[in] name Hostname to look up. * @param[in] request DNS lookup structure (may be NULL). * @param[in] type Preferred request type. */static voiddo_query_name(dns_callback_f callback, void *ctx, const char *name, struct reslist *request, int type){ char host_name[HOSTLEN + 1]; ircd_strncpy(host_name, name, HOSTLEN); add_local_domain(host_name, HOSTLEN); if (request == NULL) { request = make_request(callback, ctx); DupString(request->name, host_name);#ifdef IPV6 if (type != T_A) request->state = REQ_AAAA; else#endif request->state = REQ_A; } request->type = type; Debug((DEBUG_DNS, "Requesting DNS %s %s as %p", (request->state == REQ_AAAA ? "AAAA" : "A"), host_name, request)); query_name(host_name, C_IN, type, request);}
开发者ID:Niichan,项目名称:snircd,代码行数:31,
示例15: create_channel_resvstruct ResvChannel *create_channel_resv(char *name, char *reason, int conf){ struct ResvChannel *resv_p = NULL; int len; if(find_channel_resv(name)) return NULL; if((len = strlen(reason)) > TOPICLEN) { reason[TOPICLEN] = '/0'; len = TOPICLEN; } resv_p = (struct ResvChannel *)MyMalloc(sizeof(struct ResvChannel)); strlcpy(resv_p->name, name, sizeof(resv_p->name)); DupString(resv_p->reason, reason); resv_p->conf = conf; if(ResvChannelList != NULL) ResvChannelList->prev = resv_p; resv_p->next = ResvChannelList; resv_p->prev = NULL; ResvChannelList = resv_p; add_to_resv_hash_table(resv_p->name, resv_p); return resv_p;}
开发者ID:Cloudxtreme,项目名称:ircd-3,代码行数:33,
示例16: create_nick_resvstruct ResvNick *create_nick_resv(char *name, char *reason, int conf){ struct ResvNick *resv_p = NULL; int len; if(find_nick_resv(name)) return NULL; if((len = strlen(reason)) > TOPICLEN) { reason[TOPICLEN] = '/0'; len = TOPICLEN; } resv_p = (struct ResvNick *)MyMalloc(sizeof(struct ResvNick)); strlcpy(resv_p->name, name, sizeof(resv_p->name)); DupString(resv_p->reason, reason); resv_p->conf = conf; if(ResvNickList) ResvNickList->prev = resv_p; resv_p->next = ResvNickList; resv_p->prev = NULL; ResvNickList = resv_p; return resv_p;}
开发者ID:Cloudxtreme,项目名称:ircd-3,代码行数:31,
示例17: crypt_passchar *crypt_pass(char *password, int encode){ EVP_MD_CTX *mdctx; const EVP_MD *md; unsigned char md_value[EVP_MAX_MD_SIZE]; char buffer[2*DIGEST_LEN + 1]; char *ret; unsigned int md_len; md = EVP_get_digestbyname(DIGEST_FUNCTION); mdctx = EVP_MD_CTX_create(); EVP_MD_CTX_init(mdctx); EVP_DigestInit_ex(mdctx, md, NULL); EVP_DigestUpdate(mdctx, password, strlen(password)); EVP_DigestFinal_ex(mdctx, md_value, &md_len); EVP_MD_CTX_destroy(mdctx); if(encode) { base16_encode(buffer, sizeof(buffer), (char *)md_value, DIGEST_LEN); DupString(ret, buffer); } else { ret = MyMalloc(DIGEST_LEN); memcpy(ret, md_value, DIGEST_LEN); } return ret;}
开发者ID:oftc,项目名称:oftc-ircservices,代码行数:31,
示例18: zline_find/** Find a Z-line for a particular mask, guided by certain flags. * Certain bits in /a flags are interpreted specially: * <dl> * <dt>ZLINE_ANY</dt><dd>Search user Z-lines.</dd> * <dt>ZLINE_GLOBAL</dt><dd>Only match global Z-lines.</dd> * <dt>ZLINE_LOCAL</dt><dd>Only match local Z-lines.</dd> * <dt>ZLINE_LASTMOD</dt><dd>Only match Z-lines with a last modification time.</dd> * <dt>ZLINE_EXACT</dt><dd>Require an exact match of Z-line mask.</dd> * <dt>anything else</dt><dd>Search user Z-lines.</dd> * </dl> * @param[in] ipmask Mask to search for. * @param[in] flags Bitwise combination of ZLINE_* flags. * @return First matching Z-line, or NULL if none are found. */struct Zline *zline_find(char *ipmask, unsigned int flags){ struct Zline *zline = 0; struct Zline *szline; char *mask, *t_uh; DupString(t_uh, ipmask); mask = t_uh; zliter(GlobalZlineList, zline, szline) { if ((flags & (ZlineIsLocal(zline) ? ZLINE_GLOBAL : ZLINE_LOCAL)) || (flags & ZLINE_LASTMOD && !zline->zl_lastmod)) continue; else if (flags & ZLINE_EXACT) { if (((zline->zl_mask && mask && ircd_strcmp(zline->zl_mask, mask) == 0) || (!zline->zl_mask && !mask))) break; } else { if (((zline->zl_mask && mask && match(zline->zl_mask, mask) == 0) || (!zline->zl_mask && !mask))) break; } } MyFree(t_uh); return zline;}
开发者ID:evilnet,项目名称:nefarious2,代码行数:43,
示例19: parse_x_filevoidparse_x_file(FILE * file){ struct ConfItem *aconf; char *gecos_field = NULL; char *reason_field = NULL; char line[BUFSIZE]; char *p; while (fgets(line, sizeof(line), file)) { if((p = strpbrk(line, "/r/n"))) *p = '/0'; if((*line == '/0') || (line[0] == '#')) continue; gecos_field = getfield(line); if(EmptyString(gecos_field)) continue; /* field for xline types, which no longer exist */ getfield(NULL); reason_field = getfield(NULL); if(EmptyString(reason_field)) continue; /* sanity checking */ if((find_xline(gecos_field, 0) != NULL) || (strchr(reason_field, ':') != NULL)) continue; aconf = make_conf(); aconf->status = CONF_XLINE; DupString(aconf->name, gecos_field); DupString(aconf->passwd, reason_field); dlinkAddAlloc(aconf, &xline_conf_list); }}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:42,
示例20: motd_create/** Create a struct Motd and initialize it. * @param[in] hostmask Hostmask (or connection class name) to filter on. * @param[in] path Path to MOTD file. * @param[in] maxcount Maximum number of lines permitted for MOTD. */static struct Motd *motd_create(const char *hostmask, const char *path, int maxcount, int type){ struct Motd* tmp; assert(0 != path); /* allocate memory and initialize the structure */ if (MotdList.freelist) { tmp = MotdList.freelist; MotdList.freelist = tmp->next; } else tmp = (struct Motd *)MyMalloc(sizeof(struct Motd)); tmp->next = 0; if (hostmask == NULL) tmp->type = MOTD_UNIVERSAL; else if (type == MOTD_COUNTRY) tmp->type = MOTD_COUNTRY; else if (type == MOTD_CONTINENT) tmp->type = MOTD_CONTINENT; else if (find_class(hostmask)) tmp->type = MOTD_CLASS; else if (ipmask_parse(hostmask, &tmp->address, &tmp->addrbits)) tmp->type = MOTD_IPMASK; else tmp->type = MOTD_HOSTMASK; if (hostmask != NULL) DupString(tmp->hostmask, hostmask); else tmp->hostmask = NULL; DupString(tmp->path, path); tmp->maxcount = maxcount; tmp->cache = 0; return tmp;}
开发者ID:DamnIO,项目名称:DamnIRCd,代码行数:45,
示例21: conf_parse_userhost/** Parse a user/@host mask into username and host or IP parts. * If /a host contains no username part, set /a aconf->username to * NULL. If the host part of /a host looks like an IP mask, set /a * aconf->addrbits and /a aconf->address to match. Otherwise, set * /a aconf->host, and set /a aconf->addrbits to -1. * @param[in,out] aconf Configuration item to set. * @param[in] host user/@host mask to parse. */void conf_parse_userhost(struct ConfItem *aconf, char *host){ char *host_part; unsigned char addrbits; MyFree(aconf->username); MyFree(aconf->host); host_part = strchr(host, '@'); if (host_part) { *host_part = '/0'; DupString(aconf->username, host); host_part++; } else { aconf->username = NULL; host_part = host; } DupString(aconf->host, host_part); if (ipmask_parse(aconf->host, &aconf->address.addr, &addrbits)) aconf->addrbits = addrbits; else aconf->addrbits = -1;}
开发者ID:kisserlb,项目名称:enet-1.0,代码行数:30,
示例22: setGenericAlias/* * setGenericAlias - define an alias/abbreviation */static vi_rc setGenericAlias( const char *what, alias_list **head, alias_list **tail ){ alias_list *curr; char str[MAX_STR]; what = GetNextWord1( what, str ); if( *str == '/0' ) { return( ERR_INVALID_ALIAS ); } what = SkipLeadingSpaces( what ); /* * see if alias is already in list: if so, and there is expansion data, * then replace the data, else delete the item */ for( curr = *head; curr != NULL; curr = curr->next ) { if( strcmp( str, curr->alias ) == 0 ) { MemFree( curr->expand ); if( *what == '/0' ) { MemFree( curr->alias ); MemFree( DeleteLLItem( (ss **)head, (ss **)tail, (ss *)curr ) ); } else { curr->expand = DupString( what ); } } } /* * add the new item */ curr = MemAlloc( sizeof( alias_list ) ); curr->alias = DupString( str ); curr->expand = DupString( what ); AddLLItemAtEnd( (ss **)head, (ss **)tail, (ss *)curr ); Message1( "%s set to /"%s/"", str, what ); return( DO_NOT_CLEAR_MESSAGE_WINDOW );} /* setGenericAlias */
开发者ID:NoSuchProcess,项目名称:open-watcom-v2,代码行数:42,
示例23: crule_parseargliststatic int crule_parsearglist(CRuleNodePtr argrootp, int *next_tokp, const char** ruleptr){ int errcode = CR_NOERR; char *argelemp = NULL; char currarg[CR_MAXARGLEN]; int arglen = 0; char word[CR_MAXARGLEN]; int wordlen = 0; argrootp->numargs = 0; currarg[0] = '/0'; while (errcode == CR_NOERR) { switch (*next_tokp) { case CR_WORD: crule_getword(word, &wordlen, CR_MAXARGLEN - 1, ruleptr); if (currarg[0] != '/0') { if ((arglen + wordlen) < (CR_MAXARGLEN - 1)) { strcat(currarg, " "); strcat(currarg, word); arglen += wordlen + 1; } } else { strcpy(currarg, word); arglen = wordlen; } errcode = crule_gettoken(next_tokp, ruleptr); break; default:#if !defined(CR_DEBUG) && !defined(CR_CHKCONF) collapse(currarg);#endif if (!BadPtr(currarg)) { DupString(argelemp, currarg); argrootp->arg[argrootp->numargs++] = (void *)argelemp; } if (*next_tokp != CR_COMMA) return (CR_NOERR); currarg[0] = '/0'; errcode = crule_gettoken(next_tokp, ruleptr); break; } } return (errcode);}
开发者ID:briancline,项目名称:virtuanet-ircu2.10.11.07,代码行数:51,
示例24: make_jupe/** Allocate a new jupe with the given parameters. * @param[in] server Server name to jupe. * @param[in] reason Reason for jupe. * @param[in] expire Expiration time for jupe. * @param[in] lastmod Last modification time for jupe. * @param[in] flags Flags to set for the jupe. */static struct Jupe *make_jupe(char *server, char *reason, time_t expire, time_t lastmod, unsigned int flags){ struct Jupe *ajupe; ajupe = (struct Jupe*) MyMalloc(sizeof(struct Jupe)); /* alloc memory */ assert(0 != ajupe); memset(ajupe, 0, sizeof(*ajupe)); DupString(ajupe->ju_server, server); /* copy vital information */ DupString(ajupe->ju_reason, reason); ajupe->ju_expire = expire; ajupe->ju_lastmod = lastmod; ajupe->ju_flags = flags & JUPE_MASK; /* set jupe flags */ ajupe->ju_next = GlobalJupeList; /* link it into the list */ ajupe->ju_prev_p = &GlobalJupeList; if (GlobalJupeList) GlobalJupeList->ju_prev_p = &ajupe->ju_next; GlobalJupeList = ajupe; return ajupe;}
开发者ID:Niichan,项目名称:snircd,代码行数:31,
示例25: ServiceModule_registerstatic VALUEServiceModule_register(VALUE self, VALUE commands){ struct Service *ruby_service = get_service(self); struct ServiceMessage *generic_msgtab; VALUE command; long i; Check_Type(commands, T_ARRAY); for(i = RARRAY(commands)->len-1; i >= 0; --i) { VALUE name, param_min, param_max, flags, access, hlp_shrt, hlp_long; char *tmp; command = rb_ary_shift(commands); Check_Type(command, T_ARRAY); name = rb_ary_shift(command); param_min = rb_ary_shift(command); param_max = rb_ary_shift(command); flags = rb_ary_shift(command); access = rb_ary_shift(command); hlp_shrt = rb_ary_shift(command); hlp_long = rb_ary_shift(command); generic_msgtab = MyMalloc(sizeof(struct ServiceMessage)); DupString(tmp, StringValueCStr(name)); generic_msgtab->cmd = tmp; generic_msgtab->parameters = NUM2INT(param_min); generic_msgtab->maxpara = NUM2INT(param_max); generic_msgtab->flags = NUM2INT(flags); generic_msgtab->access = NUM2INT(access); generic_msgtab->help_short = NUM2INT(hlp_shrt); generic_msgtab->help_long = NUM2INT(hlp_long); generic_msgtab->handler = m_generic; mod_add_servcmd(&ruby_service->msg_tree, generic_msgtab); } return Qnil;}
开发者ID:Adam-,项目名称:oftc-ircservices,代码行数:44,
示例26: FindFilegcc_conststatic char *FindFile(const char *const*list){ for (const char *const* i = list; *i != nullptr; ++i) { const char *path = *i; if (IsAbsolutePath(path)) { if (File::Exists(path)) return DupString(path); } else { auto *result = FindInSearchPaths(path); if (result != nullptr) return result; } } return nullptr;}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:19,
示例27: GetSDSDimInfobool GetSDSDimInfo(int32 sds_id, Myhdf_dim_t *dim, int irank)/* !C******************************************************************************!Description: 'GetSDSDimInfo' reads information for a specific SDS dimension. !Input Parameters: sds_id SDS id!Output Parameters: dim Dimension data structure; the following fields are updated: id, nval, type, nattr, name (returns) Status: 'true' = okay 'false' = error reading the dimension information!Team Unique Header: ! Design Notes: 1. The HDF file is assumed to be open for SD (Science Data) access. 2. An dimension name of less than 'DIM_MAX_NCHAR' is expected. 3. Error messages are handled with the 'RETURN_ERROR' macro.!END*****************************************************************************/{ char dim_name[DIM_MAX_NCHAR]; dim->id = SDgetdimid(sds_id, irank); if (dim->id == HDF_ERROR) RETURN_ERROR("getting dimension id", "GetSDSDimInfo", false); if (SDdiminfo(dim->id, dim_name, &dim->nval, &dim->type, &dim->nattr) == HDF_ERROR) RETURN_ERROR("getting dimension information", "GetSDSDimInfo", false); dim->name = DupString(dim_name); if (dim->name == (char *)NULL) RETURN_ERROR("copying dimension name", "GetSDSDimInfo", false); return true;}
开发者ID:HawkyLu,项目名称:cfmask,代码行数:43,
注:本文中的DupString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Duration函数代码示例 C++ DupStr函数代码示例 |