kconfig: support DOS line endings
authorMatthew Wilcox <matthew@wil.cx>
Thu, 13 Jul 2006 18:54:07 +0000 (12:54 -0600)
committerSam Ravnborg <sam@neptun.ravnborg.org>
Mon, 25 Sep 2006 07:00:00 +0000 (09:00 +0200)
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>
scripts/kconfig/confdata.c

index a69d8acbf274fc958c8e0eff2c5038e72fa03b00..69f96b398c22848d39d31907adb43505884a361a 100644 (file)
@@ -193,8 +193,11 @@ load:
                                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 @@ load:
                                ;
                        }
                        break;
+               case '\r':
                case '\n':
                        break;
                default: