diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-12-01 19:05:51 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-12-01 19:05:51 +0000 |
commit | a52a5ffad03771cf7cc9ed1eaef20841529c8af3 (patch) | |
tree | bc2a5020f19edc7c34386aefa8fb07165ca32c30 | |
parent | 9cf197c9ac5226e9ebe142acee231fcef5b8f801 (diff) | |
download | acf-alpine-baselayout-a52a5ffad03771cf7cc9ed1eaef20841529c8af3.tar.bz2 acf-alpine-baselayout-a52a5ffad03771cf7cc9ed1eaef20841529c8af3.tar.xz |
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
-rw-r--r-- | interfaces-model.lua | 11 |
1 files 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 |