diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-09-29 18:01:28 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-09-29 18:01:28 +0000 |
commit | 36d1d4021a7c38076cdcdfceae97e54bcd55d381 (patch) | |
tree | ee26f5e7d8b432dc5fabc55c52e16cf390130cfe /tinydns-model.lua | |
parent | 16b68f25144ef6d7150ba098145d231bebdbf7ad (diff) | |
download | acf-tinydns-36d1d4021a7c38076cdcdfceae97e54bcd55d381.tar.bz2 acf-tinydns-36d1d4021a7c38076cdcdfceae97e54bcd55d381.tar.xz |
Removed getopts library and added functionality to format library as opts_to_table, table_to_opts, parse_configfile2, update_configfile2, get_section, and set_section. New functions work on strings, not files. Modified all code using getopts to use format instead. Fixed nil string bugs in TCPProxy. Fixed forward only bug in DNSCache.
git-svn-id: svn://svn.alpinelinux.org/acf/tinydns/trunk@1535 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'tinydns-model.lua')
-rw-r--r-- | tinydns-model.lua | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tinydns-model.lua b/tinydns-model.lua index f84b103..a9abb90 100644 --- a/tinydns-model.lua +++ b/tinydns-model.lua @@ -2,7 +2,6 @@ module(..., package.seeall) -- Load libraries require("modelfunctions") -require("getopts") require("fs") require("format") require("validator") @@ -168,7 +167,7 @@ end function getconfig() local config = {} - local listenaddr = getopts.getoptsfromfile(configfile,"","IP") or "" + local listenaddr = format.parse_configfile2(fs.read_file(configfile),"","IP") or "" config.listen = cfe({ label="IP address to listen on", value=listenaddr, @@ -187,7 +186,7 @@ function setconfig(conf) conf.value.listen.errtxt = errtxt conf.errtxt = "Failed to set configuration" else - getopts.setoptsinfile(configfile,"","IP",conf.value.listen.value) + fs.write_file(configfile, format.update_configfile2(fs.read_file(configfile) or "","","IP",conf.value.listen.value)) end return conf |