format host like the real who command
This commit is contained in:
parent
9606115c1e
commit
13bbd7faec
|
@ -28,10 +28,14 @@ public class Who extends SigarCommandBase {
|
||||||
public void output(String[] args) throws SigarException {
|
public void output(String[] args) throws SigarException {
|
||||||
net.hyperic.sigar.Who[] who = this.sigar.getWhoList();
|
net.hyperic.sigar.Who[] who = this.sigar.getWhoList();
|
||||||
for (int i=0; i<who.length; i++) {
|
for (int i=0; i<who.length; i++) {
|
||||||
|
String host = who[i].getHost();
|
||||||
|
if (host.length() != 0) {
|
||||||
|
host = "(" + host + ")";
|
||||||
|
}
|
||||||
println(who[i].getUser() + "\t" +
|
println(who[i].getUser() + "\t" +
|
||||||
who[i].getDevice() + "\t" +
|
who[i].getDevice() + "\t" +
|
||||||
getTime(who[i].getTime() * 1000) + "\t" +
|
getTime(who[i].getTime() * 1000) + "\t" +
|
||||||
who[i].getHost());
|
host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue