[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 09/30: [xtotroff]: Add assertion to argument handling.
From: |
G. Branden Robinson |
Subject: |
[groff] 09/30: [xtotroff]: Add assertion to argument handling. |
Date: |
Sun, 22 Dec 2024 19:39:17 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit 72320079391a3df6b377fe3a2e5ee1defc1fe5ba
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Dec 21 15:39:21 2024 -0600
[xtotroff]: Add assertion to argument handling.
* src/utils/xtotroff/xtotroff.c (main): Throw assertion if we don't
handle `getopt_long()`'s return value.
---
ChangeLog | 5 +++++
src/utils/xtotroff/xtotroff.c | 7 +++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 764ea108e..7236d5610 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-12-21 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/utils/xtotroff/xtotroff.c (main): Throw assertion if we
+ don't handle `getopt_long()`'s return value.
+
2024-12-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/hpftodit/hpftodit.cpp (main):
diff --git a/src/utils/xtotroff/xtotroff.c b/src/utils/xtotroff/xtotroff.c
index 0aa8a6bd6..adff7da6b 100644
--- a/src/utils/xtotroff/xtotroff.c
+++ b/src/utils/xtotroff/xtotroff.c
@@ -27,6 +27,8 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>. */
#endif
#include <X11/Xlib.h>
+
+#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <ctype.h>
@@ -37,7 +39,7 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>. */
#include <fcntl.h>
#include <limits.h>
-#include <getopt.h>
+#include <getopt.h> // getopt_long()
#include "XFontName.h"
#include "DviChar.h"
@@ -326,7 +328,8 @@ int main(int argc, char **argv)
usage(stderr);
exit(2);
break;
- // XXX: need assert() for default case
+ default:
+ assert(0 == "unhandled getopt_long return value");
}
}
if (argc - optind != 1) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 09/30: [xtotroff]: Add assertion to argument handling.,
G. Branden Robinson <=