// prints names only once
List<FunInfo> funInfoList = funTable.getFunInfoList();
Iterator<FunInfo> it = funInfoList.iterator();
String prevName = null;
while (it.hasNext()) {
FunInfo fi = it.next();
String name = fi.getName();
if (prevName == null || ! prevName.equals(name)) {
buf.append(name);
buf.append(nl);
prevName = name;
}
}
} else if (tokens.length == 2) {
String funcname = tokens[1];
List<FunInfo> funInfoList = funTable.getFunInfoList();
List<FunInfo> matches = new ArrayList<FunInfo>();
for (FunInfo fi : funInfoList) {
if (fi.getName().equalsIgnoreCase(funcname)) {
matches.add(fi);
}
}
if (matches.size() == 0) {
buf.append("Bad function name \"");
buf.append(funcname);
buf.append("\", usage:");
buf.append(nl);
appendList(buf);
} else {
Iterator<FunInfo> it = matches.iterator();
boolean doname = true;
while (it.hasNext()) {
FunInfo fi = it.next();
if (doname) {
buf.append(fi.getName());
buf.append(nl);
doname = false;
}
appendIndent(buf, 1);
buf.append(fi.getDescription());
buf.append(nl);
String[] sigs = fi.getSignatures();
if (sigs == null) {
appendIndent(buf, 2);
buf.append("Signature: ");
buf.append("NONE");
buf.append(nl);