groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 06/20: [pfbtops]: Use assert() to catch programmer error.


From: G. Branden Robinson
Subject: [groff] 06/20: [pfbtops]: Use assert() to catch programmer error.
Date: Mon, 21 Oct 2024 20:14:52 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit f6fa81eece8cf59afc250dda78cdab8fd9628d3e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Oct 18 17:51:48 2024 -0500

    [pfbtops]: Use assert() to catch programmer error.
    
    * src/utils/pfbtops/pfbtops.c (main): Call `assert()` to catch
      programmer error in command-line option handling.
---
 ChangeLog                   | 5 +++++
 src/utils/pfbtops/pfbtops.c | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 025639725..759444b74 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-10-18  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/utils/pfbtops/pfbtops.c (main): Call `assert()` to catch
+       programmer error in command-line option handling.
+
 2024-10-18  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/utils/lookbib/lookbib.cpp (main): Make `assert()` message
diff --git a/src/utils/pfbtops/pfbtops.c b/src/utils/pfbtops/pfbtops.c
index 8fbe44a79..8479739cb 100644
--- a/src/utils/pfbtops/pfbtops.c
+++ b/src/utils/pfbtops/pfbtops.c
@@ -24,6 +24,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 
 #define __GETOPT_PREFIX groff_
 
+#include <assert.h> // assert()
 #include <errno.h> // errno
 #include <stdio.h>
 #include <stdlib.h> // exit(), EXIT_FAILURE, EXIT_SUCCESS
@@ -193,6 +194,8 @@ int main(int argc, char **argv)
       usage(stderr);
       exit(2);
       break;
+    default:
+      assert(0 == "unhandled case of command-line option");
     }
   }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]