Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sys/tools/syscalls/core/scret.lua
39500 views
1
--
2
-- SPDX-License-Identifier: BSD-2-Clause
3
--
4
-- Copyright (c) 2024 Tyler Baxter <[email protected]>
5
-- Copyright (c) 2023 Warner Losh <[email protected]>
6
-- Copyright (c) 2019 Kyle Evans <[email protected]>
7
--
8
9
local util = require("tools.util")
10
11
local scret = {}
12
13
scret.__index = scret
14
15
-- Processes this return type.
16
function 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
27
end
28
29
-- To add this return type to the system call.
30
function scret:add()
31
self:process()
32
return self.scret
33
end
34
35
function 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
43
end
44
45
return scret
46
47