• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ env_get_char函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: printk

        /* tear down ed*/

#ifdef DEBUGME
        printk(KERN_ERR\
            "%s: Tearing down data!\n",\
             __func__);
#endif /*DEBUGME*/
        ed.mtd = -1;
        kfree(ed.data);
        ed.data = NULL;
        put_mtd_device(ed.mtds[0]); ed.mtds[0] = NULL;
        put_mtd_device(ed.mtds[1]); ed.mtds[1] = NULL;
#ifdef DEBUGME
        printk(KERN_ERR\
            "%s: Tearing down complete!\n",\
             __func__);
#endif /*DEBUGME*/
        return (*buf) ? 0 : -1;
    } else {
        printk(KERN_ERR\
            "%s: Failed to read the env block!\n",\
            __func__);
        return -3;
    }
    return 0;
}
#else /*CONFIG_CIRRUS_DUAL_MTD_ENV*/
int rtcnvet_get_env(char *name, char **buf)
{
    int j, k, nxt;

    if (!env_valid) {
        *buf = NULL;
        return -1;
    }

    k = -1;

    for (j = 0; env_get_char(j) != '\0'; j = nxt+1) {

        for (nxt = j; env_get_char(nxt) != '\0'; ++nxt)
            ;
        k = envmatch((unsigned char *)name, j);
        if (k < 0)
            continue;

        break;
    }

    if (k < 0) {
        printk(KERN_ERR "## Error: \"%s\" not defined\n", name);
        *buf = NULL;
    } else
        *buf = &env_buf[k];

    return (*buf) ? 0 : -1;
}
开发者ID:mausvt,项目名称:seagate_central_cns3420_2-6-35,代码行数:57,代码来源:rtc-nvedit.c


示例2: getenv_f

/*
 * Look up variable from environment for restricted C runtime env.
 */
int getenv_f(const char *name, char *buf, unsigned len)
{
	int i, nxt;

	for (i = 0; env_get_char(i) != '\0'; i = nxt+1) {
		int val, n;

		for (nxt = i; env_get_char(nxt) != '\0'; ++nxt) {
			if (nxt >= CONFIG_ENV_SIZE)
				return -1;
		}

		val = envmatch((uchar *)name, i);
		if (val < 0)
			continue;

		/* found; copy out */
		for (n = 0; n < len; ++n, ++buf) {
			if ((*buf = env_get_char(val++)) == '\0')
				return n;
		}

		if (n)
			*--buf = '\0';

		printf("env_buf [%d bytes] too small for value of \"%s\"\n",
			len, name);

		return n;
	}
	return -1;
}
开发者ID:aosp,项目名称:uboot,代码行数:35,代码来源:cmd_nvedit.c


示例3: envmatch

int envmatch(uchar *s1, int i2)
{
	while (*s1 == env_get_char(i2++))
		if (*s1++ == '=')
			return i2;
	if (*s1 == '\0' && env_get_char(i2-1) == '=')
		return i2;
	return -1;
}
开发者ID:aosp,项目名称:uboot,代码行数:9,代码来源:cmd_nvedit.c


示例4: envmatch

static int envmatch (char *s1, int i2)
{

	while (*s1 == env_get_char(i2++))
		if (*s1++ == '=')
			return(i2);
	if (*s1 == '\0' && env_get_char(i2-1) == '=')
		return(i2);
	return(-1);
}
开发者ID:4Fwolf,项目名称:signal75-kernel-3.10.61,代码行数:10,代码来源:env.c


示例5: envmatch

static char *findenv(const char *name)
{
	int i, nxt, val;
	for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
		for (nxt = i; env_get_char(nxt) != '\0'; ++nxt) {
			if (nxt >= CFG_ENV_SIZE)
				return NULL;
		}
		val = envmatch((char *)name, i);
		if (val < 0)
			continue;
		return (char *)env_get_addr(val);
	}
	return NULL;
}
开发者ID:John677,项目名称:Kernal_k3note,代码行数:15,代码来源:env.c


示例6:

static char *findenv(const char *name)
{
	int i, nxt, val;
	for (i = 0; env_get_char(i) != '\0'; i = nxt+1) {
		for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
			if (nxt >= CFG_ENV_SIZE) {
				return (NULL);
			}
		}
		if ((val=envmatch((char *)name, i)) < 0) {
			continue;
		}
		return ((char *)env_get_addr(val));
	}
	return (NULL);
}
开发者ID:CobraJet93,项目名称:kernel-3.10.54,代码行数:16,代码来源:sysenv.c


示例7: API_env_enum

/*
 * pseudo signature:
 *
 * int API_env_enum(const char *last, char **next)
 *
 * last: ptr to name of env var found in last iteration
 */
static int API_env_enum(va_list ap)
{
	int i, n;
	char *last, **next;

	last = (char *)va_arg(ap, u_int32_t);

	if ((next = (char **)va_arg(ap, u_int32_t)) == NULL)
		return API_EINVAL;

	if (last == NULL)
		/* start over */
		*next = ((char *)env_get_addr(0));
	else {
		*next = last;

		for (i = 0; env_get_char(i) != '\0'; i = n + 1) {
			for (n = i; env_get_char(n) != '\0'; ++n) {
				if (n >= CONFIG_ENV_SIZE) {
					/* XXX shouldn't we set *next = NULL?? */
					return 0;
				}
			}

			if (envmatch((uchar *)last, i) < 0)
				continue;

			/* try to get next name */
			i = n + 1;
			if (env_get_char(i) == '\0') {
				/* no more left */
				*next = NULL;
				return 0;
			}

			*next = ((char *)env_get_addr(i));
			return 0;
		}
	}

	return 0;
}
开发者ID:105678256,项目名称:u-boot-2010.09,代码行数:49,代码来源:api.c


示例8: env_complete

int env_complete(char *var, int maxv, char *cmdv[], int bufsz, char *buf)
{
    int i, nxt, len, vallen, found;
    const char *lval, *rval;

    found = 0;
    cmdv[0] = NULL;

    len = strlen(var);
    /* now iterate over the variables and select those that match */
    for (i=0; env_get_char(i) != '\0'; i=nxt+1) {

        for (nxt=i; env_get_char(nxt) != '\0'; ++nxt)
            ;

        lval = (char *)env_get_addr(i);
        rval = strchr(lval, '=');
        if (rval != NULL) {
            vallen = rval - lval;
            rval++;
        } else
            vallen = strlen(lval);

        if (len > 0 && (vallen < len || memcmp(lval, var, len) != 0))
            continue;

        if (found >= maxv - 2 || bufsz < vallen + 1) {
            cmdv[found++] = "...";
            break;
        }
        cmdv[found++] = buf;
        memcpy(buf, lval, vallen);
        buf += vallen;
        bufsz -= vallen;
        *buf++ = '\0';
        bufsz--;
    }

    cmdv[found] = NULL;
    return found;
}
开发者ID:wrjght,项目名称:c100_3,代码行数:41,代码来源:env_common.c


示例9: print_env

void print_env()
{
	int i,nxt;
	uchar *env = (uchar *)g_env.env_data;
	if(!env_valid){
		printf("[%s]no valid env\n",MODULE_NAME);
		return;
	}
	printf("[%s]env:\n",MODULE_NAME);
	for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
		for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
			if (nxt >= (int)(CFG_ENV_DATA_SIZE)) {
				return;
			}
		}
		printf("%s\n",env+i);
	}

	
	
}
开发者ID:amadews,项目名称:j608_fly_4511,代码行数:21,代码来源:env.c


示例10: rtcnvet_do_printenv

int rtcnvet_do_printenv(char *name)
{
    int i, j, k, nxt;
    const uint8_t *b;

    if (name == NULL) {
        /* Print all env variables  */
        for (i = 0; env_get_char(i) != '\0'; i = nxt+1) {
            for (nxt = i; env_get_char(nxt) != '\0'; ++nxt)
                ;
            b = (const uint8_t *)&env_buf[i];
            dump_hex_f(b, (nxt-i), DUMP_ASCII);
        }

        printk(KERN_INFO "\nEnvironment size: %d/%d bytes\n",
        i, env_size);

        return 0;
    } else {
        k = -1;

        for (j = 0; env_get_char(j) != '\0'; j = nxt+1) {

            for (nxt = j; env_get_char(nxt) != '\0'; ++nxt)
                ;
            k = envmatch((unsigned char *)name, j);
            if (k < 0)
                continue;

            printk(KERN_INFO "%s=", name);
            b = (const uint8_t *)&env_buf[k];
            dump_hex_f(b, (nxt-k), DUMP_ASCII);
            break;
        }
        if (k < 0)
            printk(KERN_ERR "## Error: \"%s\" not defined\n", name);

        return 0;
    }
}
开发者ID:mausvt,项目名称:seagate_central_cns3420_2-6-35,代码行数:40,代码来源:rtc-nvedit.c


示例11: printk

char *get_env(char *name)
{
	int i, nxt;
	printk("[%s]get_env %s\n",MODULE_NAME,name);
	if(!env_valid)
		return NULL;

	for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
		int val;

		for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
			if (nxt >= CFG_ENV_SIZE) {
				return (NULL);
			}
		}
		if ((val=envmatch((char *)name, i)) < 0)
			continue;
		return ((char *)env_get_addr(val));
	}

	return (NULL);
}
开发者ID:4Fwolf,项目名称:signal75-kernel-3.10.61,代码行数:22,代码来源:env.c


示例12: printenv

/*
 * state 0: finish printing this string and return (matched!)
 * state 1: no matching to be done; print everything
 * state 2: continue searching for matched name
 */
static int printenv(char *name, int state)
{
	int i, j;
	char c, buf[17];

	i = 0;
	buf[16] = '\0';

	while (state && env_get_char(i) != '\0') {
		if (state == 2 && envmatch((uchar *)name, i) >= 0)
			state = 0;

		j = 0;
		do {
			buf[j++] = c = env_get_char(i++);
			if (j == sizeof(buf) - 1) {
				if (state <= 1)
					puts(buf);
				j = 0;
			}
		} while (c != '\0');

		if (state <= 1) {
			if (j)
				puts(buf);
			putc('\n');
		}

		if (ctrlc())
			return -1;
	}

	if (state == 0)
		i = 0;
	return i;
}
开发者ID:247a,项目名称:lenovo_b6000-8000_kernel_source,代码行数:41,代码来源:cmd_nvedit.c


示例13: env_check_char_valid

static T_BOOL env_check_char_valid(T_pVOID buffer, T_U32 index, const T_U8 *exclude, T_U32 len)
{
    T_U8 ch = env_get_char(buffer, index);

    return (!env_char_in_set(ch, exclude, len));
}
开发者ID:jinlan100130,项目名称:BTPhone,代码行数:6,代码来源:log_hard_test.c


示例14: fdt_env

int fdt_env(void *fdt)
{
	int   nodeoffset;
	int   err;
	int   k, nxt;
	int i;
	static char tmpenv[256];

	err = fdt_check_header(fdt);
	if (err < 0) {
		printf("fdt_env: %s\n", fdt_strerror(err));
		return err;
	}

	/*
	 * See if we already have a "u-boot-env" node, delete it if so.
	 * Then create a new empty node.
	 */
	nodeoffset = fdt_path_offset (fdt, "/u-boot-env");
	if (nodeoffset >= 0) {
		err = fdt_del_node(fdt, nodeoffset);
		if (err < 0) {
			printf("fdt_env: %s\n", fdt_strerror(err));
			return err;
		}
	}
	/*
	 * Create a new node "/u-boot-env" (offset 0 is root level)
	 */
	nodeoffset = fdt_add_subnode(fdt, 0, "u-boot-env");
	if (nodeoffset < 0) {
		printf("WARNING: could not create /u-boot-env %s.\n",
			fdt_strerror(nodeoffset));
		return nodeoffset;
	}

	for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
		char *s, *lval, *rval;

		/*
		 * Find the end of the name=definition
		 */
		for (nxt = i; env_get_char(nxt) != '\0'; ++nxt)
			;
		s = tmpenv;
		for (k = i; k < nxt && s < &tmpenv[sizeof(tmpenv) - 1]; ++k)
			*s++ = env_get_char(k);
		*s++ = '\0';
		lval = tmpenv;
		/*
		 * Find the first '=': it separates the name from the value
		 */
		s = strchr(tmpenv, '=');
		if (s != NULL) {
			*s++ = '\0';
			rval = s;
		} else
			continue;
		err = fdt_setprop(fdt, nodeoffset, lval, rval, strlen(rval)+1);
		if (err < 0) {
			printf("WARNING: could not set %s %s.\n",
				lval, fdt_strerror(err));
			return err;
		}
	}
	return 0;
}
开发者ID:bingbuidea,项目名称:u-boot-sh4-1.3.1_stm23_0045,代码行数:67,代码来源:fdt_support.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ env_get_string函数代码示例发布时间:2022-05-30
下一篇:
C++ env_destroy函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap