您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ strncasecmp函数代码示例

51自学网 2021-06-03 08:31:20
  C++
这篇教程C++ strncasecmp函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中strncasecmp函数的典型用法代码示例。如果您正苦于以下问题:C++ strncasecmp函数的具体用法?C++ strncasecmp怎么用?C++ strncasecmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了strncasecmp函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

intmain(int argc, char *argv[]){	int i;	int opt;	while(1) {		opt = getopt_long(argc, argv, "aBcdDeHPstTvV", long_options, NULL);		if(opt == -1)			break;		switch(opt) {		case 'v':			verbose = 1;			break;		case 'a':#ifdef ENABLEGT			if (optarg != NULL && strncasecmp("gt", optarg, 2) == 0)				apimode = API_GT; #endif#ifdef ENABLEKSI			if (optarg != NULL && strncasecmp("ksi", optarg, 2) == 0)				apimode = API_KSI; #endif			if(verbose)				fprintf(stdout, "Setting Apimode: %s (%d)/n", optarg, apimode); 			break;		case 'd':			debug = 1;#ifdef ENABLEGT			rsgt_set_debug(debug); #endif#ifdef ENABLEKSI			rsksi_set_debug(debug); #endif			break;		case 's':#ifdef ENABLEGT			rsgt_read_showVerified = 1;#endif#ifdef ENABLEKSI			rsksi_read_showVerified = 1;#endif			break;		case 'V':			fprintf(stderr, "rsgtutil " VERSION "/n");			exit(0);		case 'D':			mode = MD_DUMP;			break;		case 'B':			mode = MD_SHOW_SIGBLK_PARAMS;			break;		case 'P':#ifdef ENABLEGT			rsgt_read_puburl = optarg;#endif#ifdef ENABLEKSI			rsksi_read_puburl = optarg;#endif			break;		case 'T':			mode = MD_DETECT_FILE_TYPE;			break;		case 't':			mode = MD_VERIFY;			break;		case 'e':			mode = MD_EXTEND;			break;		case 'c':			mode = MD_CONVERT;			break;		case 'h':		case '?':			rsgtutil_usage();			return 0;		default:			fprintf(stderr, "getopt_long() returns unknown value %d/n", opt);			return 1;		}	}	if(optind == argc)		processFile("-");	else {		for(i = optind ; i < argc ; ++i)			processFile(argv[i]);	}	return 0;}
开发者ID:schiele,项目名称:rsyslog,代码行数:91,


示例2: curl_easy_setopt

json_t *json_rpc_call(CURL *curl, const char *url,		      const char *userpass, const char *rpc_req,		      bool longpoll_scan, bool longpoll, int *curl_err){	json_t *val, *err_val, *res_val;	int rc;	struct data_buffer all_data = {0};	struct upload_buffer upload_data;	json_error_t err;	struct curl_slist *headers = NULL;	char len_hdr[64];	char curl_err_str[CURL_ERROR_SIZE];	long timeout = longpoll ? opt_timeout : 30;	struct header_info hi = {0};	bool lp_scanning = longpoll_scan && !have_longpoll;	/* it is assumed that 'curl' is freshly [re]initialized at this pt */	if (opt_protocol)		curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);	curl_easy_setopt(curl, CURLOPT_URL, url);	if (opt_cert)		curl_easy_setopt(curl, CURLOPT_CAINFO, opt_cert);	curl_easy_setopt(curl, CURLOPT_ENCODING, "");	curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);	curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);	curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);	curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb);	curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data);	curl_easy_setopt(curl, CURLOPT_READFUNCTION, upload_data_cb);	curl_easy_setopt(curl, CURLOPT_READDATA, &upload_data);#if LIBCURL_VERSION_NUM >= 0x071200	curl_easy_setopt(curl, CURLOPT_SEEKFUNCTION, &seek_data_cb);	curl_easy_setopt(curl, CURLOPT_SEEKDATA, &upload_data);#endif	curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_err_str);	curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);	curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);	curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, resp_hdr_cb);	curl_easy_setopt(curl, CURLOPT_HEADERDATA, &hi);	if (opt_proxy) {		curl_easy_setopt(curl, CURLOPT_PROXY, opt_proxy);		curl_easy_setopt(curl, CURLOPT_PROXYTYPE, opt_proxy_type);	}	if (userpass) {		curl_easy_setopt(curl, CURLOPT_USERPWD, userpass);		curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);	}#if LIBCURL_VERSION_NUM >= 0x070f06	if (longpoll)		curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_keepalive_cb);#endif	curl_easy_setopt(curl, CURLOPT_POST, 1);	if (opt_protocol)		applog(LOG_DEBUG, "JSON protocol request:/n%s/n", rpc_req);	upload_data.buf = rpc_req;	upload_data.len = strlen(rpc_req);	upload_data.pos = 0;	sprintf(len_hdr, "Content-Length: %lu",		(unsigned long) upload_data.len);	headers = curl_slist_append(headers, "Content-Type: application/json");	headers = curl_slist_append(headers, len_hdr);	headers = curl_slist_append(headers, "User-Agent: " USER_AGENT);	headers = curl_slist_append(headers, "X-Mining-Extensions: midstate");	headers = curl_slist_append(headers, "Accept:"); /* disable Accept hdr*/	headers = curl_slist_append(headers, "Expect:"); /* disable Expect hdr*/	curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);	rc = curl_easy_perform(curl);	if (curl_err != NULL)		*curl_err = rc;	if (rc) {		if (!(longpoll && rc == CURLE_OPERATION_TIMEDOUT))			applog(LOG_ERR, "HTTP request failed: %s", curl_err_str);		goto err_out;	}	/* If X-Stratum was found, activate Stratum */	if (want_stratum && hi.stratum_url &&	    !strncasecmp(hi.stratum_url, "stratum+tcp://", 14)) {		have_stratum = true;		tq_push(thr_info[stratum_thr_id].q, hi.stratum_url);		hi.stratum_url = NULL;	}	/* If X-Long-Polling was found, activate long polling */	if (lp_scanning && hi.lp_path && !have_stratum) {		have_longpoll = true;		tq_push(thr_info[longpoll_thr_id].q, hi.lp_path);		hi.lp_path = NULL;	}	if (!all_data.buf) {		applog(LOG_ERR, "Empty data received in json_rpc_call.");		goto err_out;	}//.........这里部分代码省略.........
开发者ID:1gh,项目名称:cpuminer,代码行数:101,


示例3: make_unix_time

/* Parse an HTTP datestamp into Unix time */static time_tmake_unix_time(char *s){  struct tm time;  int i, ysub = 1900, fmt = 0;  char *month;  char *n;  time_t res;  if (s[3] != ' ')    {      fmt = 1;      if (s[3] != ',')	ysub = 0;    }  for (n = s; *n; ++n)    if (*n == '-' || *n == ':')      *n = ' ';  time.tm_mon = 0;  n = strchr(s, ' ');  if (fmt)    {      /* Day, DD-MMM-YYYY HH:MM:SS GMT */      time.tm_mday = strtol(n + 1, &n, 0);      month = n + 1;      n = strchr(month, ' ');      time.tm_year = strtol(n + 1, &n, 0);      time.tm_hour = strtol(n + 1, &n, 0);      time.tm_min = strtol(n + 1, &n, 0);      time.tm_sec = strtol(n + 1, NULL, 0);    }  else    {      /* Unix ctime() format. Does not conform to HTTP spec. */      /* Day MMM DD HH:MM:SS YYYY */      month = n + 1;      n = strchr(month, ' ');      while (isspace(*n))	n++;      time.tm_mday = strtol(n, &n, 0);      time.tm_hour = strtol(n + 1, &n, 0);      time.tm_min = strtol(n + 1, &n, 0);      time.tm_sec = strtol(n + 1, &n, 0);      time.tm_year = strtol(n + 1, NULL, 0);    }  if (time.tm_year > 100)    time.tm_year -= ysub;  for (i = 0; i < 12; i++)    if (!strncasecmp(month, monthtab[i], 3))      {	time.tm_mon = i;	break;      }  time.tm_isdst = 0;		/* daylight saving is never in effect in GMT */  /* this is normally the value of extern int timezone, but some   * braindead C libraries don't provide it.   */  if (!tzchecked)    {      struct tm *tc;      time_t then = JAN02_1980;      tc = localtime(&then);      tzoff = (12 - tc->tm_hour) * 3600 + tc->tm_min * 60 + tc->tm_sec;      tzchecked = 1;    }  res = mktime(&time);  /* Unfortunately, mktime() assumes the input is in local time,   * not GMT, so we have to correct it here.   */  if (res != -1)    res += tzoff;  return res;}
开发者ID:Hero2000,项目名称:CainCamera,代码行数:77,


示例4: device_added

//.........这里部分代码省略.........        name = udev_device_get_sysattr_value(parent, "name");        LOG_SYSATTR(ppath, "name", name);        if (!name) {            name = udev_device_get_property_value(parent, "NAME");            LOG_PROPERTY(ppath, "NAME", name);        }        if (pnp_id)            attrs.pnp_id = strdup(pnp_id);        LOG_SYSATTR(ppath, "id", pnp_id);        /* construct USB ID in lowercase hex - "0000:ffff" */        if (product &&            sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {            if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_model)                == -1)                attrs.usb_id = NULL;            else                LOG_PROPERTY(ppath, "PRODUCT", product);        }    }    if (!name)        name = "(unnamed)";    else        attrs.product = strdup(name);    input_options = input_option_new(input_options, "name", name);    input_options = input_option_new(input_options, "path", path);    input_options = input_option_new(input_options, "device", path);    if (path)        attrs.device = strdup(path);    tags_prop = udev_device_get_property_value(udev_device, "ID_INPUT.tags");    LOG_PROPERTY(path, "ID_INPUT.tags", tags_prop);    attrs.tags = xstrtokenize(tags_prop, ",");    if (asprintf(&config_info, "udev:%s", syspath) == -1) {        config_info = NULL;        goto unwind;    }    if (device_is_duplicate(config_info)) {        LogMessage(X_WARNING, "config/udev: device %s already added. "                   "Ignoring./n", name);        goto unwind;    }    set = udev_device_get_properties_list_entry(udev_device);    udev_list_entry_foreach(entry, set) {        key = udev_list_entry_get_name(entry);        if (!key)            continue;        value = udev_list_entry_get_value(entry);        if (!strncasecmp(key, UDEV_XKB_PROP_KEY, sizeof(UDEV_XKB_PROP_KEY) - 1)) {            LOG_PROPERTY(path, key, value);            tmp = key + sizeof(UDEV_XKB_PROP_KEY) - 1;            if (!strcasecmp(tmp, "rules"))                input_options =                    input_option_new(input_options, "xkb_rules", value);            else if (!strcasecmp(tmp, "layout"))                input_options =                    input_option_new(input_options, "xkb_layout", value);            else if (!strcasecmp(tmp, "variant"))                input_options =                    input_option_new(input_options, "xkb_variant", value);            else if (!strcasecmp(tmp, "model"))                input_options =                    input_option_new(input_options, "xkb_model", value);            else if (!strcasecmp(tmp, "options"))                input_options =                    input_option_new(input_options, "xkb_options", value);        }        else if (!strcmp(key, "ID_VENDOR")) {            LOG_PROPERTY(path, key, value);            attrs.vendor = strdup(value);        }        else if (!strcmp(key, "ID_INPUT_KEY")) {            LOG_PROPERTY(path, key, value);            attrs.flags |= ATTR_KEYBOARD;        }        else if (!strcmp(key, "ID_INPUT_MOUSE")) {            LOG_PROPERTY(path, key, value);            attrs.flags |= ATTR_POINTER;        }        else if (!strcmp(key, "ID_INPUT_JOYSTICK")) {            LOG_PROPERTY(path, key, value);            attrs.flags |= ATTR_JOYSTICK;        }        else if (!strcmp(key, "ID_INPUT_TABLET")) {            LOG_PROPERTY(path, key, value);            attrs.flags |= ATTR_TABLET;        }        else if (!strcmp(key, "ID_INPUT_TOUCHPAD")) {            LOG_PROPERTY(path, key, value);            attrs.flags |= ATTR_TOUCHPAD;        }        else if (!strcmp(key, "ID_INPUT_TOUCHSCREEN")) {            LOG_PROPERTY(path, key, value);            attrs.flags |= ATTR_TOUCHSCREEN;        }    }
开发者ID:LeadHyperion,项目名称:RaspberryPiXServer,代码行数:101,


示例5: curl_open

static int curl_open(BlockDriverState *bs, QDict *options, int flags,                     Error **errp){    BDRVCURLState *s = bs->opaque;    CURLState *state = NULL;    QemuOpts *opts;    Error *local_err = NULL;    const char *file;    double d;    static int inited = 0;    if (flags & BDRV_O_RDWR) {        error_setg(errp, "curl block device does not support writes");        return -EROFS;    }    opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);    qemu_opts_absorb_qdict(opts, options, &local_err);    if (local_err) {        error_propagate(errp, local_err);        goto out_noclean;    }    s->readahead_size = qemu_opt_get_size(opts, "readahead", READ_AHEAD_SIZE);    if ((s->readahead_size & 0x1ff) != 0) {        error_setg(errp, "HTTP_READAHEAD_SIZE %zd is not a multiple of 512",                   s->readahead_size);        goto out_noclean;    }    file = qemu_opt_get(opts, "url");    if (file == NULL) {        error_setg(errp, "curl block driver requires an 'url' option");        goto out_noclean;    }    if (!inited) {        curl_global_init(CURL_GLOBAL_ALL);        inited = 1;    }    DPRINTF("CURL: Opening %s/n", file);    s->url = g_strdup(file);    state = curl_init_state(s);    if (!state)        goto out_noclean;    // Get file size    s->accept_range = false;    curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1);    curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION,                     curl_header_cb);    curl_easy_setopt(state->curl, CURLOPT_HEADERDATA, s);    if (curl_easy_perform(state->curl))        goto out;    curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d);    if (d)        s->len = (size_t)d;    else if(!s->len)        goto out;    if ((!strncasecmp(s->url, "http://", strlen("http://"))        || !strncasecmp(s->url, "https://", strlen("https://")))        && !s->accept_range) {        pstrcpy(state->errmsg, CURL_ERROR_SIZE,                "Server does not support 'range' (byte ranges).");        goto out;    }    DPRINTF("CURL: Size = %zd/n", s->len);    curl_clean_state(state);    curl_easy_cleanup(state->curl);    state->curl = NULL;    aio_timer_init(bdrv_get_aio_context(bs), &s->timer,                   QEMU_CLOCK_REALTIME, SCALE_NS,                   curl_multi_timeout_do, s);    // Now we know the file exists and its size, so let's    // initialize the multi interface!    s->multi = curl_multi_init();    curl_multi_setopt(s->multi, CURLMOPT_SOCKETDATA, s);    curl_multi_setopt(s->multi, CURLMOPT_SOCKETFUNCTION, curl_sock_cb);#ifdef NEED_CURL_TIMER_CALLBACK    curl_multi_setopt(s->multi, CURLMOPT_TIMERDATA, s);    curl_multi_setopt(s->multi, CURLMOPT_TIMERFUNCTION, curl_timer_cb);#endif    curl_multi_do(s);    qemu_opts_del(opts);    return 0;out:    fprintf(stderr, "CURL: Error opening file: %s/n", state->errmsg);    curl_easy_cleanup(state->curl);    state->curl = NULL;out_noclean:    g_free(s->url);//.........这里部分代码省略.........
开发者ID:AbnerChang,项目名称:RiscVQemuPcat,代码行数:101,


示例6: php_stream_wrapper_log_error

php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context, int redirect_max, int header_init STREAMS_DC TSRMLS_DC){	php_stream *stream = NULL;	php_url *resource = NULL;	int use_ssl;	int use_proxy = 0;	char *scratch = NULL;	char *tmp = NULL;	char *ua_str = NULL;	zval **ua_zval = NULL, **tmpzval = NULL;	int scratch_len = 0;	int body = 0;	char location[HTTP_HEADER_BLOCK_SIZE];	zval *response_header = NULL;	int reqok = 0;	char *http_header_line = NULL;	char tmp_line[128];	size_t chunk_size = 0, file_size = 0;	int eol_detect = 0;	char *transport_string, *errstr = NULL;	int transport_len, have_header = 0, request_fulluri = 0;	char *protocol_version = NULL;	int protocol_version_len = 3; /* Default: "1.0" */	struct timeval timeout;	char *user_headers = NULL;	tmp_line[0] = '/0';	if (redirect_max < 1) {		php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Redirection limit reached, aborting");		return NULL;	}	resource = php_url_parse(path);	if (resource == NULL) {		return NULL;	}	if (strncasecmp(resource->scheme, "http", sizeof("http")) && strncasecmp(resource->scheme, "https", sizeof("https"))) {		if (!context || 			php_stream_context_get_option(context, wrapper->wops->label, "proxy", &tmpzval) == FAILURE ||			Z_TYPE_PP(tmpzval) != IS_STRING ||			Z_STRLEN_PP(tmpzval) <= 0) {			php_url_free(resource);			return php_stream_open_wrapper_ex(path, mode, REPORT_ERRORS, NULL, context);		}		/* Called from a non-http wrapper with http proxying requested (i.e. ftp) */		request_fulluri = 1;		use_ssl = 0;		use_proxy = 1;		transport_len = Z_STRLEN_PP(tmpzval);		transport_string = estrndup(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval));	} else {		/* Normal http request (possibly with proxy) */			if (strpbrk(mode, "awx+")) {			php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP wrapper does not support writeable connections");			php_url_free(resource);			return NULL;		}		use_ssl = resource->scheme && (strlen(resource->scheme) > 4) && resource->scheme[4] == 's';		/* choose default ports */		if (use_ssl && resource->port == 0)			resource->port = 443;		else if (resource->port == 0)			resource->port = 80;		if (context &&			php_stream_context_get_option(context, wrapper->wops->label, "proxy", &tmpzval) == SUCCESS &&			Z_TYPE_PP(tmpzval) == IS_STRING &&			Z_STRLEN_PP(tmpzval) > 0) {			use_proxy = 1;			transport_len = Z_STRLEN_PP(tmpzval);			transport_string = estrndup(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval));		} else {			transport_len = spprintf(&transport_string, 0, "%s://%s:%d", use_ssl ? "ssl" : "tcp", resource->host, resource->port);		}	}	if (context && php_stream_context_get_option(context, wrapper->wops->label, "timeout", &tmpzval) == SUCCESS) {		SEPARATE_ZVAL(tmpzval);		convert_to_double_ex(tmpzval);		timeout.tv_sec = (time_t) Z_DVAL_PP(tmpzval);		timeout.tv_usec = (size_t) ((Z_DVAL_PP(tmpzval) - timeout.tv_sec) * 1000000);	} else {		timeout.tv_sec = FG(default_socket_timeout);		timeout.tv_usec = 0;	}	stream = php_stream_xport_create(transport_string, transport_len, options,			STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT,			NULL, &timeout, context, &errstr, NULL);    	if (stream) {		php_stream_set_option(stream, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &timeout);	}				if (errstr) {//.........这里部分代码省略.........
开发者ID:kennyb,项目名称:php-broken,代码行数:101,


示例7: set_info

//.........这里部分代码省略.........					      args[i], key, &wrq.u.data.flags);		      if(keylen > 0)			{			  wrq.u.data.length = keylen;			  wrq.u.data.pointer = (caddr_t) key;			  ++i;			  gotone++;			}		    }		  /* -- Check for token index -- */		  if((i < count) &&		     (sscanf(args[i], "[%i]", &temp) == 1) &&		     (temp > 0) && (temp < IW_ENCODE_INDEX))		    {		      wrq.u.encoding.flags |= temp;		      ++i;		      gotone++;		    }		  /* -- Check the various flags -- */		  if((i < count) && (!strcasecmp(args[i], "off")))		    {		      wrq.u.data.flags |= IW_ENCODE_DISABLED;		      ++i;		      gotone++;		    }		  if((i < count) && (!strcasecmp(args[i], "open")))		    {		      wrq.u.data.flags |= IW_ENCODE_OPEN;		      ++i;		      gotone++;		    }		  if((i < count) && (!strncasecmp(args[i], "restricted", 5)))		    {		      wrq.u.data.flags |= IW_ENCODE_RESTRICTED;		      ++i;		      gotone++;		    }		  if((i < count) && (!strncasecmp(args[i], "temporary", 4)))		    {		      wrq.u.data.flags |= IW_ENCODE_TEMP;		      ++i;		      gotone++;		    }		}	      while(gotone != oldone);	      /* Pointer is absent in new API */	      if(wrq.u.data.pointer == NULL)		wrq.u.data.flags |= IW_ENCODE_NOKEY;	      /* Check if we have any invalid argument */	      if(!gotone)		ABORT_ARG_TYPE("Set Encode", SIOCSIWENCODE, args[i]);	      /* Get back to last processed argument */	      --i;	    }	  IW_SET_EXT_ERR(skfd, ifname, SIOCSIWENCODE, &wrq,			 "Set Encode");	  continue;  	}      /* ---------- Set ESSID ---------- */      if(!strcasecmp(args[i], "essid"))
开发者ID:jhbsz,项目名称:actiontec_opensource_mi424wr-rev-acd-56-0-10-14-4,代码行数:67,


示例8: VSL_Glob2Tags

intVSL_Glob2Tags(const char *glob, int l, VSL_tagfind_f *func, void *priv){	int i, r, l2;	int pre = 0;	int post = 0;	char buf[64];	AN(glob);	if (l < 0)		l = strlen(glob);	if (l == 0 || l > sizeof buf - 1)		return (-1);	if (strchr(glob, '*') != NULL) {		if (glob[0] == '*') {			/* Prefix wildcard */			pre = 1;			glob++;			l--;		}		if (l > 0 && glob[l - 1] == '*') {			/* Postfix wildcard */			post = 1;			l--;		}	}	if (pre && post)		/* Support only post or prefix wildcards */		return (-3);	memcpy(buf, glob, l);	buf[l] = '/0';	if (strchr(buf, '*') != NULL)		/* No multiple wildcards */		return (-3);	if (pre == 0 && post == 0) {		/* No wildcards, use VSL_Name2Tag */		i = VSL_Name2Tag(buf, l);		if (i < 0)			return (i);		if (func != NULL)			(func)(i, priv);		return (1);	}	r = 0;	for (i = 0; i < SLT__MAX; i++) {		if (VSL_tags[i] == NULL)			continue;		l2 = strlen(VSL_tags[i]);		if (l2 < l)			continue;		if (pre) {			/* Prefix wildcard match */			if (strcasecmp(buf, VSL_tags[i] + l2 - l))				continue;		} else {			/* Postfix wildcard match */			if (strncasecmp(buf, VSL_tags[i], l))				continue;		}		if (func != NULL)			(func)(i, priv);		r++;	}	if (r == 0)		return (-1);	return (r);}
开发者ID:ElijahLynn,项目名称:Varnish-Cache,代码行数:68,


示例9: test_implicit_compare_with_functions

int test_implicit_compare_with_functions() {  if (memcmp(A, "a", 1))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'memcmp' is called without explicitly comparing result  // CHECK-FIXES: memcmp(A, "a", 1) != 0)  if (wmemcmp(W, L"a", 1))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'wmemcmp' is called without explicitly comparing result  // CHECK-FIXES: wmemcmp(W, L"a", 1) != 0)  if (memicmp(A, "a", 1))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'memicmp' is called without explicitly comparing result  // CHECK-FIXES: memicmp(A, "a", 1) != 0)  if (_memicmp(A, "a", 1))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_memicmp' is called without explicitly comparing result  // CHECK-FIXES: _memicmp(A, "a", 1) != 0)  if (_memicmp_l(A, "a", 1, locale))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_memicmp_l' is called without explicitly comparing result  // CHECK-FIXES: _memicmp_l(A, "a", 1, locale) != 0)  if (strcmp(A, "a"))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'strcmp' is called without explicitly comparing result  // CHECK-FIXES: strcmp(A, "a") != 0)  if (strncmp(A, "a", 1))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'strncmp' is called without explicitly comparing result  // CHECK-FIXES: strncmp(A, "a", 1) != 0)  if (strcasecmp(A, "a"))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'strcasecmp' is called without explicitly comparing result  // CHECK-FIXES: strcasecmp(A, "a") != 0)  if (strncasecmp(A, "a", 1))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'strncasecmp' is called without explicitly comparing result  // CHECK-FIXES: strncasecmp(A, "a", 1) != 0)  if (stricmp(A, "a"))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'stricmp' is called without explicitly comparing result  // CHECK-FIXES: stricmp(A, "a") != 0)  if (strcmpi(A, "a"))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'strcmpi' is called without explicitly comparing result  // CHECK-FIXES: strcmpi(A, "a") != 0)  if (_stricmp(A, "a"))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_stricmp' is called without explicitly comparing result  // CHECK-FIXES: _stricmp(A, "a") != 0)  if (strnicmp(A, "a", 1))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'strnicmp' is called without explicitly comparing result  // CHECK-FIXES: strnicmp(A, "a", 1) != 0)  if (_strnicmp(A, "a", 1))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_strnicmp' is called without explicitly comparing result  // CHECK-FIXES: _strnicmp(A, "a", 1) != 0)  if (_stricmp_l(A, "a", locale))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_stricmp_l' is called without explicitly comparing result  // CHECK-FIXES: _stricmp_l(A, "a", locale) != 0)  if (_strnicmp_l(A, "a", 1, locale))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_strnicmp_l' is called without explicitly comparing result  // CHECK-FIXES: _strnicmp_l(A, "a", 1, locale) != 0)  if (wcscmp(W, L"a"))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'wcscmp' is called without explicitly comparing result  // CHECK-FIXES: wcscmp(W, L"a") != 0)  if (wcsncmp(W, L"a", 1))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'wcsncmp' is called without explicitly comparing result  // CHECK-FIXES: wcsncmp(W, L"a", 1) != 0)  if (wcscasecmp(W, L"a"))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'wcscasecmp' is called without explicitly comparing result  // CHECK-FIXES: wcscasecmp(W, L"a") != 0)  if (wcsicmp(W, L"a"))    return 0;  // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'wcsicmp' is called without explicitly comparing result//.........这里部分代码省略.........
开发者ID:adiog,项目名称:clang-tools-extra,代码行数:101,


示例10: memory_read

//.........这里部分代码省略.........            sysctl_vals[i] *= sysctl_vals[0];    memory_submit ("free",     sysctl_vals[2]);    memory_submit ("wired",    sysctl_vals[3]);    memory_submit ("active",   sysctl_vals[4]);    memory_submit ("inactive", sysctl_vals[5]);    memory_submit ("cache",    sysctl_vals[6]);    /* #endif HAVE_SYSCTLBYNAME */#elif KERNEL_LINUX    FILE *fh;    char buffer[1024];    char *fields[8];    int numfields;    long long mem_used = 0;    long long mem_buffered = 0;    long long mem_cached = 0;    long long mem_free = 0;    if ((fh = fopen ("/proc/meminfo", "r")) == NULL)    {        char errbuf[1024];        WARNING ("memory: fopen: %s",                 sstrerror (errno, errbuf, sizeof (errbuf)));        return (-1);    }    while (fgets (buffer, 1024, fh) != NULL)    {        long long *val = NULL;        if (strncasecmp (buffer, "MemTotal:", 9) == 0)            val = &mem_used;        else if (strncasecmp (buffer, "MemFree:", 8) == 0)            val = &mem_free;        else if (strncasecmp (buffer, "Buffers:", 8) == 0)            val = &mem_buffered;        else if (strncasecmp (buffer, "Cached:", 7) == 0)            val = &mem_cached;        else            continue;        numfields = strsplit (buffer, fields, 8);        if (numfields < 2)            continue;        *val = atoll (fields[1]) * 1024LL;    }    if (fclose (fh))    {        char errbuf[1024];        WARNING ("memory: fclose: %s",                 sstrerror (errno, errbuf, sizeof (errbuf)));    }    if (mem_used >= (mem_free + mem_buffered + mem_cached))    {        mem_used -= mem_free + mem_buffered + mem_cached;        memory_submit ("used",     mem_used);        memory_submit ("buffered", mem_buffered);        memory_submit ("cached",   mem_cached);        memory_submit ("free",     mem_free);
开发者ID:GoogleCloudPlatform,项目名称:collectd,代码行数:67,


示例11: IsMarker

static int IsMarker(const char *marker, const char *name){  return !strncasecmp(name, marker, 8) ||    (*name == *marker && !strncasecmp(name+1, marker, 7));}
开发者ID:WinterMute,项目名称:dsdoom,代码行数:5,


示例12: processResponse

/* * Process the response data. */int processResponse(char *data, int length, struct http_param *param){	int processed=0;	char *p=NULL;	processed=length;	/* Find out how far it is to the end of the headers */	if(param->response.header_len==0) {		/* Just go ahead and keep adding here */		param->response.length+=length;		p=strstr(data, "/r/n/r/n");		if(p==NULL) {			/* We don't have the end of the headers, ask for more data */			processed=0;		} else {			/* Figure out how far in the headers stop */			param->response.header_len=(p-data)+4;			param->response.length-=param->response.header_len;			/* Actually process the headers, see what we're dealing with. */			p=strtok(data, "/r/n");			param->response.status_str=strdup(p);			/* Find the status */			p=strchr(p, ' ');			if(p!=NULL) {				param->response.status=atoi(p);			}			/* Look through the headers and see what kind of stuff we've got */			while( (p=strtok(NULL, "/r/n"))!=NULL) {				if(strncasecmp(p, "Connection: ", 16) == 0) {					if(strncasecmp(p+16, "close", 5)) {						param->response.connection=CONNECTION_CLOSE;					} else if(strncasecmp(p+16, "keepalive", 9)) {						param->response.connection=CONNECTION_KEEPALIVE;					}				} else if(strncasecmp(p, "Transfer-Encoding: ", 19) == 0) {					if(strncasecmp(p+19, "chunked", 7) == 0) {						param->response.trans_enc=ENCODING_CHUNKED;					}				} else if(strncasecmp(p, "Content-Length: ", 16) == 0) {					param->response.body_len=atoi(p+16);				}			}		}		/* If we're doing chunked encoding, let's get set up for that */		if(param->response.trans_enc==ENCODING_CHUNKED) {			char *start=data+param->response.header_len;			char *end=data+param->response.header_len;			int old_remaining=0;			/* Find the last hex digit */			while(*end && isxdigit(*end)) { end++; }			/* Figure out what the value of that hex string is */			param->response.remaining=strtoul(start, &end, 16);			fprintf(stderr, "*** Chunk size is %d/n",				param->response.remaining);			/* Skip to the newline */			while(*end!='/r' && *end!='/n') { end++; }			/* and then past it */			while(*end=='/r' || *end=='/n') { end++; }			/* Adjust the length */			param->response.length-=(end-start);			/* Adjust the remaining length */			old_remaining=param->response.remaining;			/* The length minus the length of the length */			param->response.remaining-=(length-(end-data));			assert(param->response.remaining>=0);			assert(param->response.remaining < old_remaining);			fprintf(stderr, "*** Remaining size is %d, current length is %d/n",				param->response.remaining, param->response.length);		}	} else { /* This is not the first packet */		/* Special processing for chunked encoding */		if(param->response.trans_enc==ENCODING_CHUNKED) {			/* Find out how much of the current chunk we've got */			if(length>param->response.remaining) {				/* We've got the entire chunk here */				char *start=NULL, *end=NULL;				param->response.length+=param->response.remaining;				start=data+param->response.remaining;				end=start;				while(*end && isxdigit(*end)) { end++; }				param->response.remaining=strtoul(start, &end, 16);				/* Skip past the newline */				while(*end!='/r' && *end!='/n') { end++; }				while(*end=='/r' || *end=='/n') { end++; }				fprintf(stderr, "*** New remaining is %d/n",					param->response.remaining);				if(param->response.remaining>0) {					param->response.length-=(end-start);					param->response.remaining-=(length-(end-data));//.........这里部分代码省略.........
开发者ID:WongTai,项目名称:snippets,代码行数:101,


示例13: ex_writefp

/* * ex_writefp -- *	Write a range of lines to a FILE *. * * PUBLIC: int ex_writefp __P((SCR *, * PUBLIC:    char *, FILE *, MARK *, MARK *, u_long *, u_long *, int)); */intex_writefp(SCR *sp, char *name, FILE *fp, MARK *fm, MARK *tm, u_long *nlno, u_long *nch, int silent){	struct stat sb;	GS *gp;	u_long ccnt;			/* XXX: can't print off_t portably. */	recno_t fline, tline, lcnt;	size_t len;	int rval;	char *msg;	CHAR_T *p;	char *f;	size_t flen;	int isutf16;	gp = sp->gp;	fline = fm->lno;	tline = tm->lno;	if (nlno != NULL) {		*nch = 0;		*nlno = 0;	}	/*	 * The vi filter code has multiple processes running simultaneously,	 * and one of them calls ex_writefp().  The "unsafe" function calls	 * in this code are to db_get() and msgq().  Db_get() is safe, see	 * the comment in ex_filter.c:ex_filter() for details.  We don't call	 * msgq if the multiple process bit in the EXF is set.	 *	 * !!!	 * Historic vi permitted files of 0 length to be written.  However,	 * since the way vi got around dealing with "empty" files was to	 * always have a line in the file no matter what, it wrote them as	 * files of a single, empty line.  We write empty files.	 *	 * "Alex, I'll take vi trivia for $1000."	 */	ccnt = 0;	lcnt = 0;	msg = "253|Writing...";	if (O_ISSET(sp, O_FILEENCODING)) {		isutf16 = !strncasecmp(O_STR(sp, O_FILEENCODING), "utf-16", 6);		isutf16 += !strncasecmp(O_STR(sp, O_FILEENCODING), "utf-16le", 8);	} else isutf16 = 0;	if (tline != 0) {		if (isutf16 == 1 && fwrite("/xfe/xff", 1, 2, fp) != 2)			goto err;		if (isutf16 == 2 && fwrite("/xff/xfe", 1, 2, fp) != 2)			goto err;		for (; fline <= tline; ++fline, ++lcnt) {			/* Caller has to provide any interrupt message. */			if ((lcnt + 1) % INTERRUPT_CHECK == 0) {				if (INTERRUPTED(sp))					break;				if (!silent) {					gp->scr_busy(sp, msg, msg == NULL ?					    BUSY_UPDATE : BUSY_ON);					msg = NULL;				}			}			if (db_get(sp, fline, DBG_FATAL, &p, &len))				goto err;			INT2FILE(sp, p, len, f, flen);			if (fwrite(f, 1, flen, fp) != flen)				goto err;			ccnt += len;			/* UTF-16 w/o BOM is big-endian */			switch (isutf16) {			case 1:		/* UTF-16BE */				if (fwrite("/0/x0a", 1, 2, fp) != 2)					goto done;				break;			case 2:		/* UTF-16LE */				if (fwrite("/x0a/0", 1, 2, fp) != 2)					goto done;				break;			default:				if (putc('/n', fp) != '/n')					goto done;			}			++ccnt;		}	}done:	if (fflush(fp))		goto err;	/*	 * XXX	 * I don't trust NFS -- check to make sure that we're talking to//.........这里部分代码省略.........
开发者ID:Alkzndr,项目名称:freebsd,代码行数:101,


示例14: notify_ADMINX

void notify_ADMINX(Connection *xConn,PCStr(admin),PCStr(what),PCStr(body)){   FILE *tmp;    FILE *bt;    Connection ConnBuff,*Conn = &ConnBuff;    CStr(head,1024);    CStr(me,128);    CStr(date,128);    CStr(load,128);    CStr(cwd,1024);    CStr(uname,128);    int now;    const char *bugbox = "[email
C++ strncat_s函数代码示例
C++ strna函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。