+/*
+ * list_options
+ *
+ * List options line by line. This is mostly for bash auto completion and to
+ * avoid difficult parsing.
+ */
+static void list_options(FILE *ofp)
+{
+ int i = 0;
+ struct option *option = NULL;
+
+ option = &long_options[i];
+ while (option->name != NULL) {
+ fprintf(ofp, "--%s\n", option->name);
+
+ if (isprint(option->val)) {
+ fprintf(ofp, "-%c\n", option->val);
+ }
+
+ i++;
+ option = &long_options[i];
+ }
+}
+
+/*
+ * list_commands
+ *
+ * List commands line by line. This is mostly for bash auto completion and to
+ * avoid difficult parsing.
+ */
+static void list_commands(FILE *ofp)
+{
+ int i = 0;
+ struct cmd_struct *cmd = NULL;
+
+ cmd = &commands[i];
+ while (cmd->name != NULL) {
+ fprintf(ofp, "%s\n", cmd->name);
+ i++;
+ cmd = &commands[i];
+ }
+}
+