Skip to content

Commit d3660a8

Browse files
Matthew WilcoxSam Ravnborg
authored andcommitted
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: Matthew Wilcox <matthew@wil.cx> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
1 parent 4f5537d commit d3660a8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎scripts/kconfig/confdata.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,11 @@ int conf_read_simple(const char *name, int def)
193193
continue;
194194
*p++ = 0;
195195
p2 = strchr(p, '\n');
196-
if (p2)
197-
*p2 = 0;
196+
if (p2) {
197+
*p2-- = 0;
198+
if (*p2 == '\r')
199+
*p2 = 0;
200+
}
198201
if (def == S_DEF_USER) {
199202
sym = sym_find(line + 7);
200203
if (!sym) {
@@ -266,6 +269,7 @@ int conf_read_simple(const char *name, int def)
266269
;
267270
}
268271
break;
272+
case '\r':
269273
case '\n':
270274
break;
271275
default:

0 commit comments

Comments
 (0)