]> git.e2factory.org Git - e2factory.git/commitdiff
Remove e2lib.chomp() and e2lib.read_configuration()
authorTobias Ulmer <tu@emlix.com>
Thu, 24 Jan 2013 17:56:26 +0000 (18:56 +0100)
committerTobias Ulmer <tu@emlix.com>
Tue, 26 Feb 2013 18:07:14 +0000 (19:07 +0100)
Both are unused.

Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/e2lib.lua

index ece6c290463a51fcb2be31ec62b880692675b7d7..e782354add655dac05c4097d6a68c1cc27fb65bd 100644 (file)
@@ -638,15 +638,6 @@ function e2lib.is_backup_file(path)
     return string.find(path, "~$") or string.find(path, "^#.*#$")
 end
 
-function e2lib.chomp(str, chr)
-    local chr = chr or "/"
-    if string.sub(str, -1, -1) == chr then
-        return string.sub(str, 1, -2)
-    else
-        return str
-    end
-end
-
 --- quotes a string so it can be safely passed to a shell
 -- @param str string to quote
 -- @return quoted string
@@ -767,35 +758,6 @@ function e2lib.read_line(path)
     return l
 end
 
--- Iterators
---
--- These iterators are convenience functions for use in "for" statements.
---
---   read_configuration(PATH)
---
---     Returns the successive non-empty lines contained in the file PATH.
---     Comments (of the form "# ...") are removed.
-function e2lib.read_configuration(p)
-    if e2util.exists(p) then
-        local function nextline(s)
-            while true do
-                local ln = s:read("*l")
-                if not ln then
-                    s:close()
-                    return nil
-                elseif not string.find(ln, "^%s*#") and string.find(ln, "%S") then
-                    local s = string.find(ln, "#.*")
-                    if s then return string.sub(ln, 1, s - 1)
-                    else return ln end
-                end
-            end
-        end
-        return nextline, io.open(p)
-    else
-        e2lib.abort("no such file: " .. p)
-    end
-end
-
 --- read the global config file
 -- local tools call this function inside collect_project_info()
 -- global tools must call this function after parsing command line options