This file is indexed.

/usr/share/sysdig/chisels/ansiterminal.lua is in sysdig 0.8.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
--[[
Copyright (C) 2013-2014 Draios inc.
 
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.


This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
--]]

local pairs = pairs
local tostring = tostring
local setmetatable = setmetatable
local schar = string.char

local ansiterminal = {}

local colors = {
    -- attributes
    reset = 0,
    clear = 0,
    bright = 1,
    dim = 2,
    underscore = 4,
    blink = 5,
    reverse = 7,
    hidden = 8,

    -- foreground
    black = 30,
    red = 31,
    green = 32,
    yellow = 33,
    blue = 34,
    magenta = 35,
    cyan = 36,
    white = 37,

    -- background
    onblack = 40,
    onred = 41,
    ongreen = 42,
    onyellow = 43,
    onblue = 44,
    onmagenta = 45,
    oncyan = 46,
    onwhite = 47,
}

local function makecolor(name, value)
	ansiterminal[name] = schar(27) .. '[' .. tostring(value) .. 'm'
end

function ansiterminal.enable_color(enable_colors)
    if enable_colors == true then
        for c, v in pairs(colors) do
            makecolor(c, v)
        end
    else
        for name, v in pairs(colors) do
            ansiterminal[name] = ""
        end
    end
end

function ansiterminal.clearscreen()
    io.write(schar(27) .. '[' .. "2J")
end

function ansiterminal.moveto(x, y)
    io.write(schar(27) .. '[' .. tostring(x) .. ";" .. tostring(y) .. 'H')
end

function ansiterminal.moveup(n)
    io.write(schar(27) .. '[' .. tostring(n) .. 'F')
end

function ansiterminal.clearline()
    io.write(schar(27) .. '[' .. "2K")
end

function ansiterminal.hidecursor()
    io.write(schar(27) .. '[' .. "?25l")
end

function ansiterminal.showcursor()
    io.write(schar(27) .. '[' .. "?25h")
end

function ansiterminal.setbgcol(color)
    io.write(schar(27) .. '[' .. "48;5;" .. color .. "m")
end

return ansiterminal