static void __add_optional_opt_line(struct cmd_context *cmdtool, struct command *cmd, int argc, char *argv[]);
+static unsigned _was_hyphen = 0;
+static void printf_hyphen(char c)
+{
+ /* When .hy 1 was printed, we do not want to emit empty space */
+ printf("%c%c\n", _was_hyphen ? '\n' : ' ', c);
+ _was_hyphen = 0;
+}
+
/*
* modifies buf, replacing the sep characters with \0
* argv pointers point to positions in buf
}
}
- printf(" )\n");
+ printf_hyphen(')');
}
if (!any_req && cmd->ro_count) {
char *line_argv[MAX_LINE_ARGC];
int line_argc;
int i;
+
+ _was_hyphen = 0;
int is_relative_opt = (opt_enum == size_ARG) ||
(opt_enum == extents_ARG) ||
(opt_enum == poolmetadatasize_ARG) ||
if (strchr(str, '|')) {
if (!(line = strdup(str)))
return;
+ if ((_was_hyphen = (strlen(line) > 42)))
+ /* TODO: prevent line to end with already printed space */
+ printf("\n.nh\n");
_split_line(line, &line_argc, line_argv, '|');
for (i = 0; i < line_argc; i++) {
if (i)
- printf("|");
+ printf("|%s", _was_hyphen ? "\\:" : "");
if (strstr(line_argv[i], "Number"))
printf("\\fI%s\\fP", line_argv[i]);
else
printf("\\fB%s\\fP", line_argv[i]);
}
+ if (_was_hyphen)
+ printf("\n.hy");
free(line);
return;
}
else {
if (sep) printf("|");
- if (!usage || !val_names[val_enum].usage)
+ if (!usage || !val_names[val_enum].usage) {
+ if (_was_hyphen) {
+ printf("\n");
+ _was_hyphen = 0;
+ }
printf("\\fI%s\\fP", val_names[val_enum].name);
- else
+ } else
_print_val_man(cname, opt_enum, val_enum);
sep = 1;
int need_ro_indent_end = 0;
int include_extents = 0;
+ _was_hyphen = 0;
if (!(cname = _find_command_name(cmd->name)))
return;
sep++;
}
- printf(" )\n");
+ printf_hyphen(')');
printf(".RE\n");
}
printf(".ad l\n");
printf("[ \\fB-l\\fP|\\fB--extents\\fP ");
_print_val_man(cname, extents_ARG, opt_names[extents_ARG].val_enum);
- printf(" ]\n");
+
+ printf_hyphen(']');
printf(".ad b\n");
sep = 1;
}
printf(" ");
_print_def_man(cname, opt_enum, &cmd->optional_opt_args[oo].def, 1);
}
- printf(" ]\n");
+ printf_hyphen(']');
printf(".ad b\n");
sep = 1;
}
printf(" ");
_print_def_man(cname, opt_enum, &cmd->optional_opt_args[oo].def, 1);
}
- printf(" ]\n");
+ printf_hyphen(']');
printf(".ad b\n");
sep = 1;
}
}
}
- printf(" ]\n");
+ printf_hyphen(']');
printf(".RE\n");
}
printf(" ");
_print_def_man(cname, opt_enum, &cmd->optional_opt_args[oo].def, 1);
}
- printf(" ]\n");
+ printf_hyphen(']');
printf(".ad b\n");
sep = 1;
break;
printf(" ");
_print_def_man(cname, opt_enum, &cmd->optional_opt_args[oo].def, 1);
}
- printf(" ]\n");
+ printf_hyphen(']');
printf(".ad b\n");
sep = 1;
break;
printf(" ");
_print_def_man(cname, opt_enum, &cmd->optional_opt_args[oo].def, 1);
}
- printf(" ]\n");
+ printf_hyphen(']');
printf(".ad b\n");
sep = 1;
break;
printf(" ");
_print_def_man(cname, opt_enum, &cmd->optional_opt_args[oo].def, 1);
}
- printf(" ]\n");
+ printf_hyphen(']');
printf(".ad b\n");
sep = 1;
break;