This file is indexed.

/usr/share/mgm/modules/linux/context is in mgm 1.1.svn.20080520-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
# -*-Perl-*-

# instances allowed: one 

# (single instance modules would be silly to use more than one of
# anyway, so we use package local storage.  This is faster and places
# less artificial load on the machine than doing everything through
# the object hash)

package MGMmodule::context;
use vars qw($xpath $context $prev $widget $graph $lastmod);

# class init
sub module_init{
    my$this=shift;
    my$toplevel=$this->{"toplevel"};
    my$xclass=$this->{"xclass"};

    # is the helper up and running?
    if(!defined($MGMmodule::helperST::proc{"ctxt"})){
	$toplevel->optionAdd("$xclass.active",'false',21);   
    } 
    $toplevel->optionAdd("$xclass.order",3,21);   
    $this;
}

# instance init
sub module_instance{
    my$this=shift;
    my$toplevel=$this->{"toplevel"};
    return undef if(defined($xpath));
    $xpath=$this->{"xpath"};
    
    # modify defaults
    $toplevel->optionAdd("$xpath.bar.0.label", "context",21);
    $toplevel->optionAdd("$xpath.scalereturn", 30,21);
    $toplevel->optionAdd("$xpath.scalewidadj", 80,21);
    $toplevel->optionAdd("$xpath.scalelenadj", 60,21);
    
    # this relies on the above defaults

    my($minx,$miny)=MGM::Graph::calcxysize($this,1024*1024*512,
					   '/s',1);
    
    $toplevel->optionAdd("$xpath.minx",        $minx,21);      
    $toplevel->optionAdd("$xpath.miny",        $miny,21);      
    $this;
}

# instance widget build
sub module_run{
    my$this=shift;
    
    $graph=MGM::Graph->new($this,num=>1,
			   prompt=>'/s',
			   minscale=>1024);
    
    $lastmod=-1;
    $widget=$graph->{"widget"};        # must return the widget
}

sub read_proc{
    # now uses the 00helper to save on opens 
    ($context)=split ' ',$MGMmodule::helperST::proc{"ctxt"};
}

sub module_update{ 
    my$this=shift;
    
    # don't update unless the helper has
    if($lastmod!=$MGMmodule::helperST::lastmod){
	my$time=$MGMmodule::helperST::lastmod;
	
	$this->read_proc;
	if(defined($prev)){
	    my$f=($context-$prev)/($time-$lastmod)*100;
	    
	    # don't be clever and only call set if values change; set must
	    # be called each refresh period or the graph will get
	    # confused.
	    
	    $graph->set($f);
	}
	
	$prev=$context;
	$lastmod=$time;
    }
}

sub destroy{
    undef $xpath;
}

bless {};