summaryrefslogtreecommitdiff
path: root/common-utils
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2014-08-06 07:43:15 -0700
committerAaron Plattner <aplattner@nvidia.com>2014-08-06 07:43:15 -0700
commitf15421e12307422e3f870a42330124d49ce7b94d (patch)
tree06f5328a916cdc3b2d2b5afb4f5d78e1e0e2831f /common-utils
parent55d05b67db79bc990db62556e154ccadfc07cfd7 (diff)
343.13343.13
Diffstat (limited to 'common-utils')
-rw-r--r--common-utils/gen-manpage-opts-helper.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/common-utils/gen-manpage-opts-helper.c b/common-utils/gen-manpage-opts-helper.c
index c05ef38..84bac62 100644
--- a/common-utils/gen-manpage-opts-helper.c
+++ b/common-utils/gen-manpage-opts-helper.c
@@ -90,7 +90,9 @@ static void print_option(const NVGetoptOption *o)
* '&' : toggles italics on and off
* '^' : toggles bold on and off
* '-' : is backslashified: "\-"
+ * '\n': resets the first character flag
* '.' : must not be the first character of a line
+ * '\'': must not be the first character of a line
*
* Trailing whitespace is omitted when italics or bold is on
*/
@@ -110,8 +112,8 @@ static void print_option(const NVGetoptOption *o)
printf("\n.I ");
}
omitWhiteSpace = italics;
+ firstchar = italics;
italics = !italics;
- firstchar = TRUE;
break;
case '^':
if (bold) {
@@ -120,8 +122,8 @@ static void print_option(const NVGetoptOption *o)
printf("\n.B ");
}
omitWhiteSpace = bold;
+ firstchar = bold;
bold = !bold;
- firstchar = TRUE;
break;
case '-':
printf("\\-");
@@ -134,6 +136,11 @@ static void print_option(const NVGetoptOption *o)
firstchar = FALSE;
}
break;
+ case '\n':
+ printf("\n");
+ omitWhiteSpace = FALSE;
+ firstchar = TRUE;
+ break;
case '.':
if (firstchar) {
fprintf(stderr, "Error: *roff can't start a line with '.' "
@@ -144,6 +151,16 @@ static void print_option(const NVGetoptOption *o)
exit(1);
}
/* fall through */
+ case '\'':
+ if (firstchar) {
+ fprintf(stderr, "Error: *roff can't start a line with '\''. "
+ "If you started a line with '\'' in the description "
+ "of the '%s' option, please add some text at the "
+ "beginning of the sentence, so that a valid manpage "
+ "can be generated.\n", o->name);
+ exit(1);
+ }
+ /* fall through */
default:
printf("%c", *s);
omitWhiteSpace = FALSE;