groff-commit
[Top][All Lists]
Advanced

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

[groff] 20/39: [grolbp]: Fix code style nits.


From: G. Branden Robinson
Subject: [groff] 20/39: [grolbp]: Fix code style nits.
Date: Sat, 29 Oct 2022 14:59:57 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 3f2e628a6e7cb788fd974ade22197d5f3b2157c1
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Oct 24 19:42:25 2022 -0500

    [grolbp]: Fix code style nits.
    
    * src/devices/grolbp/lbp.cpp: Fix code style nits.
    
      (main): Use standard C library symbols `EXIT_SUCCESS` and
      `EXIT_FAILURE` instead of integer literals as arguments to `exit()`.
      Add assertion.
---
 ChangeLog                  |  7 +++++++
 src/devices/grolbp/lbp.cpp | 10 +++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 53adc1c75..c596cf362 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-10-24  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/devices/grolbp/lbp.cpp: Fix code style nits.
+       (main): Use standard C library symbols `EXIT_SUCCESS` and
+       `EXIT_FAILURE` instead of integer literals as arguments to
+       `exit()`.  Add assertion.
+
 2022-10-24  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/devices/grotty/tty.cpp: Alter usage message handling.
diff --git a/src/devices/grolbp/lbp.cpp b/src/devices/grolbp/lbp.cpp
index 096a738d6..da287e3db 100644
--- a/src/devices/grolbp/lbp.cpp
+++ b/src/devices/grolbp/lbp.cpp
@@ -23,6 +23,8 @@ TODO
  - Add X command to include bitmaps
 */
 
+#include "assert.h"
+
 #include "driver.h"
 #include "lbp.h"
 #include "charset.h"
@@ -683,7 +685,7 @@ int main(int argc, char **argv)
       break;
     case 'v':
       printf("GNU grolbp (groff) version %s\n", Version_string);
-      exit(0);
+      exit(EXIT_SUCCESS);
       break;
     case 'o':
       if (strcasecmp(optarg, "portrait") == 0)
@@ -721,12 +723,14 @@ int main(int argc, char **argv)
       }
     case 'h':
       usage(stdout);
-      exit(0);
+      exit(EXIT_SUCCESS);
       break;
     case '?':
       usage(stderr);
-      exit(1);
+      exit(EXIT_FAILURE);
       break;
+    default:
+      assert(0 == "unhandled getopt_long return value");
     }
   }
   if (optind >= argc)



reply via email to

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