This file is indexed.

/usr/share/irssi/scripts/df.pl is in irssi-scripts 20170711.

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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
use Irssi;
use Irssi::TextUI;
use strict;

use vars qw($VERSION %IRSSI);

$VERSION="0.1.0";
%IRSSI = (
	authors=> 'Jochem Meyers',
	contact=> 'jochem.meyers@gmail.com',
	name=> 'df',
	description=> 'Adds an item which displays the current disk usage.',
	sbitems=> 'df',
	license=> 'GPL v2 or later',
	url=> 'http://kaede.kicks-ass.net/irssi.html',
);

#########
# INFO
###
#
#  Type this to add the item:
#
#    /statusbar window add df
#
#  See
#  
#    /help statusbar
#
#  for more help on how to custimize your statusbar.
#
#  If you want to change the way the item looks, browse down to where it reads
#
#  $output .= ' [' . $device . ': A: ' . $avail{$device} . ' U%%: ' . $use{$device} . ']';
#
#  and add or remove any of the following:
#  $size{$device} is the total size of the drive
#  $used{$device} is the total amount of used space
#  $avail{$device} is the amount of available space
#  $use{$device} is the percentage of space used
#  $mount{$device} is the mount point
#
#  Next version, if I ever get around to making one, will have an easier system of changing the 
#  way the statusbar item looks.
#
#  There's a command defined, /dfupdate, which will instantly update the statusbar item. If you
#  want this information printed in the statuswindow, use /exec df -h in any window :).
#
############
# OPTIONS
######
#
#  The irssi command /set can be used to change these settings (more to follow):
#  * df_refresh_time (default: 60)
#      The number of seconds between updates.
#
###
#########
# TODO
###
#
#  - Add format support so the display is more easily customizable.
#  - Add a list of devices to display.
#  - Add a setting that'll let user define the switches to pass to df?
#
#########

#definte variables
my $output;
my ($df_refresh_tag);
my $sbitem;
my (%size, %used, %avail, %use, %mount);

#get information about the harddrives
sub getDiskInfo()
{
	my @list;
	my $skip_line_one = 1;

	open(FID, "-|", "/bin/df");
	while (<FID>)
	{
		if ($skip_line_one > 0)
		{
			$skip_line_one--;
			next;
		}
		my $line = $_;
		$line =~ s/[\s:]/ /g;
		@list = split(" ", $line);
		$list[0] =~ s/\/dev\///g;
		$size{$list[0]} = $list[1];
		$used{$list[0]} = $list[2];
		$avail{$list[0]} = $list[3];
		$use{$list[0]} = $list[4];
		$mount{$list[0]} = $list[5];
		$skip_line_one--;
		if ($skip_line_one < -100) {
			Irssi::print("More than 100 drives, this can't be.");
			return;
		}
	}
	close(FID);
}

#called by irssi to get the statusbar item
sub sb_df()
{
	my ($item, $get_size_only) = @_;
	$item->default_handler($get_size_only, "{sb $sbitem}", undef, 1);
}

sub test()
{
	refresh_df();
}
#refresh the statusbar item
sub refresh_df()
{
	getDiskInfo();
	$output = "";
	$sbitem = "";
	my @devices = keys(%size);
	my $device;
	foreach $device (@devices)
	{
		$output .= ' [' . $device . ': A: ' . $avail{$device} . ' U%%: ' . $use{$device} . ']';
	}
	$sbitem = 'DF' . $output;
	Irssi::statusbar_items_redraw('df');
	if ($df_refresh_tag)
	{
		Irssi::timeout_remove($df_refresh_tag)
	}
	my $time = Irssi::settings_get_int('df_refresh_time');
	$df_refresh_tag = Irssi::timeout_add($time*1000, 'refresh_df', undef);
}

#register the statusbar item
Irssi::statusbar_item_register('df', undef, 'sb_df');

#add settings
Irssi::settings_add_int('misc', 'df_refresh_time', 60);

Irssi::command_bind('dfupdate','test');

#run refresh_df() once so sbitem has a value
refresh_df();

################
###
# Changelog
# Version 0.1.0
#  - initial release
#
###
################