* [U-Boot] [PATCH] Add a new "ini" command
@ 2012-08-17 20:56 Joe Hershberger
2012-08-17 23:43 ` Mike Frysinger
2012-10-03 21:15 ` [U-Boot] [PATCH v2] " Joe Hershberger
0 siblings, 2 replies; 10+ messages in thread
From: Joe Hershberger @ 2012-08-17 20:56 UTC (permalink / raw)
To: u-boot
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/
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---
common/Makefile | 1 +
common/cmd_ini.c | 256 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 257 insertions(+)
create mode 100644 common/cmd_ini.c
diff --git a/common/Makefile b/common/Makefile
index 3d62775..e296368 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -100,6 +100,7 @@ COBJS-$(CONFIG_CMD_GPIO) += cmd_gpio.o
COBJS-$(CONFIG_CMD_I2C) += cmd_i2c.o
COBJS-$(CONFIG_CMD_IDE) += cmd_ide.o
COBJS-$(CONFIG_CMD_IMMAP) += cmd_immap.o
+COBJS-$(CONFIG_CMD_INI) += cmd_ini.o
COBJS-$(CONFIG_CMD_IRQ) += cmd_irq.o
COBJS-$(CONFIG_CMD_ITEST) += cmd_itest.o
COBJS-$(CONFIG_CMD_JFFS2) += cmd_jffs2.o
diff --git a/common/cmd_ini.c b/common/cmd_ini.c
new file mode 100644
index 0000000..0f0e5cd
--- /dev/null
+++ b/common/cmd_ini.c
@@ -0,0 +1,256 @@
+/*
+ * inih -- simple .INI file parser
+ *
+ * inih is released under the New BSD license (see LICENSE.txt). Go to the
+ * project home page for more info:
+ *
+ * http://code.google.com/p/inih/
+ */
+
+#include <common.h>
+#include <command.h>
+#include <environment.h>
+#include <linux/ctype.h>
+#include <linux/string.h>
+
+#ifdef CONFIG_INI_MAX_LINE
+#define MAX_LINE CONFIG_INI_MAX_LINE
+#else
+#define MAX_LINE 200
+#endif
+
+#ifdef CONFIG_INI_MAX_SECTION
+#define MAX_SECTION CONFIG_INI_MAX_SECTION
+#else
+#define MAX_SECTION 50
+#endif
+
+#ifdef CONFIG_INI_MAX_NAME
+#define MAX_NAME CONFIG_INI_MAX_NAME
+#else
+#define MAX_NAME 50
+#endif
+
+/* Strip whitespace chars off end of given string, in place. Return s. */
+static char *rstrip(char *s)
+{
+ char *p = s + strlen(s);
+
+ while (p > s && isspace(*--p))
+ *p = '\0';
+ return s;
+}
+
+/* Return pointer to first non-whitespace char in given string. */
+static char *lskip(const char *s)
+{
+ while (*s && isspace(*s))
+ s++;
+ return (char *)s;
+}
+
+/* Return pointer to first char c or ';' comment in given string, or pointer to
+ null at end of string if neither found. ';' must be prefixed by a whitespace
+ character to register as a comment. */
+static char *find_char_or_comment(const char *s, char c)
+{
+ int was_whitespace = 0;
+
+ while (*s && *s != c && !(was_whitespace && *s == ';')) {
+ was_whitespace = isspace(*s);
+ s++;
+ }
+ return (char *)s;
+}
+
+/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
+static char *strncpy0(char *dest, const char *src, size_t size)
+{
+ strncpy(dest, src, size);
+ dest[size - 1] = '\0';
+ return dest;
+}
+
+/* Emulate the behavior of fgets but on memory */
+static char *memgets(char *str, int num, char **mem, size_t *memsize)
+{
+ char *end;
+ int len;
+ int newline = 1;
+
+ end = memchr(*mem, '\n', *memsize);
+ if (end == NULL) {
+ if (*memsize == 0)
+ return NULL;
+ end = *mem + *memsize;
+ newline = 0;
+ }
+ len = min((end - *mem) + newline, num);
+ memcpy(str, *mem, len);
+ if (len < num)
+ str[len] = '\0';
+
+ /* prepare the mem vars for the next call */
+ *memsize -= (end - *mem) + newline;
+ *mem += (end - *mem) + newline;
+
+ return str;
+}
+
+/* Parse given INI-style file. May have [section]s, name=value pairs
+ (whitespace stripped), and comments starting with ';' (semicolon). Section
+ is "" if name=value pair parsed before any section heading. name:value
+ pairs are also supported as a concession to Python's ConfigParser.
+
+ For each name=value pair parsed, call handler function with given user
+ pointer as well as section, name, and value (data only valid for duration
+ of handler call). Handler should return nonzero on success, zero on error.
+
+ Returns 0 on success, line number of first error on parse error (doesn't
+ stop on first error).
+*/
+int ini_parse(char *filestart, size_t filelen,
+ int (*handler)(void *, char *, char *, char *), void *user)
+{
+ /* Uses a fair bit of stack (use heap instead if you need to) */
+ char line[MAX_LINE];
+ char section[MAX_SECTION] = "";
+ char prev_name[MAX_NAME] = "";
+
+ char *curmem = filestart;
+ char *start;
+ char *end;
+ char *name;
+ char *value;
+ size_t memleft = filelen;
+ int lineno = 0;
+ int error = 0;
+
+ /* Scan through file line by line */
+ while (memgets(line, sizeof(line), &curmem, &memleft) != NULL) {
+ lineno++;
+ start = lskip(rstrip(line));
+
+ if (*start == ';' || *start == '#') {
+ /*
+ * Per Python ConfigParser, allow '#' comments@start
+ * of line
+ */
+ }
+#if CONFIG_INI_ALLOW_MULTILINE
+ else if (*prev_name && *start && start > line) {
+ /*
+ * Non-blank line with leading whitespace, treat as
+ * continuation of previous name's value (as per Python
+ * ConfigParser).
+ */
+ if (!handler(user, section, prev_name, start) && !error)
+ error = lineno;
+ }
+#endif
+ else if (*start == '[') {
+ /* A "[section]" line */
+ end = find_char_or_comment(start + 1, ']');
+ if (*end == ']') {
+ *end = '\0';
+ strncpy0(section, start + 1, sizeof(section));
+ *prev_name = '\0';
+ } else if (!error) {
+ /* No ']' found on section line */
+ error = lineno;
+ }
+ } else if (*start && *start != ';') {
+ /* Not a comment, must be a name[=:]value pair */
+ end = find_char_or_comment(start, '=');
+ if (*end != '=')
+ end = find_char_or_comment(start, ':');
+ if (*end == '=' || *end == ':') {
+ *end = '\0';
+ name = rstrip(start);
+ value = lskip(end + 1);
+ end = find_char_or_comment(value, '\0');
+ if (*end == ';')
+ *end = '\0';
+ rstrip(value);
+ /* Strip double-quotes */
+ if (value[0] == '"' &&
+ value[strlen(value)-1] == '"') {
+ value[strlen(value)-1] = '\0';
+ value += 1;
+ }
+
+ /*
+ * Valid name[=:]value pair found, call handler
+ */
+ strncpy0(prev_name, name, sizeof(prev_name));
+ if (!handler(user, section, name, value) &&
+ !error)
+ error = lineno;
+ } else if (!error)
+ /* No '=' or ':' found on name[=:]value line */
+ error = lineno;
+ }
+ }
+
+ return error;
+}
+
+static int ini_handler(void *user, char *section, char *name, char *value)
+{
+ char *requested_section = (char *)user;
+#ifdef CONFIG_INI_CASE_INSENSITIVE
+ int i;
+
+ for (i = 0; i < strlen(requested_section); i++)
+ requested_section[i] = tolower(requested_section[i]);
+ for (i = 0; i < strlen(section); i++)
+ section[i] = tolower(section[i]);
+#endif
+
+ if (!strcmp(section, requested_section)) {
+#ifdef CONFIG_INI_CASE_INSENSITIVE
+ for (i = 0; i < strlen(name); i++)
+ name[i] = tolower(name[i]);
+ for (i = 0; i < strlen(value); i++)
+ value[i] = tolower(value[i]);
+#endif
+ setenv(name, value);
+ printf("ini: Imported %s as %s\n", name, value);
+ }
+
+ /* success */
+ return 1;
+}
+
+int do_ini(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ 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);
+ if (argc < 4)
+ file_size = (size_t)simple_strtoul(getenv("filesize"),
+ NULL, 16);
+ else
+ file_size = (size_t)simple_strtoul(argv[3], NULL, 16);
+
+ ini_parse(file_address, file_size, ini_handler, (void *)section);
+
+ /* success */
+ return 0;
+}
+
+U_BOOT_CMD(
+ ini, 4, 0, do_ini,
+ "parse an ini file in memory and merge the specified section into the env",
+ "section [[file-address] file-size]"
+);
--
1.7.11.5
^ permalink raw reply related [flat|nested] 10+ messages in thread* [U-Boot] [PATCH] Add a new "ini" command
2012-08-17 20:56 [U-Boot] [PATCH] Add a new "ini" command Joe Hershberger
@ 2012-08-17 23:43 ` Mike Frysinger
2012-10-03 21:15 ` [U-Boot] [PATCH v2] " Joe Hershberger
1 sibling, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2012-08-17 23:43 UTC (permalink / raw)
To: u-boot
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>
^ permalink raw reply [flat|nested] 10+ messages in thread* [U-Boot] [PATCH v2] Add a new "ini" command
2012-08-17 20:56 [U-Boot] [PATCH] Add a new "ini" command Joe Hershberger
2012-08-17 23:43 ` Mike Frysinger
@ 2012-10-03 21:15 ` Joe Hershberger
2012-10-04 1:20 ` [U-Boot] [U-Boot,v2] " Tom Rini
2012-10-04 8:49 ` [U-Boot] [PATCH v2] " Igor Grinberg
1 sibling, 2 replies; 10+ messages in thread
From: Joe Hershberger @ 2012-10-03 21:15 UTC (permalink / raw)
To: u-boot
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/
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---
Changes in v2:
- Documented in README
- Made all functions static
- Changed if statments to ternary operator selected parameters
- Return any errors from ini_parse() to the shell
README | 1 +
common/Makefile | 1 +
common/cmd_ini.c | 247 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 249 insertions(+)
create mode 100644 common/cmd_ini.c
diff --git a/README b/README
index af76b0c..dfa4f6b 100644
--- a/README
+++ b/README
@@ -814,6 +814,7 @@ The following options need to be configured:
CONFIG_CMD_IMLS List all found images
CONFIG_CMD_IMMAP * IMMR dump support
CONFIG_CMD_IMPORTENV * import an environment
+ CONFIG_CMD_INI * import data from an ini file into the env
CONFIG_CMD_IRQ * irqinfo
CONFIG_CMD_ITEST Integer/string test of 2 values
CONFIG_CMD_JFFS2 * JFFS2 Support
diff --git a/common/Makefile b/common/Makefile
index 125b2be..92e06de 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -107,6 +107,7 @@ COBJS-$(CONFIG_CMD_GPIO) += cmd_gpio.o
COBJS-$(CONFIG_CMD_I2C) += cmd_i2c.o
COBJS-$(CONFIG_CMD_IDE) += cmd_ide.o
COBJS-$(CONFIG_CMD_IMMAP) += cmd_immap.o
+COBJS-$(CONFIG_CMD_INI) += cmd_ini.o
COBJS-$(CONFIG_CMD_IRQ) += cmd_irq.o
COBJS-$(CONFIG_CMD_ITEST) += cmd_itest.o
COBJS-$(CONFIG_CMD_JFFS2) += cmd_jffs2.o
diff --git a/common/cmd_ini.c b/common/cmd_ini.c
new file mode 100644
index 0000000..652e4f6
--- /dev/null
+++ b/common/cmd_ini.c
@@ -0,0 +1,247 @@
+/*
+ * inih -- simple .INI file parser
+ *
+ * inih is released under the New BSD license (see LICENSE.txt). Go to the
+ * project home page for more info:
+ *
+ * http://code.google.com/p/inih/
+ */
+
+#include <common.h>
+#include <command.h>
+#include <environment.h>
+#include <linux/ctype.h>
+#include <linux/string.h>
+
+#ifdef CONFIG_INI_MAX_LINE
+#define MAX_LINE CONFIG_INI_MAX_LINE
+#else
+#define MAX_LINE 200
+#endif
+
+#ifdef CONFIG_INI_MAX_SECTION
+#define MAX_SECTION CONFIG_INI_MAX_SECTION
+#else
+#define MAX_SECTION 50
+#endif
+
+#ifdef CONFIG_INI_MAX_NAME
+#define MAX_NAME CONFIG_INI_MAX_NAME
+#else
+#define MAX_NAME 50
+#endif
+
+/* Strip whitespace chars off end of given string, in place. Return s. */
+static char *rstrip(char *s)
+{
+ char *p = s + strlen(s);
+
+ while (p > s && isspace(*--p))
+ *p = '\0';
+ return s;
+}
+
+/* Return pointer to first non-whitespace char in given string. */
+static char *lskip(const char *s)
+{
+ while (*s && isspace(*s))
+ s++;
+ return (char *)s;
+}
+
+/* Return pointer to first char c or ';' comment in given string, or pointer to
+ null at end of string if neither found. ';' must be prefixed by a whitespace
+ character to register as a comment. */
+static char *find_char_or_comment(const char *s, char c)
+{
+ int was_whitespace = 0;
+
+ while (*s && *s != c && !(was_whitespace && *s == ';')) {
+ was_whitespace = isspace(*s);
+ s++;
+ }
+ return (char *)s;
+}
+
+/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
+static char *strncpy0(char *dest, const char *src, size_t size)
+{
+ strncpy(dest, src, size);
+ dest[size - 1] = '\0';
+ return dest;
+}
+
+/* Emulate the behavior of fgets but on memory */
+static char *memgets(char *str, int num, char **mem, size_t *memsize)
+{
+ char *end;
+ int len;
+ int newline = 1;
+
+ end = memchr(*mem, '\n', *memsize);
+ if (end == NULL) {
+ if (*memsize == 0)
+ return NULL;
+ end = *mem + *memsize;
+ newline = 0;
+ }
+ len = min((end - *mem) + newline, num);
+ memcpy(str, *mem, len);
+ if (len < num)
+ str[len] = '\0';
+
+ /* prepare the mem vars for the next call */
+ *memsize -= (end - *mem) + newline;
+ *mem += (end - *mem) + newline;
+
+ return str;
+}
+
+/* Parse given INI-style file. May have [section]s, name=value pairs
+ (whitespace stripped), and comments starting with ';' (semicolon). Section
+ is "" if name=value pair parsed before any section heading. name:value
+ pairs are also supported as a concession to Python's ConfigParser.
+
+ For each name=value pair parsed, call handler function with given user
+ pointer as well as section, name, and value (data only valid for duration
+ of handler call). Handler should return nonzero on success, zero on error.
+
+ Returns 0 on success, line number of first error on parse error (doesn't
+ stop on first error).
+*/
+static int ini_parse(char *filestart, size_t filelen,
+ int (*handler)(void *, char *, char *, char *), void *user)
+{
+ /* Uses a fair bit of stack (use heap instead if you need to) */
+ char line[MAX_LINE];
+ char section[MAX_SECTION] = "";
+ char prev_name[MAX_NAME] = "";
+
+ char *curmem = filestart;
+ char *start;
+ char *end;
+ char *name;
+ char *value;
+ size_t memleft = filelen;
+ int lineno = 0;
+ int error = 0;
+
+ /* Scan through file line by line */
+ while (memgets(line, sizeof(line), &curmem, &memleft) != NULL) {
+ lineno++;
+ start = lskip(rstrip(line));
+
+ if (*start == ';' || *start == '#') {
+ /*
+ * Per Python ConfigParser, allow '#' comments@start
+ * of line
+ */
+ }
+#if CONFIG_INI_ALLOW_MULTILINE
+ else if (*prev_name && *start && start > line) {
+ /*
+ * Non-blank line with leading whitespace, treat as
+ * continuation of previous name's value (as per Python
+ * ConfigParser).
+ */
+ if (!handler(user, section, prev_name, start) && !error)
+ error = lineno;
+ }
+#endif
+ else if (*start == '[') {
+ /* A "[section]" line */
+ end = find_char_or_comment(start + 1, ']');
+ if (*end == ']') {
+ *end = '\0';
+ strncpy0(section, start + 1, sizeof(section));
+ *prev_name = '\0';
+ } else if (!error) {
+ /* No ']' found on section line */
+ error = lineno;
+ }
+ } else if (*start && *start != ';') {
+ /* Not a comment, must be a name[=:]value pair */
+ end = find_char_or_comment(start, '=');
+ if (*end != '=')
+ end = find_char_or_comment(start, ':');
+ if (*end == '=' || *end == ':') {
+ *end = '\0';
+ name = rstrip(start);
+ value = lskip(end + 1);
+ end = find_char_or_comment(value, '\0');
+ if (*end == ';')
+ *end = '\0';
+ rstrip(value);
+ /* Strip double-quotes */
+ if (value[0] == '"' &&
+ value[strlen(value)-1] == '"') {
+ value[strlen(value)-1] = '\0';
+ value += 1;
+ }
+
+ /*
+ * Valid name[=:]value pair found, call handler
+ */
+ strncpy0(prev_name, name, sizeof(prev_name));
+ if (!handler(user, section, name, value) &&
+ !error)
+ error = lineno;
+ } else if (!error)
+ /* No '=' or ':' found on name[=:]value line */
+ error = lineno;
+ }
+ }
+
+ return error;
+}
+
+static int ini_handler(void *user, char *section, char *name, char *value)
+{
+ char *requested_section = (char *)user;
+#ifdef CONFIG_INI_CASE_INSENSITIVE
+ int i;
+
+ for (i = 0; i < strlen(requested_section); i++)
+ requested_section[i] = tolower(requested_section[i]);
+ for (i = 0; i < strlen(section); i++)
+ section[i] = tolower(section[i]);
+#endif
+
+ if (!strcmp(section, requested_section)) {
+#ifdef CONFIG_INI_CASE_INSENSITIVE
+ for (i = 0; i < strlen(name); i++)
+ name[i] = tolower(name[i]);
+ for (i = 0; i < strlen(value); i++)
+ value[i] = tolower(value[i]);
+#endif
+ setenv(name, value);
+ printf("ini: Imported %s as %s\n", name, value);
+ }
+
+ /* success */
+ return 1;
+}
+
+static int do_ini(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ const char *section;
+ char *file_address;
+ size_t file_size;
+
+ if (argc == 1)
+ return CMD_RET_USAGE;
+
+ section = argv[1];
+ file_address = (char *)simple_strtoul(
+ argc < 3 ? getenv("loadaddr") : argv[2], NULL, 16);
+ file_size = (size_t)simple_strtoul(
+ argc < 4 ? getenv("filesize") : argv[3], NULL, 16);
+
+ return ini_parse(file_address, file_size, ini_handler, (void *)section);
+}
+
+U_BOOT_CMD(
+ ini, 4, 0, do_ini,
+ "parse an ini file in memory and merge the specified section into the env",
+ "section [[file-address] file-size]"
+);
--
1.7.11.5
^ permalink raw reply related [flat|nested] 10+ messages in thread* [U-Boot] [U-Boot,v2] Add a new "ini" command
2012-10-03 21:15 ` [U-Boot] [PATCH v2] " Joe Hershberger
@ 2012-10-04 1:20 ` Tom Rini
2012-10-04 8:49 ` [U-Boot] [PATCH v2] " Igor Grinberg
1 sibling, 0 replies; 10+ messages in thread
From: Tom Rini @ 2012-10-04 1:20 UTC (permalink / raw)
To: u-boot
On Wed, Oct 03, 2012 at 11:15:51AM -0000, 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/
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121003/d77e4848/attachment.pgp>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH v2] Add a new "ini" command
2012-10-03 21:15 ` [U-Boot] [PATCH v2] " Joe Hershberger
2012-10-04 1:20 ` [U-Boot] [U-Boot,v2] " Tom Rini
@ 2012-10-04 8:49 ` Igor Grinberg
2012-10-04 19:54 ` [U-Boot] [PATCH] Improve license declaration for cmd_ini.h Joe Hershberger
1 sibling, 1 reply; 10+ messages in thread
From: Igor Grinberg @ 2012-10-04 8:49 UTC (permalink / raw)
To: u-boot
On 10/03/12 23:15, 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/
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
> Changes in v2:
> - Documented in README
> - Made all functions static
> - Changed if statments to ternary operator selected parameters
> - Return any errors from ini_parse() to the shell
>
> README | 1 +
> common/Makefile | 1 +
> common/cmd_ini.c | 247 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 249 insertions(+)
> create mode 100644 common/cmd_ini.c
[...]
> diff --git a/common/cmd_ini.c b/common/cmd_ini.c
> new file mode 100644
> index 0000000..652e4f6
> --- /dev/null
> +++ b/common/cmd_ini.c
> @@ -0,0 +1,247 @@
> +/*
> + * inih -- simple .INI file parser
> + *
> + * inih is released under the New BSD license (see LICENSE.txt). Go to the
> + * project home page for more info:
> + *
> + * http://code.google.com/p/inih/
Hmmm, I'm wondering, is it the appropriate license for U-Boot code?
[...]
--
Regards,
Igor.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH] Improve license declaration for cmd_ini.h
2012-10-04 8:49 ` [U-Boot] [PATCH v2] " Igor Grinberg
@ 2012-10-04 19:54 ` Joe Hershberger
2012-10-05 17:26 ` Albert ARIBAUD
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Joe Hershberger @ 2012-10-04 19:54 UTC (permalink / raw)
To: u-boot
Instead of referenceing the source webpage (which can change) include
the license in the source file.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reported-by: Igor Grinberg <grinberg@compulab.co.il>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Cc: Tom Rini <trini@ti.com>
Cc: Wolfgang Denk <wd@denx.de>
---
common/cmd_ini.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/common/cmd_ini.c b/common/cmd_ini.c
index 652e4f6..74481cb 100644
--- a/common/cmd_ini.c
+++ b/common/cmd_ini.c
@@ -1,9 +1,37 @@
/*
* inih -- simple .INI file parser
*
- * inih is released under the New BSD license (see LICENSE.txt). Go to the
- * project home page for more info:
+ * Copyright (c) 2009, Brush Technology
+ * Copyright (c) 2012:
+ * Joe Hershberger, National Instruments, joe.hershberger at ni.com
+ * All rights reserved.
*
+ * The "inih" library is distributed under the following license, which is
+ * derived from and very similar to the 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Brush Technology nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BRUSH TECHNOLOGY ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL BRUSH TECHNOLOGY BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go to the project home page for more info:
* http://code.google.com/p/inih/
*/
--
1.7.11.5
^ permalink raw reply related [flat|nested] 10+ messages in thread* [U-Boot] [PATCH] Improve license declaration for cmd_ini.h
2012-10-04 19:54 ` [U-Boot] [PATCH] Improve license declaration for cmd_ini.h Joe Hershberger
@ 2012-10-05 17:26 ` Albert ARIBAUD
2012-10-05 17:51 ` Wolfgang Denk
2012-10-05 17:53 ` Wolfgang Denk
2012-10-05 22:27 ` Tom Rini
2 siblings, 1 reply; 10+ messages in thread
From: Albert ARIBAUD @ 2012-10-05 17:26 UTC (permalink / raw)
To: u-boot
Hi Joe,
On Thu, 4 Oct 2012 14:54:07 -0500, Joe Hershberger
<joe.hershberger@ni.com> wrote:
> Instead of referenceing the source webpage (which can change) include
> the license in the source file.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> Reported-by: Igor Grinberg <grinberg@compulab.co.il>
> Cc: Igor Grinberg <grinberg@compulab.co.il>
> Cc: Tom Rini <trini@ti.com>
> Cc: Wolfgang Denk <wd@denx.de>
> ---
> common/cmd_ini.c | 32 ++++++++++++++++++++++++++++++--
> 1 file changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/common/cmd_ini.c b/common/cmd_ini.c
> index 652e4f6..74481cb 100644
> --- a/common/cmd_ini.c
> +++ b/common/cmd_ini.c
> @@ -1,9 +1,37 @@
> /*
> * inih -- simple .INI file parser
> *
> - * inih is released under the New BSD license (see LICENSE.txt). Go to the
> - * project home page for more info:
> + * Copyright (c) 2009, Brush Technology
> + * Copyright (c) 2012:
> + * Joe Hershberger, National Instruments, joe.hershberger at ni.com
> + * All rights reserved.
> *
> + * The "inih" library is distributed under the following license, which is
> + * derived from and very similar to the 3-clause BSD license:
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions are met:
> + * * Redistributions of source code must retain the above copyright
> + * notice, this list of conditions and the following disclaimer.
> + * * Redistributions in binary form must reproduce the above copyright
> + * notice, this list of conditions and the following disclaimer in the
> + * documentation and/or other materials provided with the distribution.
> + * * Neither the name of Brush Technology nor the names of its contributors
> + * may be used to endorse or promote products derived from this software
> + * without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY BRUSH TECHNOLOGY ''AS IS'' AND ANY
> + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> + * DISCLAIMED. IN NO EVENT SHALL BRUSH TECHNOLOGY BE LIABLE FOR ANY
> + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + * Go to the project home page for more info:
> * http://code.google.com/p/inih/
> */
Open question: does this solve worries about the licence compatibility?
Amicalement,
--
Albert.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH] Improve license declaration for cmd_ini.h
2012-10-05 17:26 ` Albert ARIBAUD
@ 2012-10-05 17:51 ` Wolfgang Denk
0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2012-10-05 17:51 UTC (permalink / raw)
To: u-boot
Dear Albert ARIBAUD,
In message <20121005192613.1420e39b@lilith> you wrote:
>
> Open question: does this solve worries about the licence compatibility?
Not really; assuming that the previous version meant the 3-clause BSD
license (which it most probably did) there have never been any real
problems; at least http://directory.fsf.org/wiki/License:BSD_3Clause
says this is a GPL compatible license.
This patch tries to fix some ambiguities (to the extend we poor
engineers are able to deal with legal texts).
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
An armed society is a polite society.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH] Improve license declaration for cmd_ini.h
2012-10-04 19:54 ` [U-Boot] [PATCH] Improve license declaration for cmd_ini.h Joe Hershberger
2012-10-05 17:26 ` Albert ARIBAUD
@ 2012-10-05 17:53 ` Wolfgang Denk
2012-10-05 22:27 ` Tom Rini
2 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2012-10-05 17:53 UTC (permalink / raw)
To: u-boot
Dear Joe Hershberger,
In message <1349380447-27961-1-git-send-email-joe.hershberger@ni.com> you wrote:
> Instead of referenceing the source webpage (which can change) include
> the license in the source file.
Thanks.
> --- a/common/cmd_ini.c
> +++ b/common/cmd_ini.c
> @@ -1,9 +1,37 @@
> /*
> * inih -- simple .INI file parser
> *
> - * inih is released under the New BSD license (see LICENSE.txt). Go to the
> - * project home page for more info:
> + * Copyright (c) 2009, Brush Technology
> + * Copyright (c) 2012:
> + * Joe Hershberger, National Instruments, joe.hershberger at ni.com
> + * All rights reserved.
I'd prefer if you left out this "All rights reserved." But then,
there seems to be agreement amongt those to interpret such legal texts
that this is a void staement anyway, so here is my
Acked-by: Wolfgang Denk <wd@denx.de>
even if you leave it in.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
######## This message was made from 100% recycled electrons. ########
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH] Improve license declaration for cmd_ini.h
2012-10-04 19:54 ` [U-Boot] [PATCH] Improve license declaration for cmd_ini.h Joe Hershberger
2012-10-05 17:26 ` Albert ARIBAUD
2012-10-05 17:53 ` Wolfgang Denk
@ 2012-10-05 22:27 ` Tom Rini
2 siblings, 0 replies; 10+ messages in thread
From: Tom Rini @ 2012-10-05 22:27 UTC (permalink / raw)
To: u-boot
On Thu, Oct 04, 2012 at 02:54:07PM -0500, Joe Hershberger wrote:
> Instead of referenceing the source webpage (which can change) include
> the license in the source file.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> Reported-by: Igor Grinberg <grinberg@compulab.co.il>
> Cc: Igor Grinberg <grinberg@compulab.co.il>
> Cc: Tom Rini <trini@ti.com>
> Cc: Wolfgang Denk <wd@denx.de>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121005/3bf47d85/attachment.pgp>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-10-05 22:27 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-17 20:56 [U-Boot] [PATCH] Add a new "ini" command Joe Hershberger
2012-08-17 23:43 ` Mike Frysinger
2012-10-03 21:15 ` [U-Boot] [PATCH v2] " Joe Hershberger
2012-10-04 1:20 ` [U-Boot] [U-Boot,v2] " Tom Rini
2012-10-04 8:49 ` [U-Boot] [PATCH v2] " Igor Grinberg
2012-10-04 19:54 ` [U-Boot] [PATCH] Improve license declaration for cmd_ini.h Joe Hershberger
2012-10-05 17:26 ` Albert ARIBAUD
2012-10-05 17:51 ` Wolfgang Denk
2012-10-05 17:53 ` Wolfgang Denk
2012-10-05 22:27 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox