Index: makefile ================================================================== --- makefile +++ makefile @@ -71,10 +71,11 @@ lib/mjson/mjson.o: lib/mjson/src/mjson.c lib/mjson/src/mjson.h lib/mjson $(CC) -c $< -o lib/mjson/mjson.o \ -DMJSON_MAX_DEPTH=16 \ -DMJSON_ENABLE_BASE64=0 \ + -DMJSON_ENABLE_NEXT=1 \ -DMJSON_ENABLE_RPC=0 lib/mbedtls/library/%.a: lib/mbedtls $(MAKE) -C lib/mbedtls/library $*.a Index: mgtool.t ================================================================== --- mgtool.t +++ mgtool.t @@ -339,10 +339,11 @@ srv:setup(cnf) srv:conprep(lib.store.prepmode.conf) var cfmode: lib.cmdparse { help = {'h','display this list'}; no_notify = {'n', "don't instruct the server to refresh its configuration cache after making changes; useful for \"transactional\" configuration changes."}; + raw = {'r', 'print output suitable for use in scripting rather than human consumption'}; } cfmode:parse(mode.arglist.ct, &mode.arglist(0)) if cfmode.help then [ lib.emit(false, 1, 'usage: ', `argv[0], ' conf ', cfmode.type.helptxt.flags, ' […]', cfmode.type.helptxt.opts, cmdhelp { { 'conf set ', 'add or a change a server configuration parameter to the database' }; @@ -367,10 +368,19 @@ lib.str.cmp(cfmode.arglist(0),'reset') == 0 or lib.str.cmp(cfmode.arglist(0),'clear') == 0 or lib.str.cmp(cfmode.arglist(0),'unset') == 0 then dlg:conf_reset(cfmode.arglist(1)) lib.report('parameter cleared') + elseif cfmode.arglist.ct == 2 and + lib.str.cmp(cfmode.arglist(0),'get') == 0 then + var val = dlg:conf(cfmode.arglist(1)) + if val:ref() then + lib.report('parameter read') + [ lib.emit(true, 1, `cfmode.arglist(1), ' = "', `{val.ptr,val.ct}, '"') ] + else + lib.warn('no such parameter present in configuration store') + end elseif cfmode.arglist.ct == 3 and lib.str.cmp(cfmode.arglist(0),'set') == 0 then dlg:conf_set(cfmode.arglist(1),cfmode.arglist(2)) lib.report('parameter set') else goto cmderr end Index: render/conf/users.t ================================================================== --- render/conf/users.t +++ render/conf/users.t @@ -51,11 +51,12 @@ king queen empress emperor majesty space martian winter fall monk katana 420 warrior banana demon devil ghost wraith cuck legend hero heroine goblin gremlin troll dragon evil overlord radiance slop operator rage hog bog roach wizard steel madness - reign + reign cosmos fantasy night day terra luna sin + grandpa grampa gramps mom dad daddy aunt uncle ]] var adjs = splitwords [[ dark super supreme ultra ultimate total infinite omnipotent crazy final deathless immortal elite leet 1337 bloody fearless headless screaming insane @@ -63,11 +64,14 @@ mighty flayed hidden secret lost mystery glorious nude naked bare first radiant martian fallen bog wandering dank demonic satanic invisible based woke deadly lethal heroic evil majestic luminous ethereal perfect first fantastic special great steel insane - royal imperial celestial cosmic mystic sublime + royal imperial celestial cosmic mystic sublime lonely + lonesome stellar reigning powerful russian spinning + revolving rotating enlarged enormous gigantic huge + nightly daily earthly lunar global ]] if xXx then a:lpush('xXx_') end if useadj then Index: srv.t ================================================================== --- srv.t +++ srv.t @@ -677,11 +677,11 @@ self.cfg:init(self) self.pool:init(self.cfg.poolinitsz) var dbbind = self:conf_get(&self.pool, 'bind') if iname == nil then iname = lib.proc.getenv('parsav_instance') end if iname == nil then - self.id = self.cfg.instance.ptr; + self.id = self.cfg.instance:cdup() -- let this leak -- it'll be needed for the lifetime of the process anyway else self.id = iname end if iname ~= nil then lib.report('parsav instance "',iname,'" starting') @@ -776,11 +776,11 @@ do self.credmgd = false var fr = self._pool:frame() var sreg = self:cfstr('credential-store') if sreg:ref() then - if lib.str.cmp(sreg.ptr, 'managed') == 0 + if sreg:cmp('managed') then self.credmgd = true else self.credmgd = false end self._pool:reset(fr) end end Index: str.t ================================================================== --- str.t +++ str.t @@ -50,10 +50,26 @@ if not @self then return strptr.null() end if self.ct == 0 then self.ct = m.sz(self.ptr) end var newstr = p:alloc(int8, self.ct) lib.mem.cpy(newstr.ptr, self.ptr, self.ct) return newstr + end + terra ty:pcdup(p: &lib.mem.pool): rawstring + if not @self then return nil end + if self.ct == 0 then self.ct = m.sz(self.ptr) end + var newstr = p:alloc(int8, self.ct + 1) + lib.mem.cpy(newstr.ptr, self.ptr, self.ct) + newstr.ptr[self.ct] = 0 + return newstr.ptr + end + terra ty:cdup(): rawstring + if not @self then return nil end + if self.ct == 0 then self.ct = m.sz(self.ptr) end + var newstr = lib.mem.heapa(int8, self.ct + 1) + lib.mem.cpy(newstr.ptr, self.ptr, self.ct) + newstr.ptr[self.ct] = 0 + return newstr.ptr end terra ty:cmp(other: ty) if self.ptr == nil and other.ptr == nil then return true end if self.ptr == nil or other.ptr == nil then return false end