groff-commit
[Top][All Lists]
Advanced

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

[groff] 68/80: [troff]: Align with modern groff conventions.


From: G. Branden Robinson
Subject: [groff] 68/80: [troff]: Align with modern groff conventions.
Date: Sat, 30 Nov 2024 04:02:28 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 4186c2bb2752f732f20f5c54f8c1a188ded3c236
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Nov 29 23:27:05 2024 -0600

    [troff]: Align with modern groff conventions.
    
    * src/roff/troff/input.cpp: Include system library headers before local
      ones.
    
      (main): Use standard symbol `EXIT_SUCCESS` instead of `0` literal.
---
 ChangeLog                |  9 +++++++++
 src/roff/troff/input.cpp | 27 ++++++++++++++-------------
 2 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6400de1f2..3ffb8136d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-11-29  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [troff]: Align with modern groff conventions.
+
+       * src/roff/troff/input.cpp: Include system library headers
+       before local ones.
+       (main): Use standard symbol `EXIT_SUCCESS` instead of `0`
+       literal.
+
 2024-11-29  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [refer]: Align with modern groff conventions.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 57e97d470..b99bab992 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -20,9 +20,19 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 #include <config.h>
 #endif
 
+#include <assert.h>
+#include <errno.h> // ENOENT, errno
+#include <locale.h> // setlocale()
+#include <stdio.h> // EOF, FILE, clearerr(), fclose(), fflush(),
+                  // fileno(), fopen(), fprintf(), fseek(), getc(),
+                  // pclose(), popen(), printf(), snprintf(),
+                  // sprintf(), setbuf(), stderr, stdin, stdout,
+                  // ungetc()
 #include <stdlib.h> // atoi(), exit(), EXIT_FAILURE, EXIT_SUCCESS,
                    // free(), getenv(), putenv(), strtol(), system()
-#include <string.h> // strdup()
+#include <string.h> // strdup(), strerror()
+
+#include <stack>
 
 #include "troff.h"
 #include "dictionary.h"
@@ -43,17 +53,8 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 #include "unicode.h"
 #include "curtime.h"
 
-#include <stack>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <errno.h> // errno
-
-// Needed for getpid() and isatty()
+// needed for getpid() and isatty()
 #include "posix.h"
-
 #include "nonposix.h"
 
 #ifdef NEED_DECLARATION_PUTENV
@@ -8966,7 +8967,7 @@ int main(int argc, char **argv)
     case 'v':
       {
        printf("GNU troff (groff) version %s\n", Version_string);
-       exit(0);
+       exit(EXIT_SUCCESS);
        break;
       }
     case 'I':
@@ -9066,7 +9067,7 @@ int main(int argc, char **argv)
 #endif
     case CHAR_MAX + 1: // --help
       usage(stdout, argv[0]);
-      exit(0);
+      exit(EXIT_SUCCESS);
       break;
     case '?':
       error("unrecognized command-line option '%1'", char(optopt));



reply via email to

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