本文整理汇总了C++中parse_flags函数的典型用法代码示例。如果您正苦于以下问题:C++ parse_flags函数的具体用法?C++ parse_flags怎么用?C++ parse_flags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_flags函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse_flags
void WIPLogger::debug( unsigned int flags,char* buffer,... )
{
parse_flags(flags);
printf(_current_line.data());
printf(" ");
va_list vl;
va_start(vl,buffer);
vprintf(buffer,vl);
va_end(vl);
printf("\n");
if(!m_initialized)
return;
parse_flags(flags);
va_list vl1;
char temp[MAX_SINGLE_LINE_CHAR_NUM];
va_start(vl1,buffer);
vsprintf(temp,buffer,vl1);
va_end(vl1);
_current_line += temp;
_current_line += '\n';
_buf += _current_line;
_current_lines++;
if(_current_lines>=MAX_DEBUG_LINE_LEN)
{
flush();
}
}
示例2: main
int
main(int argc, char **argv)
{
int i = 1;
int flags;
if(argc > 1 && argv[1][0] == '-') {
flags = parse_flags(argv[1]);
i = 2;
} else
flags = parse_flags(NULL);
list_files(stdout, (const char **)argv + i, argc - i, flags);
return 0;
}
示例3: command_add
/*
*
* vivi> part add <name> <offset> <size> <flag>
*
* add (argv[0]): command of mtd partition
* <name> (argv[1]): name of partition.
* <offset> (argv[2]): offset of partition.
* <size> (argv[3]): size of partition.
* <flag> (argv[4]): flag of partition.
*/
static void command_add(int argc, const char **argv)
{
mtd_partition_t part;
int ret;
if (argc != 5) {
invalid_cmd("part add", part_cmds);
return;
}
if (argv[1] == NULL) goto error_parse_arg;
if (strlen(argv[1]) >= MAX_PART_NAME) {
printk("too long partition name\n");
}
strncpy((char *)part.name, argv[1], strlen(argv[1]) + 1);
part.offset = strtoul(argv[2], NULL, 0, &ret);
if (ret) goto error_parse_arg;
part.size = strtoul(argv[3], NULL, 0, &ret);
if (ret) goto error_parse_arg;
part.flag = parse_flags((char *)argv[4]);
add_mtd_partition(&part);
printk("%s: offset = 0x%08lx, size = 0x%08lx, flag = %d\n",
part.name, part.offset, part.size, part.flag);
return;
error_parse_arg:
printk("Can't parsing arguments\n");
return;
}
示例4: builtin_ls
int
builtin_ls(FILE *out, const char *file)
{
int flags;
int ret;
if(*file == '-') {
flags = parse_flags(file);
file = ".";
} else
flags = parse_flags("");
ret = list_files(out, &file, 1, flags);
sec_fflush(out);
return ret;
}
示例5: sscanf
void
Face::SetProperty( const std::string &name,
const std::string &value )
{
if (name == "size") {
sscanf( value.c_str(), "%u", &size );
return;
}
if (name == "height") {
sscanf( value.c_str(), "%u", &height );
return;
}
if (name == "ascender") {
sscanf( value.c_str(), "%d", &ascender );
return;
}
if (name == "descender") {
sscanf( value.c_str(), "%d", &descender );
return;
}
if (name == "maxadvance") {
sscanf( value.c_str(), "%d", &maxadvance );
return;
}
if (name == "blittingflags") {
parse_flags( value.c_str(), &blittingflags );
return;
}
}
示例6: sr_metex14_parse
/**
* Parse a protocol packet.
*
* @param buf Buffer containing the protocol packet. Must not be NULL.
* @param floatval Pointer to a float variable. That variable will be modified
* in-place depending on the protocol packet. Must not be NULL.
* @param analog Pointer to a struct sr_datafeed_analog. The struct will be
* filled with data according to the protocol packet.
* Must not be NULL.
* @param info Pointer to a struct metex14_info. The struct will be filled
* with data according to the protocol packet. Must not be NULL.
*
* @return SR_OK upon success, SR_ERR upon failure. Upon errors, the
* 'analog' variable contents are undefined and should not be used.
*/
SR_PRIV int sr_metex14_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
{
int ret, exponent = 0;
struct metex14_info *info_local;
info_local = (struct metex14_info *)info;
/* Don't print byte 13. That one contains the carriage return. */
sr_dbg("DMM packet: \"%.13s\"", buf);
memset(info_local, 0x00, sizeof(struct metex14_info));
if ((ret = parse_value(buf, info_local, floatval, &exponent)) != SR_OK) {
sr_dbg("Error parsing value: %d.", ret);
return ret;
}
parse_flags((const char *)buf, info_local);
handle_flags(analog, floatval, &exponent, info_local);
analog->encoding->digits = -exponent;
analog->spec->spec_digits = -exponent;
return SR_OK;
}
示例7: parse_cb
static int parse_cb (void *arg, const char *section, const char *name,
const char *value)
{
struct cf_file *cf = arg;
struct cf_instrument *cfi = hash_find (cf->db, section);
if (!cfi)
cfi = cfi_create (cf, section);
if (!cfi)
goto error;
if (!strcmp (name, "address"))
snprintf (cfi->addr, MAX_GPIB_ADDR, "%s", value);
else if (!strcmp (name, "manufacturer"))
snprintf (cfi->make, MAX_GPIB_MAKE, "%s", value);
else if (!strcmp (name, "model"))
snprintf (cfi->model, MAX_GPIB_MODEL, "%s", value);
else if (!strcmp (name, "idn"))
snprintf (cfi->idncmd, MAX_GPIB_IDNCMD, "%s", value);
else if (!strcmp (name, "flags")) {
if (parse_flags (value, &cfi->flags) < 0)
goto error;
} else {
fprintf (stderr, "unknown config file attribute '%s'\n", name);
goto error;
}
return 1; /* ini success */
error:
return 0; /* ini error */
}
示例8: save_file_metadata
static void save_file_metadata(filedelete* f,
const drakvuf_trap_info_t* info,
int sequence_number,
addr_t control_area,
const char* filename,
size_t file_size,
uint64_t fo_flags,
uint32_t ntstatus = 0)
{
char* file = NULL;
if ( asprintf(&file, "%s/file.%06d.metadata", f->dump_folder, sequence_number) < 0 )
return;
FILE* fp = fopen(file, "w");
free(file);
if (!fp)
return;
fprintf(fp, "FileName: \"%s\"\n", filename ?: "<UNKNOWN>");
fprintf(fp, "FileSize: %zu\n", file_size);
fprintf(fp, "FileFlags: 0x%lx (%s)\n", fo_flags, parse_flags(fo_flags, fo_flags_map, OUTPUT_DEFAULT, "0").c_str());
fprintf(fp, "SequenceNumber: %d\n", sequence_number);
fprintf(fp, "ControlArea: 0x%lx\n", control_area);
fprintf(fp, "PID: %" PRIu64 "\n", static_cast<uint64_t>(info->proc_data.pid));
fprintf(fp, "PPID: %" PRIu64 "\n", static_cast<uint64_t>(info->proc_data.ppid));
fprintf(fp, "ProcessName: \"%s\"\n", info->proc_data.name);
if (ntstatus)
fprintf(fp, "WARNING: The file have been read partially with status 0x%x\n", ntstatus);
fclose(fp);
}
示例9: sr_vc870_parse
SR_PRIV int sr_vc870_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog_old *analog, void *info)
{
int ret;
struct vc870_info *info_local;
info_local = (struct vc870_info *)info;
memset(info_local, 0, sizeof(struct vc870_info));
if (!sr_vc870_packet_valid(buf))
return SR_ERR;
parse_flags(buf, info_local);
if ((ret = parse_value(buf, info_local, floatval)) != SR_OK) {
sr_dbg("Error parsing value: %d.", ret);
return ret;
}
if ((ret = parse_range(buf[2], floatval, info_local)) != SR_OK)
return ret;
handle_flags(analog, floatval, info_local);
return SR_OK;
}
示例10: lwt_template_parse
apr_status_t lwt_template_parse (const char *filename, lua_State *L,
const char *flags, apr_pool_t *pool, apr_array_header_t **t,
const char **err) {
parser_rec *p;
apr_status_t status;
p = (parser_rec *) apr_pcalloc(pool, sizeof(parser_rec));
p->filename = filename;
p->L = L;
p->flags = parse_flags(flags != NULL ? flags : TEMPLATE_DEFAULT_FLAGS);
p->pool = pool;
p->t = apr_array_make(pool, 32, sizeof(template_node_t));
p->b = apr_array_make(pool, 8, sizeof(block_t));
status = parse_template(p);
if (status == APR_SUCCESS) {
if (!apr_is_empty_array(p->b)) {
status = parse_error(p, apr_psprintf(p->pool,
"%d open elements at end of template",
p->b->nelts));
}
}
if (status != APR_SUCCESS) {
if (err != NULL) {
*err = p->err;
}
return status;
}
if (t != NULL) {
*t = p->t;
}
return APR_SUCCESS;
}
示例11: parse_ticket_flags
static void
parse_ticket_flags(krb5_context context,
const char *string, krb5_ticket_flags *ret_flags)
{
TicketFlags ff;
int flags = parse_flags(string, asn1_TicketFlags_units(), 0);
if (flags == -1) /* XXX */
krb5_errx(context, 1, "bad flags specified: \"%s\"", string);
memset(&ff, 0, sizeof(ff));
ff.proxy = 1;
if (parse_flags("proxy", asn1_TicketFlags_units(), 0) == TicketFlags2int(ff))
ret_flags->i = flags;
else
ret_flags->i = bitswap32(flags);
}
示例12: main
int main(int argc, char *argv[])
{
parse_flags(argc, argv);
call_flags();
if (fflush(0) != 0) return 112;
return 0;
}
示例13: parse_argpos
char *parse_options(char *params, t_options *options, t_list *output)
{
params = parse_argpos(params, options, output);
params = parse_flags(params, options);
params = parse_field_width(params, options, output);
check_field_width(options);
params = parse_precision(params, options, output);
params = parse_casters(params, options);
return (params);
}
示例14: load_flags
static void load_flags(void)
{
unsigned int i, j;
/* Use "key" for temporary storage */
if (getconf_line(&key,"flags",0)) {
parse_flags(key.s,key.len);
}
else if (getconf(&key,"config",0)) {
for (i = 0; i < key.len; ++i) {
for (j = i; j < key.len && key.s[j] != 0; ++j)
;
if (key.s[i] == 'F' && key.s[i+1] == ':') {
parse_flags(key.s+i+2,j-i-2);
return;
}
i = j;
}
}
}
示例15: handle_conversion
int handle_conversion(t_env *e, va_list ap)
{
if (check_percent_percent(e) || e->str[e->current] == '\0')
return (0);
parse_flags(e);
parse_width(e, ap);
parse_precision(e, ap);
parse_modificator(e);
parse_convertor(e);
return (1);
}