From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Fri, 17 Aug 2012 19:43:33 -0400 Subject: [U-Boot] [PATCH] Add a new "ini" command In-Reply-To: <1345237017-20210-1-git-send-email-joe.hershberger@ni.com> References: <1345237017-20210-1-git-send-email-joe.hershberger@ni.com> Message-ID: <201208171943.33979.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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: