1-- 2-- SPDX-License-Identifier: BSD-2-Clause 3-- 4-- Copyright (c) 2024 Tyler Baxter <agge@FreeBSD.org> 5-- Copyright (c) 2023 Warner Losh <imp@bsdimp.com> 6-- Copyright (c) 2019 Kyle Evans <kevans@FreeBSD.org> 7-- 8 9local util = require("tools.util") 10 11local scret = {} 12 13scret.__index = scret 14 15-- Processes this return type. 16function scret:process() 17 local words = util.split(self.scret, "%S+") 18 self.scret = words[1] 19 -- Pointer incoming. 20 if words[2]:sub(1,1) == "*" then 21 self.scret = self.scret .. " " 22 end 23 while words[2]:sub(1,1) == "*" do 24 words[2] = words[2]:sub(2) 25 self.scret = self.scret .. "*" 26 end 27end 28 29-- To add this return type to the system call. 30function scret:add() 31 self:process() 32 return self.scret 33end 34 35function scret:new(obj, line) 36 obj = obj or { } 37 setmetatable(obj, self) 38 self.__index = self 39 40 self.scret = line 41 42 return obj 43end 44 45return scret 46