gbranden pushed a commit to branch master
in repository groff.

commit 31135e843d74b505d7b316ea12cbdf91673df0ec
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Jul 4 19:02:58 2026 -0500

    [grn]: exit(3) as the grn(1) man page says.
    
    * src/preproc/grn/main.cpp (operand): Exit with status 2, not 8, when
      command-line option argument is missing.
    
      (interpret): Exit with POSIX `EXIT_FAILURE` status, not 8, when
      reading an unrecognized command keyword.
    
    * NEWS: Document these changes in behavior.
---
 ChangeLog                | 9 +++++++++
 NEWS                     | 5 +++++
 src/preproc/grn/main.cpp | 4 ++--
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e343992f4..acdb3683a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-07-04  G. Branden Robinson <[email protected]>
+
+       * src/preproc/grn/main.cpp (operand): Exit with status 2, not 8,
+       when command-line option argument is missing.
+       (interpret): Exit with POSIX `EXIT_FAILURE` status, not 8, when
+       reading an unrecognized command keyword.
+
+       * NEWS: Document these changes in behavior.
+
 2026-07-04  G. Branden Robinson <[email protected]>
 
        [grn]: Boolify.
diff --git a/NEWS b/NEWS
index 2df12bf40..2c81db3cc 100644
--- a/NEWS
+++ b/NEWS
@@ -178,6 +178,11 @@ Miscellaneous
 *  The new document "Groff-PDF-Features.pdf" surveys the PDF features
    that groff enables and exposes in its full-service macro packages.
 
+*  The grn command now exits with status 2 instead of 8 on usage errors
+   arising from missing arguments to command-line options.  It now exits
+   with the POSIX standard `EXIT_FAILURE` status (1) instead of 8 when
+   reading an unrecognized command keyword.
+
 *  The 'configure' options '--{en,dis}able-groff-allocator' introduced
    in groff 1.23.0 are now deprecated.  `--disable-groff-allocator` has
    been implicit since that release, and we've received no reports of a
diff --git a/src/preproc/grn/main.cpp b/src/preproc/grn/main.cpp
index a3721133c..dc2835f0e 100644
--- a/src/preproc/grn/main.cpp
+++ b/src/preproc/grn/main.cpp
@@ -316,7 +316,7 @@ operand(int *argcp,
     return (**argvp + 2);      /* operand immediately follows */
   if ((--*argcp) <= 0) {       /* no operand */
     error("command-line option operand missing.");
-    exit(8);
+    exit(2);
   }
   return (*(++(*argvp)));      /* operand is next word */
 }
@@ -958,7 +958,7 @@ interpret(char *line)
 
   default:
     error("unknown command '%1' on line %2", str1, linenum);
-    exit(8);
+    exit(EXIT_FAILURE);
     break;
   };
 }

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to