groff-commit
[Top][All Lists]
Advanced

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

[groff] 60/80: [gxditview]: Align with modern groff conventions.


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

gbranden pushed a commit to branch master
in repository groff.

commit cfc2039015ad98073a9b79e8b4de1991de6be133
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Nov 29 00:26:43 2024 -0600

    [gxditview]: Align with modern groff conventions.
    
    * src/devices/xditview/xditview.c (Syntax): If asked for `--help`,
      summarize command purpose in message.
    
      (QuitAction): Use standard symbol `EXIT_SUCCESS` instead of `0`
      literal.
---
 ChangeLog                       |  9 +++++++++
 src/devices/xditview/xditview.c | 30 +++++++++++++++++++-----------
 2 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d2a3b87b3..5ee507f98 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,15 @@
        section.
        * NEWS: Note the change.
 
+2024-11-28  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [gxditview]: Align with modern groff conventions.
+
+       * src/devices/xditview/xditview.c (Syntax): If asked for
+       `--help`, summarize command purpose in message.
+       (QuitAction): Use standard symbol `EXIT_SUCCESS` instead of `0`
+       literal.
+
 2024-11-28  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [grops]: Align with modern groff conventions.
diff --git a/src/devices/xditview/xditview.c b/src/devices/xditview/xditview.c
index 56ed0e9b2..0ec65e74e 100644
--- a/src/devices/xditview/xditview.c
+++ b/src/devices/xditview/xditview.c
@@ -1,5 +1,6 @@
 /*
  * Copyright 1991 Massachusetts Institute of Technology
+ * Copyright (C) 1990-2024 Free Software Foundation, Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -20,7 +21,7 @@
  *
  */
 /*
- * xditview -- 
+ * xditview --
  *
  *   Display ditroff output in an X window
  */
@@ -50,10 +51,13 @@ static char rcsid[] = "$XConsortium: xditview.c,v 1.17 
89/12/10 17:05:08 rws Exp
 #include <X11/Xaw/SimpleMenu.h>
 #include <X11/Xaw/SmeBSB.h>
 
+#include <signal.h> // SIGPIPE, SIG_IGN, signal()
 #include <stdbool.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <stdio.h>
+#include <stdio.h> // FILE, fclose(), fopen(), fprintf(), fputs(),
+                  // pclose(), popen(), printf(), sprintf(), stderr,
+                  // stdin, stdout
+#include <stdlib.h> // exit(), EXIT_FAILURE, EXIT_SUCCESS
+#include <string.h> // strcmp(), strcpy(), strncpy()
 
 #include "Dvi.h"
 #include "groff_version.h"
@@ -144,8 +148,12 @@ Syntax(const char *progname, bool had_error)
                        progname);
        if (had_error)
                exit(2);
-       else
+       else {
+               fputs("\n"
+"View a troff(1) document in an X11 window. See the gxditview(1)\n"
+"manual page.\n", stream);
                exit(EXIT_SUCCESS);
+       }
 }
 
 static void    NewFile (const char *);
@@ -252,11 +260,11 @@ int main(int argc, char **argv)
                                     XtScreen(toplevel)->root,
                                     (char *)xdit_bits,
                                     xdit_width, xdit_height));
-                                   
+
     XtSetArg (topLevelArgs[1], XtNiconMask,
              XCreateBitmapFromData (XtDisplay (toplevel),
                                     XtScreen(toplevel)->root,
-                                    (char *)xdit_mask_bits, 
+                                    (char *)xdit_mask_bits,
                                     xdit_mask_width, xdit_mask_height));
     XtSetValues (toplevel, topLevelArgs, 2);
     if (argc > 1)
@@ -268,7 +276,7 @@ int main(int argc, char **argv)
     simpleMenu = XtCreatePopupShell ("menu", simpleMenuWidgetClass, toplevel,
                                    NULL, 0);
     for (i = 0; i < XtNumber (menuEntries); i++) {
-       entry = XtCreateManagedWidget(menuEntries[i].name, 
+       entry = XtCreateManagedWidget(menuEntries[i].name,
                                      smeBSBObjectClass, simpleMenu,
                                      NULL, (Cardinal) 0);
        XtAddCallback(entry, XtNcallback, menuEntries[i].function, NULL);
@@ -498,7 +506,7 @@ RerasterizeAction (Widget widget, XEvent *event,
     if (current_file_name[0] == 0) {
        /* XXX display an error message */
        return;
-    } 
+    }
     XtSetArg (args[0], XtNpageNumber, &number);
     XtGetValues (dvi, args, 1);
     NewFile(current_file_name);
@@ -588,7 +596,7 @@ QuitAction (Widget widget, XEvent *event,
     params = params;
     num_params = num_params;
 
-    exit (0);
+    exit (EXIT_SUCCESS);
 }
 
 Widget         promptShell, promptDialog;
@@ -634,7 +642,7 @@ MakePrompt(Widget centerw, const char *prompt,
     Dimension center_width, center_height;
     Dimension prompt_width, prompt_height;
     Widget  valueWidget;
-    
+
     CancelAction ((Widget)NULL, (XEvent *) 0, (String *) 0, (Cardinal *) 0);
     promptShell = XtCreatePopupShell ("promptShell", transientShellWidgetClass,
                                      toplevel, NULL, (Cardinal) 0);



reply via email to

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