[U-Boot] [PATCH] Add a new "ini" command

Mike Frysinger vapier at gentoo.org
Sat Aug 18 01:43:33 CEST 2012


On Friday 17 August 2012 16:56:57 Joe Hershberger wrote:
> This allows you to read ini-formatted data from anywhere and then
> import one of the sections into the environment
> 
> This is based on rev 16 at http://code.google.com/p/inih/

document it in top level README ?

> --- /dev/null
> +++ b/common/cmd_ini.c
>
> +int do_ini(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

static

> +{
> +	const char *section;
> +	char *file_address;
> +	size_t file_size;
> +
> +	if (argc == 1)
> +		return CMD_RET_USAGE;
> +
> +	section = argv[1];
> +	if (argc < 3)
> +		file_address = (char *)simple_strtoul(getenv("loadaddr"),
> +			NULL, 16);
> +	else
> +		file_address = (char *)simple_strtoul(argv[2], NULL, 16);

file_address = (char *)simple_strtoul(argc < 3 ? getenv("loadaddr") : argv[2],
	NULL, 16);

> +	if (argc < 4)
> +		file_size = (size_t)simple_strtoul(getenv("filesize"),
> +			NULL, 16);
> +	else
> +		file_size = (size_t)simple_strtoul(argv[3], NULL, 16);

same here

> +	ini_parse(file_address, file_size, ini_handler, (void *)section);
> +
> +	/* success */
> +	return 0;
> +}

return ini_parse() ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120817/7b44cbb0/attachment.pgp>


More information about the U-Boot mailing list