blob: 0d4ee40a63a5648098e1bc3b38f281fcea5cc824 (
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
|
--- ./agent/pl/utmp/utmp.pl.orig 2014-08-14 01:59:33.506704776 +0900
+++ ./agent/pl/utmp/utmp.pl 2014-08-14 01:59:33.506704776 +0900
@@ -0,0 +1,22 @@
+#
+# utmp file primitives
+#
+
+package utmp;
+
+# Return the ttys on which a given user is logged
+sub ttys {
+ local($user) = @_; # User's login name
+ local(@u);
+ open(WHO, '/usr/bin/who |') || warn "Can't invoke /usr/bin/who: $!\n";
+ while (<WHO>) {
+ next unless /^$user\s/;
+ my ($name, $line, $dummy) = split;
+ push(@u, $line);
+ }
+ close WHO;
+ return @u; # Returns array of ttys
+}
+
+package main;
+
|