groff-commit
[Top][All Lists]
Advanced

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

[groff] 21/39: [grolbp]: Handle `getopt_long()` retval better.


From: G. Branden Robinson
Subject: [groff] 21/39: [grolbp]: Handle `getopt_long()` retval better.
Date: Sat, 29 Oct 2022 14:59:58 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 74f7d5d44c36b06dcfc6013b2f3aca5f795c3d6f
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Oct 24 22:32:02 2022 -0500

    [grolbp]: Handle `getopt_long()` retval better.
    
    * src/devices/grolbp/lbp.cpp (main): Handle `getopt_long()` return value
      more idiomatically.
---
 ChangeLog                  | 5 +++++
 src/devices/grolbp/lbp.cpp | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c596cf362..26701d32f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-10-24  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/devices/grolbp/lbp.cpp (main): Handle `getopt_long()`
+       return value more idiomatically.
+
 2022-10-24  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/devices/grolbp/lbp.cpp: Fix code style nits.
diff --git a/src/devices/grolbp/lbp.cpp b/src/devices/grolbp/lbp.cpp
index da287e3db..517b7b7cd 100644
--- a/src/devices/grolbp/lbp.cpp
+++ b/src/devices/grolbp/lbp.cpp
@@ -658,11 +658,11 @@ int main(int argc, char **argv)
     program_name = strsave(argv[0]);
   font::set_unknown_desc_command_handler(handle_unknown_desc_command);
   // command line parsing
-  int c = 0;
+  int c;
   int option_index = 0;
-  while (c >= 0) {
-    c = getopt_long (argc, argv, "c:F:hI:lo:p:vw:",
-                    long_options, &option_index);
+  while ((c = getopt_long(argc, argv, "c:F:hI:lo:p:vw:", long_options,
+                         &option_index))
+        != EOF) {
     switch (c) {
     case 'F':
       font::command_line_font_dir(optarg);



reply via email to

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