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