当前位置: 首页>>代码示例>>C++>>正文


C++ xstrcasecmp函数代码示例

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


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

示例1: msg_queue_remove_uid

/*
 * msg_queue_remove_uid()
 *
 * usuwa wiadomo¶æ z kolejki wiadomo¶ci dla danego
 * u¿ytkownika.
 *
 *  - uin.
 *
 * 0 je¶li usuniêto, -1 je¶li nie ma takiej wiadomo¶ci.
 */
int msg_queue_remove_uid(const char *uid)
{
	msg_queue_t *m;
	int res = -1;

	for (m = msgs_queue; m; m = m->next) {
		if (!xstrcasecmp(m->rcpts, uid)) {
			m = msgs_queue_removei(m);
			res = 0;
		}
	}

	return res;
}
开发者ID:dmilith,项目名称:ekg2-bsd,代码行数:24,代码来源:msgqueue.c

示例2: _proc_msg

/*****************************************************************************\
 * process and respond to a request
\*****************************************************************************/
static void _proc_msg(int new_fd, char *msg)
{
	char send_buf[SIZE];
	uint16_t nodes = 0, slots = 0;

	info("AAA: received from client: %s", msg);

	if (new_fd < 0)
		return;

	if (!msg) {
		strcpy(send_buf, "NULL request, failure");
		info("BBB: send to client: %s", send_buf);
		send_reply(new_fd, send_buf);
	} else {
		//identify the cmd
		if (0 == xstrcasecmp(msg, "get total nodes and slots")) {
			get_total_nodes_slots(&nodes, &slots);
			sprintf(send_buf, "total_nodes=%d total_slots=%d",
				nodes, slots);
			info("BBB: send to client: %s", send_buf);
			send_reply(new_fd, send_buf);
		} else if (0 == xstrcasecmp(msg,
					    "get available nodes and slots")) {
			get_free_nodes_slots(&nodes, &slots);
			sprintf(send_buf, "avail_nodes=%d avail_slots=%d",
				nodes, slots);
			info("BBB: send to client: %s", send_buf);
			send_reply(new_fd, send_buf);
		} else if (0 == strncasecmp(msg, "allocate", 8)) {
			allocate_job_op(new_fd, msg);
		} else if (0 == strncasecmp(msg, "deallocate", 10)) {
			deallocate(msg);
		}
	}
	return;
}
开发者ID:adammoody,项目名称:slurm,代码行数:40,代码来源:msg.c

示例3: xmsg_unlink_dotfiles

/* kind = 0 for sent, 1 for toobig */
static void xmsg_unlink_dotfiles(session_t *s, const char *varname)
{
	if (session_int_get(s, varname)) {
		const int kind = !xstrcasecmp(varname, "unlink_sent");
		const int maxfs = session_int_get(s, "max_filesize");
		const char *dfsuffix = session_get(s, "dotfile_suffix");
		const char *dir = xmsg_dirfix(session_uid_get(s)+XMSG_UID_DIROFFSET);
		DIR *d;
		struct dirent *de;
		struct stat st, std;
		char *df, *dfd, *dp, *dpd;
		
		if (!dir || !(d = opendir(dir))) {
			xdebug("unable to open specified directory");
			return;
		}
		
		df = xmalloc(xstrlen(dir) + NAME_MAX + 2);
		dfd = xmalloc(xstrlen(dir) + NAME_MAX + 3 + xstrlen(dfsuffix));
		xstrcpy(df, dir);
		dp = df + xstrlen(df);
		*(dp++) = '/';
		xstrcpy(dfd, df);
		dpd = dfd + xstrlen(dfd);
		*(dpd++) = '.';
		
		while ((de = readdir(d))) {
			if (de->d_name[0] == '.')
				continue;
			if (xstrlen(de->d_name) > NAME_MAX) {
				xdebug2(DEBUG_ERROR, "Filename longer than NAME_MAX (%s), skipping.", de->d_name);
				continue;
			}
			xstrcpy(dp, de->d_name);
			xstrcpy(dpd, de->d_name);
			xstrcat(dpd, dfsuffix);
			if (!stat(df, &st) && !stat(dfd, &std)
					&& ((!maxfs || (st.st_size < maxfs)) == kind)) {
				xdebug("removing %s", de->d_name);
				unlink(df);
				unlink(dfd);
			}
		}

		closedir(d);
		xfree(df);
		xfree(dfd);
	}
}
开发者ID:dmilith,项目名称:ekg2-bsd,代码行数:50,代码来源:xmsg.c

示例4: s_p_handle_uint32

int s_p_handle_uint32(uint32_t* data, const char* key, const char* value)
{
	char *endptr;
	unsigned long num;

	errno = 0;
	num = strtoul(value, &endptr, 0);
	if ((endptr[0] == 'k') || (endptr[0] == 'K')) {
		num *= 1024;
		endptr++;
	}
	if ((num == 0 && errno == EINVAL)
		|| (*endptr != '\0')) {
		if ((xstrcasecmp(value, "UNLIMITED") == 0) ||
			(xstrcasecmp(value, "INFINITE")  == 0)) {
			num = (uint32_t) INFINITE;
		} else {
			error("%s value (%s) is not a valid number",
				key, value);
			return SLURM_ERROR;
		}
	} else if (errno == ERANGE) {
		error("%s value (%s) is out of range", key, value);
		return SLURM_ERROR;
	} else if (value[0] == '-') {
		error("%s value (%s) is less than zero", key,
			value);
		return SLURM_ERROR;
	} else if (num > 0xffffffff) {
		error("%s value (%s) is greater than 4294967295",
			key, value);
		return SLURM_ERROR;
	}
	*data = (uint32_t)num;
	return SLURM_SUCCESS;
}
开发者ID:A1ve5,项目名称:slurm,代码行数:36,代码来源:parse_value.c

示例5: client_req_get_bool

extern bool
client_req_get_bool(client_req_t *req, const char *key, bool *pval)
{
	char *val;

	val = _client_req_get_val(req, key);
	if (val == NULL)
		return false;

	if (!xstrcasecmp(val, TRUE_VAL))
		*pval = true;
	else
		*pval = false;
	return true;
}
开发者ID:HPCNow,项目名称:slurm,代码行数:15,代码来源:client.c

示例6: s_p_handle_double

int s_p_handle_double(double* data, const char* key, const char* value)
{
	char *endptr;
	double num;

	errno = 0;
	num = strtod(value, &endptr);
	if ((num == 0 && errno == EINVAL)
		|| (*endptr != '\0')) {
		if ((xstrcasecmp(value, "UNLIMITED") == 0) ||
			(xstrcasecmp(value, "INFINITE")  == 0)) {
			num = HUGE_VAL;
		} else {
			error("%s value (%s) is not a valid number",
				key, value);
			return SLURM_ERROR;
		}
	} else if (errno == ERANGE) {
		error("%s value (%s) is out of range", key, value);
		return SLURM_ERROR;
	}
	*data = num;
	return SLURM_SUCCESS;
}
开发者ID:A1ve5,项目名称:slurm,代码行数:24,代码来源:parse_value.c

示例7: ncurses_binding_delete

/*
 * ncurses_binding_delete()
 *
 * usuwa akcjê z danego klawisza.
 */
void ncurses_binding_delete(const char *key, int quiet)
{
    struct binding *b;

    if (!key)
        return;

    for (b = bindings; b; b = b->next) {
        int i;

        if (!b->key || xstrcasecmp(key, b->key))
            continue;

        if (b->internal) {
            printq("bind_seq_incorrect", key);
            return;
        }

        xfree(b->action);
        xfree(b->arg);

        if (b->default_action) {
            b->action	= xstrdup(b->default_action);
            b->arg		= xstrdup(b->default_arg);
            b->function	= b->default_function;
            b->internal	= 1;
        } else {
            xfree(b->key);
            for (i = 0; i < KEY_MAX + 1; i++) {
                if (ncurses_binding_map[i] == b)
                    ncurses_binding_map[i] = NULL;
                if (ncurses_binding_map_meta[i] == b)
                    ncurses_binding_map_meta[i] = NULL;

            }

            LIST_REMOVE2(&bindings, b, NULL);
        }

        config_changed = 1;

        printq("bind_seq_remove", key);

        return;
    }

    printq("bind_seq_incorrect", key);
}
开发者ID:dmilith,项目名称:ekg2-bsd,代码行数:53,代码来源:bindings.c

示例8: print_db_notok

/* print_db_notok() - Print an error message about slurmdbd
 *                    is unreachable or wrong cluster name.
 * IN  cname - char * cluster name
 * IN  isenv - bool  cluster name from env or from command line option.
 */
void print_db_notok(const char *cname, bool isenv)
{
	if (errno)
		error("There is a problem talking to the database: %m.  "
		      "Only local cluster communication is available, remove "
		      "%s or contact your admin to resolve the problem.",
		      isenv ? "SLURM_CLUSTERS from your environment" :
		      "--cluster from your command line");
	else if (!xstrcasecmp("all", cname))
		error("No clusters can be reached now. "
		      "Contact your admin to resolve the problem.");
	else
		error("'%s' can't be reached now, "
		      "or it is an invalid entry for %s.  "
		      "Use 'sacctmgr list clusters' to see available clusters.",
		      cname, isenv ? "SLURM_CLUSTERS" : "--cluster");
}
开发者ID:Q-Leap-Networks,项目名称:qlustar-slurm,代码行数:22,代码来源:proc_args.c

示例9: msg_queue_remove_seq

/*
 * msg_queue_remove_seq()
 *
 * usuwa wiadomo¶æ z kolejki wiadomo¶æ o podanym numerze sekwencyjnym.
 *
 *  - seq
 *
 * 0/-1
 */
int msg_queue_remove_seq(const char *seq)
{
	int res = -1;
	msg_queue_t *m;

	if (!seq) 
		return -1;

	for (m = msgs_queue; m; m = m->next) {
		if (!xstrcasecmp(m->seq, seq)) {
			m = msgs_queue_removei(m);
			res = 0;
		}
	}

	return res;
}
开发者ID:dmilith,项目名称:ekg2-bsd,代码行数:26,代码来源:msgqueue.c

示例10: gg_changed_dcc

/* khem, var jest gg:*.... byl kod ktory nie dzialal... tak?  */
void gg_changed_dcc(const char *var)
{
	if (!xstrcmp(var, ("gg:dcc"))) {
		if (!gg_config_dcc) {
			gg_dcc_socket_close();
			gg_dcc_ip = 0;
			gg_dcc_port = 0;
		}

		if (gg_config_dcc) {
			if (gg_dcc_socket_open(gg_config_dcc_port) == -1)
				print("dcc_create_error", strerror(errno));
		}
	} else if (!xstrcmp(var, ("gg:dcc_ip"))) {
		if (gg_config_dcc_ip) {
			if (!xstrcasecmp(gg_config_dcc_ip, "auto")) {
				gg_dcc_ip = inet_addr("255.255.255.255");
			} else {
				if (inet_addr(gg_config_dcc_ip) != INADDR_NONE)
					gg_dcc_ip = inet_addr(gg_config_dcc_ip);
				else {
					print("dcc_invalid_ip");
					gg_config_dcc_ip = NULL;
					gg_dcc_ip = 0;
				}
			}
		} else
			gg_dcc_ip = 0;
	} else if (!xstrcmp(var, ("gg:dcc_port"))) {
		if (gg_config_dcc && gg_config_dcc_port) {
			gg_dcc_socket_close();
			gg_dcc_ip = 0;
			gg_dcc_port = 0;

			if (gg_dcc_socket_open(gg_config_dcc_port) == -1)
				print("dcc_create_error", strerror(errno));

		}
	} else if (!xstrcmp(var, ("gg:audio"))) {
		gg_config_audio = 0;
		debug("[gg_config_audio] gg:audio not supported.\n");
	}

	if (!in_autoexec)
		print("config_must_reconnect");
}
开发者ID:hiciu,项目名称:ekg2,代码行数:47,代码来源:dcc.c

示例11: is_user_coord

extern bool is_user_coord(slurmdb_user_rec_t *user, char *account)
{
	ListIterator itr;
	slurmdb_coord_rec_t *coord;

	xassert(user);
	xassert(account);

	if (!user->coord_accts || !list_count(user->coord_accts))
		return 0;

	itr = list_iterator_create(user->coord_accts);
	while((coord = list_next(itr))) {
		if (!xstrcasecmp(coord->name, account))
			break;
	}
	list_iterator_destroy(itr);
	return coord ? 1 : 0;
}
开发者ID:SchedMD,项目名称:slurm,代码行数:19,代码来源:common_as.c

示例12: _build_user_env

static void _build_user_env(void)
{
	char *tmp_env, *tok, *save_ptr = NULL, *eq_ptr, *value;

	tmp_env = xstrdup(opt.export_env);
	tok = strtok_r(tmp_env, ",", &save_ptr);
	while (tok) {
		if (!xstrcasecmp(tok, "NONE"))
			break;
		eq_ptr = strchr(tok, '=');
		if (eq_ptr) {
			eq_ptr[0] = '\0';
			value = eq_ptr + 1;
			setenv(tok, value, 1);
		}
		tok = strtok_r(NULL, ",", &save_ptr);
	}
	xfree(tmp_env);
}
开发者ID:A1ve5,项目名称:slurm,代码行数:19,代码来源:launch_poe.c

示例13: validate_sorted_tokens

static int validate_sorted_tokens(char *toks[])
{
/*  Determines whether the NULL-terminated array of strings (toks) is sorted.
 *  Returns 0 if the array is sorted; o/w, returns -1.
 */
    char **pp;
    char *p, *q;

    if (!toks) {
        return(-1);
    }
    if ((pp = toks) && *pp) {
        for (p=*pp++, q=*pp++; q; p=q, q=*pp++) {
            if (xstrcasecmp(p, q) > 0)
                return(-1);
        }
    }
    return(0);
}
开发者ID:dsommers,项目名称:conman,代码行数:19,代码来源:lex.c

示例14: s_p_handle_boolean

int s_p_handle_boolean(bool* data, const char* key, const char* value)
{
	bool flag;

	if (!xstrcasecmp(value, "yes")
		|| !xstrcasecmp(value, "up")
		|| !xstrcasecmp(value, "true")
		|| !xstrcasecmp(value, "1")) {
		flag = true;
	} else if (!xstrcasecmp(value, "no")
		   || !xstrcasecmp(value, "down")
		   || !xstrcasecmp(value, "false")
		   || !xstrcasecmp(value, "0")) {
		flag = false;
	} else {
		error("\"%s\" is not a valid option for \"%s\"",
			value, key);
		return SLURM_ERROR;
	}

	*data = flag;
	return SLURM_SUCCESS;
}
开发者ID:A1ve5,项目名称:slurm,代码行数:23,代码来源:parse_value.c

示例15: isMemberInEntry

static int isMemberInEntry(Header h, const char *name, rpmTag tag)
	/*@globals internalState @*/
	/*@modifies internalState @*/
{
    HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
    int rc = -1;
    int xx;

    he->tag = tag;
    xx = headerGet(h, he, 0);
    if (!xx)
	return rc;
    rc = 0;
    while (he->c) {
	he->c--;
	if (xstrcasecmp(he->p.argv[he->c], name))
	    continue;
	rc = 1;
	break;
    }
    he->p.ptr = _free(he->p.ptr);
    return rc;
}
开发者ID:avokhmin,项目名称:RPM5,代码行数:23,代码来源:parsePreamble.c


注:本文中的xstrcasecmp函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。