From a52a5ffad03771cf7cc9ed1eaef20841529c8af3 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 1 Dec 2008 19:05:51 +0000 Subject: Modified interfaces to fix parsing of interfaces file. Allow '.' characters in interface names and modify comments so they stay with the appropriate interface. git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@1614 ab2d0c66-481e-0410-8bed-d214d4d58bed --- interfaces-model.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/interfaces-model.lua b/interfaces-model.lua index 8d4a32b..b67b463 100644 --- a/interfaces-model.lua +++ b/interfaces-model.lua @@ -182,10 +182,7 @@ iface.unpack_interfaces = function () local comment = "" local auto = {} - for line in string.gmatch ( iface.file.value, ".-\n") do - -- strip leading spaces, tabs - line = string.gsub (line, "^[%s]*", "") - line = string.gsub (line, "\n*$", "") + for line in string.gmatch ( iface.file.value, "%s*([^\n]*%S)%s*\n?") do -- it can be #, auto, iface, or a parameter if string.match(line, "^#") then comment = iface.append(comment, line , "#%s*" ) @@ -193,7 +190,7 @@ iface.unpack_interfaces = function () local name = string.match(line, "auto%s+(%w+)") auto[name] = true elseif string.match(line, "^iface") then - local name, family, method = string.match(line, "%w+%s+(%w+)%s+(%w+)%s+(%w+)") + local name, family, method = string.match(line, "%w+%s+([%w.]+)%s+(%w+)%s+(%w+)") array[#array + 1] = iface.iface_type(family, method) local interface = array[#array].value interface.comment.value = comment @@ -206,6 +203,10 @@ iface.unpack_interfaces = function () string.match(line, "(%S+)%s*(.*)$") if (param) then local interface = array[#array].value + if comment ~= "" then + interface.comment.value = iface.append(interface.comment.value, comment) + comment = "" + end if not (interface[param]) then interface[param] = cfe({label=param, errtxt = "Unknown parameter"}) end -- cgit v1.2.3