提交 d3660a8c 编写于 作者: M Matthew Wilcox 提交者: Sam Ravnborg

kconfig: support DOS line endings

Kconfig doesn't currently handle config files with DOS line endings.
While these are, of course, an abomination, etc, etc, it can be handy
to not have to convert them first.  It's also a tiny patch and even adds
support for lines ending in just \r or even \n\r.
Signed-off-by: NMatthew Wilcox <matthew@wil.cx>
Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
上级 4f5537de
......@@ -193,8 +193,11 @@ int conf_read_simple(const char *name, int def)
continue;
*p++ = 0;
p2 = strchr(p, '\n');
if (p2)
*p2 = 0;
if (p2) {
*p2-- = 0;
if (*p2 == '\r')
*p2 = 0;
}
if (def == S_DEF_USER) {
sym = sym_find(line + 7);
if (!sym) {
......@@ -266,6 +269,7 @@ int conf_read_simple(const char *name, int def)
;
}
break;
case '\r':
case '\n':
break;
default:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册