changeset 50:8b10c998e8ae

Restart.c: pkgsrc patch + clang-format and c style
author ng0@n0.is
date Fri, 03 May 2019 20:14:50 +0000
parents e938c5e533ca
children 7258664c0ed6
files Restart.c
diffstat 1 files changed, 45 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/Restart.c	Fri May 03 20:07:15 2019 +0000
+++ b/Restart.c	Fri May 03 20:14:50 2019 +0000
@@ -53,44 +53,54 @@
 #include "uwm.h"
 #include <stdbool.h>
 
-bool Restart(window, mask, button, x, y)
-Window window;                          /* Event window. */
-int mask;                               /* Button/key mask. */
-int button;                           /* Button event detail. */
-int x, y;                               /* Event mouse position. */
+/*
+ * Window window: Event window.
+ * int mask: Button/key mask.
+ * int button: Button event detail.
+ * int x, y: Event mouse position.
+ */
+bool
+Restart (Window window, int mask, int button, int x, int y)
 {
-	XButtonEvent button_event;
-	int percentage;
-	int i;
+        XButtonEvent button_event;
+        int percentage;
+        int i;
+        extern char **environ;
+        char **oenv;
 
-	percentage = VOLUME_PERCENTAGE(Volume);
-	XBell(dpy, percentage);
-	XBell(dpy, percentage);
-	XSync (dpy, 0);
-	/*
-	 * Gag, rely on operating system to close connection because we don't
-	 * to mess ourselves up in case the exec fails.
-	 */
-#if 0
-	execvp(*Argv, Argv, Environ);
-#else
-	execvp(*Argv, Argv);
-#endif
-	for (i = 0; i < 4; i++)
-	{
-		XBell(dpy, percentage);
-		percentage += 10;
-		if (percentage > 100) percentage = 100;
-	}
-	XSync (dpy, 0);
-	fprintf(stderr, "%s:  Restart failed!\n", *Argv);
+        percentage = VOLUME_PERCENTAGE (Volume);
+        XBell (dpy, percentage);
+        XBell (dpy, percentage);
+        XSync (dpy, 0);
+        /*
+         * Gag, rely on operating system to close connection because we don't
+         * to mess ourselves up in case the exec fails.
+         */
+
+        oenv = environ;
+        environ = Environ;
+        execvp (*Argv, Argv);
+        environ = oenv;
+
+        for (i = 0; i < 4; i++)
+        {
+                XBell (dpy, percentage);
+                percentage += 10;
+                if (percentage > 100)
+                        percentage = 100;
+        }
+        XSync (dpy, 0);
+        fprintf (stderr, "%s:  Restart failed!\n", *Argv);
 }
 
-bool Quit(window, mask, button, x, y)
-Window window;                          /* Event window. */
-int mask;                               /* Button/key mask. */
-int button;                           /* Button event detail. */
-int x, y;                               /* Event mouse position. */
+/*
+ * Window window: Event window.
+ * int mask: Button/key mask.
+ * int button: Button event detail.
+ * int x, y: Event mouse position.
+ */
+bool
+Quit (Window window, int mask, int button, int x, int y)
 {
-	exit(0);
+        exit (0);
 }