这篇教程C++ str_append_char函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中str_append_char函数的典型用法代码示例。如果您正苦于以下问题:C++ str_append_char函数的具体用法?C++ str_append_char怎么用?C++ str_append_char使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了str_append_char函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ftp_write_str_commonstatic voidftp_write_str_common(struct vsf_session* p_sess, int status, char sep, const struct mystr* p_str){ static struct mystr s_write_buf_str; static struct mystr s_text_mangle_str; int retval; if (tunable_log_ftp_protocol) { str_alloc_ulong(&s_write_buf_str, (unsigned long) status); str_append_char(&s_write_buf_str, sep); str_append_str(&s_write_buf_str, p_str); vsf_log_line(p_sess, kVSFLogEntryFTPOutput, &s_write_buf_str); } str_copy(&s_text_mangle_str, p_str); /* Process the output response according to the specifications.. */ /* Escape telnet characters properly */ str_replace_text(&s_text_mangle_str, "/377", "/377/377"); /* Change /n for /0 in response */ str_replace_char(&s_text_mangle_str, '/n', '/0'); /* Build string to squirt down network */ str_alloc_ulong(&s_write_buf_str, (unsigned long) status); str_append_char(&s_write_buf_str, sep); str_append_str(&s_write_buf_str, &s_text_mangle_str); str_append_text(&s_write_buf_str, "/r/n"); retval = ftp_write_str(p_sess, &s_write_buf_str, kVSFRWControl); if (retval != 0) { die("ftp_write"); }}
开发者ID:nikatshun,项目名称:asuswrt-merlin,代码行数:31,
示例2: ssl_cert_digeststatic intssl_cert_digest(SSL* p_ssl, struct vsf_session* p_sess, struct mystr* p_str){ X509* p_cert = SSL_get_peer_certificate(p_ssl); unsigned int num_bytes = 0; if (p_cert == NULL) { return 0; } str_reserve(p_str, EVP_MAX_MD_SIZE); str_empty(p_str); str_rpad(p_str, EVP_MAX_MD_SIZE); if (!X509_digest(p_cert, EVP_sha256(), (unsigned char*) str_getbuf(p_str), &num_bytes)) { die("X509_digest failed"); } X509_free(p_cert); if (tunable_debug_ssl) { unsigned int i; str_alloc_text(&debug_str, "Cert digest:"); for (i = 0; i < num_bytes; ++i) { str_append_char(&debug_str, ' '); str_append_ulong( &debug_str, (unsigned long) (unsigned char) str_get_char_at(p_str, i)); } vsf_log_line(p_sess, kVSFLogEntryDebug, &debug_str); } str_trunc(p_str, num_bytes); return 1;}
开发者ID:arrrbiter,项目名称:flowftpd,代码行数:33,
示例3: handle_per_user_configstatic voidhandle_per_user_config(const struct mystr* p_user_str){ struct mystr filename_str = INIT_MYSTR; struct vsf_sysutil_statbuf* p_statbuf = 0; struct str_locate_result loc_result; int retval; if (!tunable_user_config_dir) { return; } /* Security paranoia - ignore if user has a / in it. */ loc_result = str_locate_char(p_user_str, '/'); if (loc_result.found) { return; } str_alloc_text(&filename_str, tunable_user_config_dir); str_append_char(&filename_str, '/'); str_append_str(&filename_str, p_user_str); retval = str_stat(&filename_str, &p_statbuf); if (!vsf_sysutil_retval_is_error(retval)) { /* Security - file ownership check now in vsf_parseconf_load_file() */ vsf_parseconf_load_file(str_getbuf(&filename_str), 1); } else if (vsf_sysutil_get_error() != kVSFSysUtilErrNOENT) { die("error opening per-user config file"); } str_free(&filename_str); vsf_sysutil_free(p_statbuf);}
开发者ID:DarkAyron,项目名称:dragonsunited_minecraft_installer,代码行数:33,
示例4: ipv6_parse_hexstatic intipv6_parse_hex(struct mystr* p_out_str, const struct mystr* p_in_str){ unsigned int len = str_getlen(p_in_str); unsigned int i; unsigned int val = 0; for (i=0; i<len; ++i) { int ch = vsf_sysutil_toupper(str_get_char_at(p_in_str, i)); if (ch >= '0' && ch <= '9') { ch -= '0'; } else if (ch >= 'A' && ch <= 'F') { ch -= 'A'; ch += 10; } else { return 0; } val <<= 4; val |= ch; if (val > 0xFFFF) { return 0; } } str_append_char(p_out_str, (val >> 8)); str_append_char(p_out_str, (val & 0xFF)); return 1;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:33,
示例5: vsf_cmdio_get_cmd_and_argvoidvsf_cmdio_get_cmd_and_arg(struct vsf_session* p_sess, struct mystr* p_cmd_str, struct mystr* p_arg_str, int set_alarm){ /* Prepare an alarm to timeout the session.. */ if (set_alarm) { vsf_cmdio_set_alarm(p_sess); } /* Blocks */ control_getline(p_cmd_str, p_sess); str_split_char(p_cmd_str, p_arg_str, ' '); str_upper(p_cmd_str); if (tunable_log_ftp_protocol) { static struct mystr s_log_str; if (str_equal_text(p_cmd_str, "PASS")) { str_alloc_text(&s_log_str, "PASS <password>"); } else { str_copy(&s_log_str, p_cmd_str); if (!str_isempty(p_arg_str)) { str_append_char(&s_log_str, ' '); str_append_str(&s_log_str, p_arg_str); } } vsf_log_line(p_sess, kVSFLogEntryFTPInput, &s_log_str); }}
开发者ID:kitsune-dsu,项目名称:kitsune-vsftpd,代码行数:32,
示例6: handle_per_user_configstatic voidhandle_per_user_config(const struct mystr* p_user_str){ struct mystr filename_str = INIT_MYSTR; struct vsf_sysutil_statbuf* p_statbuf = 0; struct str_locate_result loc_result; int retval; if (!tunable_user_config_dir) { return; } /* Security paranoia - ignore if user has a / in it. */ loc_result = str_locate_char(p_user_str, '/'); if (loc_result.found) { return; } str_alloc_text(&filename_str, tunable_user_config_dir); str_append_char(&filename_str, '/'); str_append_str(&filename_str, p_user_str); retval = str_stat(&filename_str, &p_statbuf); /* Security - ignore unless owned by root */ if (!vsf_sysutil_retval_is_error(retval) && vsf_sysutil_statbuf_get_uid(p_statbuf) == VSFTP_ROOT_UID) { vsf_parseconf_load_file(str_getbuf(&filename_str), 1); } str_free(&filename_str); vsf_sysutil_free(p_statbuf);}
开发者ID:kitsune-dsu,项目名称:kitsune-vsftpd,代码行数:30,
示例7: do_error/*-----------------------------------------------------------------------------* Output error message*----------------------------------------------------------------------------*/static void do_error( enum ErrType err_type, char *message ){ STR_DEFINE(msg, STR_SIZE); size_t len_at, len_prefix; init_module(); /* init empty message */ str_clear( msg ); /* Information messages have no prefix */ if ( err_type != ErrInfo ) { str_append( msg, err_type == ErrWarn ? "Warning" : "Error" ); /* prepare to remove " at" if no prefix */ len_at = str_len(msg); str_append( msg, " at" ); len_prefix = str_len(msg); /* output filename */ if ( errors.filename && *errors.filename ) str_append_sprintf( msg, " file '%s'", errors.filename ); /* output module */ if ( errors.module != NULL && *errors.module ) str_append_sprintf( msg, " module '%s'", errors.module ); /* output line number */ if ( errors.line > 0 ) str_append_sprintf( msg, " line %d", errors.line ); /* remove at if no prefix */ if ( len_prefix == str_len(msg) ) /* no prefix loaded to string */ { str_data(msg)[ len_at ] = '/0'; /* go back 3 chars to before at */ str_sync_len( msg ); } str_append( msg, ": " ); } /* output error message */ str_append( msg, message ); str_append_char( msg, '/n' ); /* CH_0001 : Assembly error messages should appear on stderr */ fputs( str_data(msg), stderr ); /* send to error file */ puts_error_file( str_data(msg) ); if ( err_type == ErrError ) errors.count++; /* count number of errors */ STR_DELETE(msg);}
开发者ID:meesokim,项目名称:z88dk,代码行数:60,
示例8: str_dup/* Obtain a unique name based on the (primary) feature type associated with the specified category number. Returns a pointer to a newly allocated String.*/String *cm_get_feature_unique(CategoryMap *cm, int cat) { String *retval = str_dup(lst_get_ptr(cm->ranges[cat]->feature_types, 0)); if (! (cat >= 0 && cat <= cm->ncats)) die("ERROR cm_get_feature_unique: cat=%i, should be in [0,%i]/n", cat, cm->ncats); if (cm->ranges[cat]->start_cat_no != cm->ranges[cat]->end_cat_no) { str_append_char(retval, '-'); str_append_int(retval, cat - cm->ranges[cat]->start_cat_no + 1); } return retval;}
开发者ID:HanLabUNLV,项目名称:Phasterate,代码行数:14,
示例9: str_append_string/* ------------------------------------------------------------------------- */str_t str_append_string(str_t str, const char* s) { if (!str_error(str) && (NULL != s)) { /* * @todo(dr) Yeah, uh, this could be optimized. */ for (; *s && !str_error(str); ++s) { str_append_char(str, *s); } } return str;} /* str_append_string() */
开发者ID:doug16rogers,项目名称:dr,代码行数:12,
示例10: ipv4_parse_dotquadstatic intipv4_parse_dotquad(struct mystr* p_out_str, const struct mystr* p_in_str){ unsigned int len = str_getlen(p_in_str); unsigned int i; unsigned int val = 0; unsigned int final_val = 0; int seen_char = 0; int dots = 0; for (i=0; i<len; ++i) { int ch = str_get_char_at(p_in_str, i); if (ch == '.') { if (!seen_char || dots == 3) { return 0; } seen_char = 0; dots++; final_val <<= 8; final_val |= val; val = 0; } else if (ch >= '0' && ch <= '9') { ch -= '0'; val *= 10; val += ch; if (val > 255) { return 0; } seen_char = 1; } else { return 0; } } if (dots != 3 || !seen_char) { return 0; } final_val <<= 8; final_val |= val; str_append_char(p_out_str, (final_val >> 24)); str_append_char(p_out_str, ((final_val >> 16) & 0xFF)); str_append_char(p_out_str, ((final_val >> 8) & 0xFF)); str_append_char(p_out_str, (final_val & 0xFF)); return 1;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:52,
示例11: str_rpadvoidstr_rpad(struct mystr* p_str, const unsigned int min_width){ unsigned int to_pad; if (p_str->len >= min_width) { return; } to_pad = min_width - p_str->len; while (to_pad--) { str_append_char(p_str, ' '); }}
开发者ID:Einheri,项目名称:wl500g,代码行数:14,
示例12: setup_username_globalsstatic voidsetup_username_globals(struct vsf_session* p_sess, const struct mystr* p_str){ str_copy(&p_sess->user_str, p_str); if (tunable_setproctitle_enable) { struct mystr prefix_str = INIT_MYSTR; str_copy(&prefix_str, &p_sess->remote_ip_str); str_append_char(&prefix_str, '/'); str_append_str(&prefix_str, p_str); vsf_sysutil_set_proctitle_prefix(&prefix_str); str_free(&prefix_str); }}
开发者ID:AllardJ,项目名称:Tomato,代码行数:14,
示例13: push_expr/* push current expression */static void push_expr(ParseCtx *ctx){ STR_DEFINE(expr_text, STR_SIZE); Expr *expr; Sym *expr_p; Bool last_was_prefix; /* build expression text - split constant prefixes from numbers and names */ str_clear(expr_text); last_was_prefix = FALSE; for (expr_p = ctx->expr_start; expr_p < ctx->p; expr_p++) { if (last_was_prefix && expr_p->tlen > 0 && (isalnum(*expr_p->tstart) || *expr_p->tstart == '"')) { str_append_char(expr_text, ' '); last_was_prefix = FALSE; } str_append_n(expr_text, expr_p->tstart, expr_p->tlen); if (expr_p->tlen > 0) { switch (expr_p->tstart[expr_p->tlen - 1]) { case '@': case '%': case '$': last_was_prefix = TRUE; break; default: last_was_prefix = FALSE; } } } /* parse expression */ expr = parse_expr(str_data(expr_text)); /* push the new expression, or NULL on error */ utarray_push_back(ctx->exprs, &expr); STR_DELETE(expr_text);}
开发者ID:bitfixer,项目名称:bitfixer,代码行数:46,
示例14: str_lpadvoidstr_lpad(struct mystr* p_str, const unsigned int min_width){ static struct mystr s_tmp_str; unsigned int to_pad; if (p_str->len >= min_width) { return; } to_pad = min_width - p_str->len; str_empty(&s_tmp_str); while (to_pad--) { str_append_char(&s_tmp_str, ' '); } str_append_str(&s_tmp_str, p_str); str_copy(p_str, &s_tmp_str);}
开发者ID:Einheri,项目名称:wl500g,代码行数:18,
|