From 36d1d4021a7c38076cdcdfceae97e54bcd55d381 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 29 Sep 2008 18:01:28 +0000 Subject: 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 --- tinydns-model.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tinydns-model.lua') 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 -- cgit v1.2.3