- n = snprintf(helpbuf, sizeof(helpbuf), "%s ", tmpbuf);
- if (n < 0 || n >= sizeof(helpbuf))
- continue;
- len = n;
-
- iterate_count++;
-
- /* get token dynamic help */
- if ((token->ops->help == NULL) ||
- (token->ops->help(token, tmpbuf, sizeof(tmpbuf)) < 0))
- snprintf(tmpbuf, sizeof(tmpbuf), "unknown");
-
- /* get instruction static help string */
- help_str = inst->help_str;
- if (help_str == NULL)
- help_str = "No help";
-
- /* send it to callback function */
- n = snprintf(helpbuf + len, sizeof(helpbuf) - len,
- "[%s]: %s\n", tmpbuf, help_str);
- if (n >= 0)
- write_buf(opaque, helpbuf, n + len);
+ n = snprintf(helpbuf, sizeof(helpbuf), " %s\n", tmpbuf);
+ if (n >= 0 && n < sizeof(helpbuf))
+ write_buf(opaque, helpbuf, n);