String val = null;
try {
Iterator it = h.list().iterator();
while(it.hasNext()) {
HistoryItem hi = (HistoryItem) it.next();
if(objs) {
if(oout == null)
oout = new BufferObjectWriter(getStdOut());
oout.writeObject(pout);
} else {
StringBuffer sb = new StringBuffer();
if(time) {
sb.append(sdf.format(new Date(hi.getTime())));
sb.append(" ");
}
if(global) {
val = hi.getProject();
if(val == null)
val = "<undefined>";
sb.append(val);
sb.append(" ");
}
if(user) {
val = hi.getUser();
if(val == null)
val = "<undefined>";
sb.append(val);
sb.append(" ");
}
sb.append(hi.getCmd());
sb.append(" ");
if(clientInfo) {
String vuser = hi.getUser();
String vhost = hi.getHost();
String vapp = hi.getApp();
if(vuser != null || vhost != null || vapp == null) {
if(vuser == null) vuser = "<unknown>";
if(vhost == null) vhost = "<unknown>";
if(vapp == null) vapp = "<unknown>";