format host like the real who command

This commit is contained in:
Doug MacEachern 2005-02-25 03:44:40 +00:00
parent 9606115c1e
commit 13bbd7faec
1 changed files with 5 additions and 1 deletions

View File

@ -28,10 +28,14 @@ public class Who extends SigarCommandBase {
public void output(String[] args) throws SigarException {
net.hyperic.sigar.Who[] who = this.sigar.getWhoList();
for (int i=0; i<who.length; i++) {
String host = who[i].getHost();
if (host.length() != 0) {
host = "(" + host + ")";
}
println(who[i].getUser() + "\t" +
who[i].getDevice() + "\t" +
getTime(who[i].getTime() * 1000) + "\t" +
who[i].getHost());
host);
}
}