这篇教程C++ trim_string函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中trim_string函数的典型用法代码示例。如果您正苦于以下问题:C++ trim_string函数的具体用法?C++ trim_string怎么用?C++ trim_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了trim_string函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: process_jnl_field_trim/*********************************************************************** * * Name : process_jnl_field_trim() * * Description: Processes the JNL_FEED_LAYOUT.jnl_field_trim values. * It calls the trim library function in jnl_aux.c * Inputs : None * Outputs : None * Returns : None * **********************************************************************/int process_jnl_field_trim(tiny command, char *string, tiny size){ switch(command) { case FIELD_TRIM_TRIM_RIGHT: return(trim_string(TRIM_RIGHT, string, size)); case FIELD_TRIM_TRIM_LEFT: return(trim_string(TRIM_LEFT, string, size)); case FIELD_TRIM_FILL_RIGHT: return(fill_string(FILL_RIGHT, string, size, ' ')); case FIELD_TRIM_FILL_LEFT: return(fill_string(FILL_LEFT, string, size, ' ')); case FIELD_TRIM_FILL_ZERO_RIGHT: return(fill_string(FILL_RIGHT, string, size, '0')); case FIELD_TRIM_FILL_ZERO_LEFT: return(fill_string(FILL_LEFT, string, size, '0')); case FIELD_TRIM_CENTER: return(center_string(string, size)); case FIELD_TRIM_NO_TRIM: break; default: break; } return(FAILURE);}
开发者ID:huilang22,项目名称:Projects,代码行数:36,
示例2: split_args void split_args(const char* args, /*out*/ std::list<std::string>& sargs, char splitter) { sargs.clear(); std::string v(args); int lastPos = 0; while (true) { auto pos = v.find(splitter, lastPos); if (pos != std::string::npos) { std::string s = v.substr(lastPos, pos - lastPos); if (s.length() > 0) { std::string s2 = trim_string((char*)s.c_str()); if (s2.length() > 0) sargs.push_back(s2); } lastPos = static_cast<int>(pos + 1); } else { std::string s = v.substr(lastPos); if (s.length() > 0) { std::string s2 = trim_string((char*)s.c_str()); if (s2.length() > 0) sargs.push_back(s2); } break; } } }
开发者ID:Bran-Stark,项目名称:rDSN,代码行数:34,
示例3: test_trim_stringvoid test_trim_string() { String str = copy_string(" abc "); String lstr = copy_string("abc "); String rstr = copy_string(" abc"); String trimed = "abc"; assert(strcmp(trim_string(str), trimed) == 0); assert(strcmp(trim_string(lstr), trimed) == 0); assert(strcmp(trim_string(rstr), trimed) == 0);}
开发者ID:FunnyLanguage,项目名称:funny,代码行数:9,
示例4: eval_sysString eval_sys(Mapping *m, Statement *source, Queue *repQueue) { String prepare = copy_string(m->sys->prepare); String eval = copy_string(m->sys->eval); Mapping *mapping = NULL; String* array = NULL; String* arraySource = NULL; String* arrayTarget = NULL; String prepareSource; String prepareTarget; String sourceFuncMacro; String sourceMacro; String targetFuncMacro; String targetMacro; if (!equals_string(prepare, "NIL")) { mapping = alloc_mapping(); mapping->sys = NULL; if (strcmp(m->sys->name, DEF_MACRO) == 0) { mapping->isMacro = TRUE; } else { mapping->isMacro = FALSE; } array = split_string_once(prepare, '>'); prepareSource = array[0]; prepareTarget = array[1]; arraySource = split_string_once(prepareSource, ','); sourceFuncMacro = trim_string(arraySource[0]); sourceMacro = trim_string(arraySource[1]); mapping->source = parse_macro(repQueue, sourceMacro); mapping->sourceFunc = parse_macro(repQueue, sourceFuncMacro); mapping->sourceStatement = parse(mapping->source); mapping->starter = to_dfa(mapping->sourceStatement); arrayTarget = split_string_once(prepareTarget, ','); targetFuncMacro = trim_string(arrayTarget[0]); targetMacro = trim_string(arrayTarget[1]); mapping->target = parse_macro(repQueue, targetMacro); mapping->targetFunc = parse_macro(repQueue, targetFuncMacro); mapping->targetStatement = parse(mapping->target); //enqueue(get_mappings(), mapping); add_mapping_to_trie(mapping); } if (!equals_string(eval, "NIL")) { return parse_macro(repQueue, eval); } else { return ""; }}
开发者ID:FunnyLanguage,项目名称:funny,代码行数:56,
示例5: auto_props_enumerator/* For one auto-props config entry (NAME, VALUE), if the filename pattern NAME matches BATON->filename case insensitively then add the properties listed in VALUE into BATON->properties. BATON must point to an auto_props_baton_t.*/static svn_boolean_tauto_props_enumerator(const char *name, const char *value, void *baton, apr_pool_t *pool){ auto_props_baton_t *autoprops = baton; char *property; char *last_token; /* nothing to do here without a value */ if (strlen(value) == 0) return TRUE; /* check if filename matches and return if it doesn't */ if (apr_fnmatch(name, autoprops->filename, APR_FNM_CASE_BLIND) == APR_FNM_NOMATCH) return TRUE; /* parse the value (we dup it first to effectively lose the 'const', and to avoid messing up the original value) */ property = apr_pstrdup(autoprops->pool, value); property = apr_strtok(property, ";", &last_token); while (property) { int len; const char *this_value; char *equal_sign = strchr(property, '='); if (equal_sign) { *equal_sign = '/0'; equal_sign++; trim_string(&equal_sign); this_value = equal_sign; } else { this_value = ""; } trim_string(&property); len = strlen(property); if (len > 0) { svn_string_t *propval = svn_string_create(this_value, autoprops->pool); apr_hash_set(autoprops->properties, property, len, propval); if (strcmp(property, SVN_PROP_MIME_TYPE) == 0) autoprops->mimetype = this_value; else if (strcmp(property, SVN_PROP_EXECUTABLE) == 0) autoprops->have_executable = TRUE; } property = apr_strtok(NULL, ";", &last_token); } return TRUE;}
开发者ID:vocho,项目名称:openqnx,代码行数:61,
示例6: trim_stringvoid result::dump_channel(std::ostream &out, const Json::Value &val) const{ auto name = val["name"].asString(); auto game = val["game"].asString(); const auto url = val["url"].asString(); trim_string(name, _name_len); trim_string(game, _game_len); out << " " << std::setw(_name_len) << std::left << name << " " << std::setw(_game_len) << std::left << game << " " << url << "/n";}
开发者ID:stnuessl,项目名称:tq,代码行数:13,
示例7: filebool IniParser::load(const char* filename){ std::ifstream file(filename); if (file) { std::string line; Section* section = NULL; while (std::getline(file, line)) { // Ignore comments and empty lines trim_string(line); if (line.size() > 0 && line[0] != TOKEN_COMMENT) { // Look for sections if (line[0] == TOKEN_START_SECTION) { // Extract section name size_t index = line.find(TOKEN_END_SECTION); line = line.substr(1, index - 1); section = §ions_[line]; } else if (section != NULL) { size_t index = line.find(TOKEN_SEPARATOR); if (index != std::string::npos) { // Store key:value in the current section std::string key = line.substr(0, index); trim_string(key); std::string value = line.substr(index + 1); trim_string(value); (*section)[key] = value; } else { std::cerr << "[IniParser] line '" << line << "' ignored: missing '" << TOKEN_SEPARATOR << "' token" << std::endl; } } else { std::cerr << "[IniParser] line '" << line << "' ignored: outside of a section" << std::endl; } } } file.close(); return true; } std::cerr << "[IniParser] cannot open file: " << filename << std::endl; return false;}
开发者ID:abodelot,项目名称:cpp-utils,代码行数:50,
示例8: strchrstatic summary_file *parse_driver_tag(char *linestart, int index){ summary_file *curfile; char *colon; /* find the colon separating name from status */ colon = strchr(linestart, ':'); if (colon == NULL) { fprintf(stderr, "Unexpected text after @@@@@driver=/n"); return NULL; } /* NULL terminate at the colon and look up the file */ *colon = 0; curfile = get_file(trim_string(linestart)); if (curfile == NULL) { fprintf(stderr, "Unable to allocate memory for driver/n"); return NULL; } /* clear out any old status for this file */ curfile->status[index] = STATUS_NOT_PRESENT; if (curfile->text[index] != NULL) free(curfile->text[index]); curfile->text[index] = NULL; curfile->textsize[index] = 0; curfile->textalloc[index] = 0; /* strip leading/trailing spaces from the status */ colon = trim_string(colon + 1); /* convert status into statistics */ if (strcmp(colon, "Success") == 0) curfile->status[index] = STATUS_SUCCESS; else if (strcmp(colon, "Missing files") == 0) curfile->status[index] = STATUS_MISSING_FILES; else if (strcmp(colon, "Exception") == 0) curfile->status[index] = STATUS_EXCEPTION; else if (strcmp(colon, "Fatal error") == 0) curfile->status[index] = STATUS_FATAL_ERROR; else if (strcmp(colon, "Failed validity check") == 0) curfile->status[index] = STATUS_FAILED_VALIDITY; else curfile->status[index] = STATUS_OTHER; return curfile;}
开发者ID:DarrenBranford,项目名称:MAME4iOS,代码行数:49,
示例9: _interpret_node_status/****************************************************************************interpret a node status response****************************************************************************/static void _interpret_node_status(char *p, char *master,char *rname){ int numnames = CVAL(p,0); DEBUG(1,("received %d names/n",numnames)); if (rname) *rname = 0; if (master) *master = 0; p += 1; while (numnames--) { char qname[17]; int type; fstring flags; int i; *flags = 0; StrnCpy(qname,p,15); type = CVAL(p,15); p += 16; fstrcat(flags, (p[0] & 0x80) ? "<GROUP> " : " "); if ((p[0] & 0x60) == 0x00) fstrcat(flags,"B "); if ((p[0] & 0x60) == 0x20) fstrcat(flags,"P "); if ((p[0] & 0x60) == 0x40) fstrcat(flags,"M "); if ((p[0] & 0x60) == 0x60) fstrcat(flags,"H "); if (p[0] & 0x10) fstrcat(flags,"<DEREGISTERING> "); if (p[0] & 0x08) fstrcat(flags,"<CONFLICT> "); if (p[0] & 0x04) fstrcat(flags,"<ACTIVE> "); if (p[0] & 0x02) fstrcat(flags,"<PERMANENT> "); if (master && !*master && type == 0x1d) { StrnCpy(master,qname,15); trim_string(master,NULL," "); } if (rname && !*rname && type == 0x20 && !(p[0]&0x80)) { StrnCpy(rname,qname,15); trim_string(rname,NULL," "); } for (i = strlen( qname) ; --i >= 0 ; ) { if (!isprint((int)qname[i])) qname[i] = '.'; } DEBUG(1,("/t%-15s <%02x> - %s/n",qname,type,flags)); p+=2; } DEBUG(1,("num_good_sends=%d num_good_receives=%d/n", IVAL(p,20),IVAL(p,24)));}
开发者ID:sfionov,项目名称:mc-dev,代码行数:52,
示例10: talloc_strdup/** A useful function for returning a path in the Samba lock directory.**/char *lpcfg_lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx, const char *name){ char *fname, *dname; if (name == NULL) { return NULL; } if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) { return talloc_strdup(mem_ctx, name); } dname = talloc_strdup(mem_ctx, lpcfg_lockdir(lp_ctx)); trim_string(dname,"","/"); if (!directory_exist(dname)) { if (!mkdir(dname,0755)) DEBUG(1, ("Unable to create directory %s for file %s. " "Error was %s/n", dname, name, strerror(errno))); } fname = talloc_asprintf(mem_ctx, "%s/%s", dname, name); talloc_free(dname); return fname;}
开发者ID:amitay,项目名称:samba,代码行数:29,
示例11: play_playlist// ---------------------------------------------------------------------------void play_playlist(char* player, char* file) { char buffer[512]; char* line; FILE* f = fopen(file, "r"); if(f == NULL) return; while(fgets(buffer, 512, f) != NULL && !stop) { line = buffer; line = trim_string(line); if(line[0] == '#') continue; // skip comments and meta information // otherwise, check if it is an mp3 and if yes, play it if(is_mp3(line)) { char abs_path[256]; // if relative path, add root path if(line[0] == '/') strcpy(abs_path, line); else { strcpy(abs_path, root_path); strcat(abs_path, "/"); strcat(abs_path, line); } start_player(player, abs_path); } else { //printf("no mp3: %s/n", line); } } fclose(f);}
开发者ID:BackupGGCode,项目名称:raspberry-webradio,代码行数:30,
示例12: trim_commentsvoid Lexer::setToken(){ std::string tmp; std::size_t pos = 0, begin = 0; std::string::iterator end; std::string::size_type comment_start; std::string::size_type newline; std::replace(_string.begin(), _string.end(), '/t', ' '); _string += "exit"; _string = trim_comments(_string); _string = trim_string(_string); for (std::string::iterator it = _string.begin() ; it + pos != _string.end() ; ++it) { if ((int)(pos = myMin(_string.find('/n', pos), _string.find(' ', pos))) == -1) { _token.push_back("exit"); return; } tmp = _string.substr(begin, pos-begin); pos++; begin = pos; _token.push_back(tmp); }}
开发者ID:Hiruxou,项目名称:Epitech-2,代码行数:26,
示例13: split_stringint Http_Response_Package::prase_package(std::string package){ m_line.clear(); m_fields.clear(); StrVec fields; split_string(package,fields,"/r/n"); if (fields.size()>1) { m_line=fields[0]; } for (unsigned int i=1;i<fields.size(); i++ ) { int colon_pos=fields[i].find(':'); std::string key=fields[i].substr(0,colon_pos); std::string value=fields[i].substr(colon_pos+1); value=trim_string(value," "); if ( m_fields.find(key)==m_fields.end() ) { m_fields[key]=value; } else { m_fields[key]+=";"+value; } } return 0;}
开发者ID:KGMSFT,项目名称:Spider,代码行数:28,
示例14: talloc_strdupstatic char *lpcfg_common_path(TALLOC_CTX* mem_ctx, const char *parent, const char *name){ char *fname, *dname; bool ok; if (name == NULL) { return NULL; } if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) { return talloc_strdup(mem_ctx, name); } dname = talloc_strdup(mem_ctx, parent); if (dname == NULL) { return NULL; } trim_string(dname,"","/"); ok = directory_create_or_exist(dname, geteuid(), 0755); if (!ok) { DEBUG(1, ("Unable to create directory %s for file %s. " "Error was %s/n", dname, name, strerror(errno))); return NULL; } fname = talloc_asprintf(mem_ctx, "%s/%s", dname, name); if (fname == NULL) { return dname; } talloc_free(dname); return fname;}
开发者ID:g1z2yong,项目名称:samba4,代码行数:35,
示例15: last/* Calls trim_string to remove blank space; Removes paired punctuation delimiters from beginning and end of string. If the same punctuation appears first and last (quotes, slashes) they are trimmed; Also checks for the following pairs: () <> {} [] */static inline char *trim_note( char *in ){ int len; char *note, start, end; note = trim_string( in ); if ( note != NULL ) { len = ( int ) strlen( note ); if ( len > 0 ) { if ( ispunct( *note ) ) { start = *note; end = note[len - 1]; if ( ( start == end ) || ( ( start == '(' ) && ( end == ')' ) ) || ( ( start == '<' ) && ( end == '>' ) ) || ( ( start == '{' ) && ( end == '}' ) ) || ( ( start == '[' ) && ( end == ']' ) ) ) { note[len - 1] = '/0'; *note = '/0'; note++; } } } } return note;}
开发者ID:pyrovski,项目名称:papi-rapl,代码行数:32,
示例16: login_with_md5static int login_with_md5(char* user_name, char* md5, char* result, int len) { CURL* curl; int i, slen; char url[1024]; char post_data[2048]; char all_value[1024]; sprintf(url,"http://net.tsinghua.edu.cn/cgi-bin/do_login"); sprintf(post_data, "username=%s&password=%s&drop=0&type=1&n=100", user_name, md5); /* printf("POST DATA : %s/n", post_data); */ if(post_data_to(url,post_data,all_value) != 0) return -1; trim_string(all_value); strncpy(result,all_value,len); if(result[0] <= '9' && result[0] >= '0') return 0; else return 1;}
开发者ID:geraint0923,项目名称:Embedded-System-Project,代码行数:26,
示例17: pfq_set_group_computation_from_stringintpfq_set_group_computation_from_string(pfq_t *q, int gid, const char *comp){ int do_set_group_computation(char **fun, int n) { int i = 0, j, ret; struct pfq_computation_descr * prog = malloc(sizeof(size_t) * 2 + sizeof(struct pfq_functional_descr) * n); if (!prog) return Q_ERROR(q, "PFQ: group computation error (no memory)"); prog->entry_point = 0; prog->size = n; for(i = 0; i < n; i++) { prog->fun[i].symbol = trim_string(fun[i]); prog->fun[i].next = i+1; for (j = 0; j < 8; j++) { prog->fun[i].arg[j].addr = NULL; prog->fun[i].arg[j].size = 0; prog->fun[i].arg[j].nelem = 0; } } ret = pfq_set_group_computation(q, gid, prog); free(prog); return ret; }
开发者ID:Mr-Click,项目名称:PFQ,代码行数:35,
示例18: segment_wordsint segment_words(const char * content,enum wtype type,int len,bool stepword,vector<funit>& features){ if(!content || len <= 0){ UB_LOG_WARNING("segment words,parameter error"); return -1; } /*get word segment result buffer*/ thread_data * tsd = (thread_data *)pthread_getspecific(key); if(!tsd){ UB_LOG_FATAL("thread special data is null"); exit(0); } scw_out_t *pout = tsd->pout; /*word segment*/ if(scw_segment_words(pwdict,pout,content,len,LANGTYPE_SIMP_CHINESE,NULL) == -1){ UB_LOG_WARNING("scw segment words failed"); return -1; } /*get result to vectore features*/ int i,count; token_t tokens[1024]; funit tmp; /*word type,we just need SCW_OUT_WPCOMP*/ u_int tsco[5] = {SCW_OUT_WPCOMP,SCW_OUT_BASIC,SCW_OUT_SUBPH, SCW_OUT_HUMANNAME,SCW_OUT_BOOKNAME}; /*just SCW_OUT_WPCOMP mode,so j < 1*/ for(int j = 0;j < 1;j ++) { count = scw_get_token_1(pout,tsco[j],tokens,1024); for(i = 0;i < count;i ++) { /*filter space and special punc*/ trim_string(tokens[i].buffer); if(strlen(tokens[i].buffer) <= 1) continue; tmp.feature = tokens[i].buffer; tmp.weight = 1; features.push_back(tmp); } } /*get weight*/ feature_weight(features,type); /*output result for debug*/ for(i = 0;i < (int)features.size();i++) { tmp = features.at(i); UB_LOG_DEBUG("word[%s] weight[%f]",tmp.feature.c_str(),tmp.weight); } return 0;}
开发者ID:samevers,项目名称:dlg_service,代码行数:59,
示例19: mainint main() { char *temp = " I struggle with strings in C./n"; trim_string(temp); printf("%s", temp); return 0;}
开发者ID:CCJY,项目名称:coliru,代码行数:8,
示例20: parse_one_parameterint parse_one_parameter ( char *buffer){ char name[MAXPARAMLINELENGTH+1]; char data[MAXPARAMLINELENGTH+1]; int i, j, k, l; int n, d; k = -1; j = 0; l = strlen ( buffer ); /** scan for a equals sign. **/ for ( i = 0; i < l; ++i ) { /* j records whether or not we have found a nonwhitespace character. */ j += (buffer[i] != ' ' && buffer[i] != '/t' && buffer[i] != '/n'); if ( buffer[i] == '=' ) { k = i; /* copy the name part. */ strncpy ( name, buffer, k ); name[k] = 0; /* copy the value part. */ strcpy ( data, buffer+k+1 ); break; } } /* if we found no '=', return an error unless the line was completely blank. */ if ( k == -1 ) return !!j; /* trim leading and trailing whitespace. */ n = trim_string ( name ); d = trim_string ( data ); /** if either section is blank, return an error, otherwise add the pair as a parameter. **/ if ( n == 0 || d == 0 ) return 1; else add_parameter ( name, data, PARAM_COPY_NAME|PARAM_COPY_VALUE ); return 0;}
开发者ID:ant-2014,项目名称:Pathfinder2014,代码行数:45,
示例21: SNUM/****************************************************************************Build the print command in the supplied buffer. This means getting theprint command for the service and inserting the printer name and theprint file name. Return NULL on error, else the passed buffer pointer.****************************************************************************/static char *build_print_command(int cnum, char *command, char *syscmd, char *filename1){ int snum = SNUM(cnum); char *tstr; pstring filename; /* get the print command for the service. */ tstr = command; if (!syscmd || !tstr) { DEBUG(0,("No print command for service `%s'/n", SERVICE(snum))); return (NULL); } /* copy the command into the buffer for extensive meddling. */ StrnCpy(syscmd, tstr, sizeof(pstring) - 1); /* look for "%s" in the string. If there is no %s, we cannot print. */ if (!strstr(syscmd, "%s") && !strstr(syscmd, "%f")) { DEBUG(2,("WARNING! No placeholder for the filename in the print command for service %s!/n", SERVICE(snum))); } if (strstr(syscmd,"%s")) { int iOffset = PTR_DIFF(strstr(syscmd, "%s"),syscmd); /* construct the full path for the filename, shouldn't be necessary unless the subshell causes a "cd" to be executed. Only use the full path if there isn't a / preceding the %s */ if (iOffset==0 || syscmd[iOffset-1] != '/') { StrnCpy(filename,Connections[cnum].connectpath,sizeof(filename)-1); trim_string(filename,"","/"); pstrcat(filename,"/"); pstrcat(filename,filename1); } else pstrcpy(filename,filename1); string_sub(syscmd, "%s", filename); } string_sub(syscmd, "%f", filename1); /* Does the service have a printername? If not, make a fake and empty */ /* printer name. That way a %p is treated sanely if no printer */ /* name was specified to replace it. This eventuality is logged. */ tstr = PRINTERNAME(snum); if (tstr == NULL || tstr[0] == '/0') { DEBUG(3,( "No printer name - using %s./n", SERVICE(snum))); tstr = SERVICE(snum); } string_sub(syscmd, "%p", tstr); standard_sub(cnum,syscmd); return (syscmd);}
开发者ID:earthGavinLee,项目名称:hg556a_source,代码行数:61,
示例22: trim_stringstring RecordedSentence::get_sentence_content() { if (sentence_content.length() == 0) { sentence_content = ""; for (int i = 0; i < (int) phrases.size(); ++i) { sentence_content = sentence_content + " " + phrases[i].get_phrase_content(); } trim_string(sentence_content); } return sentence_content;}
开发者ID:phamlequang,项目名称:vietnamese-synthesis-system,代码行数:10,
示例23: get_valuechar* get_value(char* buff){ char *buff2 = strdup(buff); char* prop = strtok(buff2, CONF_SYMBOL); strtok(buff2, "="); char* value = strtok(NULL,CONF_SYMBOL); char value2[200]; strncpy(value2, value, 200); return trim_string(value);}
开发者ID:jantwisted,项目名称:owlclient,代码行数:10,
示例24: get_countint get_count(char* buff, FILE* fp, int *line_size){ char* str = trim_string(buff); char* line = NULL; size_t len; size_t read; int count=0; while((read=getline(&line, &len, fp))!=-1) { count += strlen(line); if (strcmp(trim_string(get_prop(line)), str)==0) { *line_size = count; count = count-strlen(line)+strlen(str); break; } } return count;}
开发者ID:jantwisted,项目名称:owlclient,代码行数:19,
示例25: istgt_uctl_cmd_executestatic intistgt_uctl_cmd_execute(UCTL_Ptr uctl){ int (*func) (UCTL_Ptr); const char *delim = ARGS_DELIM; char *arg; char *cmd; int rc; int i; arg = trim_string(uctl->recvbuf); cmd = strsepq(&arg, delim); uctl->arg = arg; uctl->cmd = strupr(cmd); func = NULL; for (i = 0; istgt_uctl_cmd_table[i].name != NULL; i++) { if (cmd[0] == istgt_uctl_cmd_table[i].name[0] && strcmp(cmd, istgt_uctl_cmd_table[i].name) == 0) { func = istgt_uctl_cmd_table[i].func; break; } } if (func == NULL) { istgt_uctl_snprintf(uctl, "ERR unknown command/n"); rc = istgt_uctl_writeline(uctl); if (rc != UCTL_CMD_OK) { return UCTL_CMD_DISCON; } return UCTL_CMD_ERR; } if (uctl->no_auth && (strcasecmp(cmd, "AUTH") == 0)) { istgt_uctl_snprintf(uctl, "ERR auth not required/n"); rc = istgt_uctl_writeline(uctl); if (rc != UCTL_CMD_OK) { return UCTL_CMD_DISCON; } return UCTL_CMD_ERR; } if (uctl->req_auth && uctl->authenticated == 0 && !(strcasecmp(cmd, "QUIT") == 0 || strcasecmp(cmd, "AUTH") == 0)) { istgt_uctl_snprintf(uctl, "ERR auth required/n"); rc = istgt_uctl_writeline(uctl); if (rc != UCTL_CMD_OK) { return UCTL_CMD_DISCON; } return UCTL_CMD_ERR; } rc = func(uctl); return rc;}
开发者ID:elastocloud,项目名称:istgt,代码行数:55,
注:本文中的trim_string函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tripoint函数代码示例 C++ trim_len函数代码示例 |