Re: [PATCH] (6) Various small changes

2021-11-20 Thread Thomas Adam
On Sat, Nov 20, 2021 at 03:03:44AM +0100, Dominik Vogt wrote:
> For master:
> 
> 0001: Fix uninitialised variables in lib.
> 0002: Remove "-blackout" option.
> 0003: Docuement -v and alias it to --verbose.
> 0004: Don't list all options in the SYNOPSIS.
> 0005: Change getpwuid.c interface (for next patch)
> 0006: Implement -o/--output-logfile option.
>   If given, use that logfile (abs or relative path)
>   If the path is just "-", use stderr
>   If not present use file from env variable
>   If not presen, use default.
> 
> fvwm -v -o - ...   # to stderr
> fvwm -v -o //home/foo/bar  # to file
> 
>   The patch also fixes a memory leak.

Makes sense.  Applied, with a few tweaks.

Note that the use of stderr is going to be interesting.  Unless you've
explicitly captured stderr beforehand, some display managers won't capture
stderr which is why I didn't previously include it, but then again if you're
still starting fvwm via .xsession or .xinitrc, this will be useful.

Kindly,
Thomas



[PATCH] (6) Various small changes

2021-11-19 Thread Dominik Vogt
For master:

0001: Fix uninitialised variables in lib.
0002: Remove "-blackout" option.
0003: Docuement -v and alias it to --verbose.
0004: Don't list all options in the SYNOPSIS.
0005: Change getpwuid.c interface (for next patch)
0006: Implement -o/--output-logfile option.
  If given, use that logfile (abs or relative path)
  If the path is just "-", use stderr
  If not present use file from env variable
  If not presen, use default.

fvwm -v -o - ...   # to stderr
fvwm -v -o //home/foo/bar  # to file

  The patch also fixes a memory leak.

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt
From c81eb2cf991a5af850850ecf87d38bf6851bd788 Mon Sep 17 00:00:00 2001
From: Dominik Vogt 
Date: Sat, 20 Nov 2021 00:31:31 +0100
Subject: [PATCH 1/6] Fix uninitialised varibles.

---
 libs/FScreen.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libs/FScreen.c b/libs/FScreen.c
index 32ee78a7..ffe4d4bb 100644
--- a/libs/FScreen.c
+++ b/libs/FScreen.c
@@ -806,10 +806,10 @@ void FScreenTranslateCoordinates(
 int FScreenClipToScreen(fscreen_scr_arg *arg, fscreen_scr_t screen,
 			int *x, int *y, int w, int h)
 {
-	int sx;
-	int sy;
-	int sw;
-	int sh;
+	int sx = 0;
+	int sy = 0;
+	int sw = 0;
+	int sh = 0;
 	int lx = (x) ? *x : 0;
 	int ly = (y) ? *y : 0;
 	int x_grav = GRAV_POS;
@@ -852,10 +852,10 @@ int FScreenClipToScreen(fscreen_scr_arg *arg, fscreen_scr_t screen,
 void FScreenCenterOnScreen(fscreen_scr_arg *arg, fscreen_scr_t screen,
 			   int *x, int *y, int w, int h)
 {
-	int sx;
-	int sy;
-	int sw;
-	int sh;
+	int sx = 0;
+	int sy = 0;
+	int sw = 0;
+	int sh = 0;
 	int lx;
 	int ly;

@@ -895,10 +895,10 @@ void FScreenGetResistanceRect(
 Bool FScreenIsRectangleOnScreen(fscreen_scr_arg *arg, fscreen_scr_t screen,
 rectangle *rec)
 {
-	int sx;
-	int sy;
-	int sw;
-	int sh;
+	int sx = 0;
+	int sy = 0;
+	int sw = 0;
+	int sh = 0;

 	FScreenGetScrRect(arg, screen, , , , );

--
2.30.2

From 31b4637b705a1ff567b9846a77dd284e29b069ef Mon Sep 17 00:00:00 2001
From: Dominik Vogt 
Date: Sat, 20 Nov 2021 00:32:44 +0100
Subject: [PATCH 2/6] Remove obsolete option "-blackout".

---
 doc/fvwm3_manpage_source.adoc | 7 ---
 fvwm/fvwm3.c  | 7 ---
 2 files changed, 14 deletions(-)

diff --git a/doc/fvwm3_manpage_source.adoc b/doc/fvwm3_manpage_source.adoc
index e9642463..8509b27f 100644
--- a/doc/fvwm3_manpage_source.adoc
+++ b/doc/fvwm3_manpage_source.adoc
@@ -4,7 +4,6 @@
 _config-file_] [*-r*] [*-s* [_screen_num_]] [*-V*] [*-C* _visual-class_
 | *-I* _visual-id_] [*-l* _colors_ [*-L*] [*-A*] [*-S*] [*-P*]] [*-D*]
 [*-h*] [*-i* _client-id_] [*-F* _state-file_] [*--debug-stack-ring*]
-[*-blackout*]

 == DESCRIPTION

@@ -234,12 +233,6 @@ default, when fvwm does not need a color any more it frees this color so
 that a new color can be used. This option may speed up image loading and
 save a few bits of memory.

-*-blackout*::
-
-This option is provided for backward compatibility only. Blacking out
-the screen during startup is not necessary (and doesn't work) anymore.
-This option will be removed in the future.
-
 *--debug-stack-ring*::

 Enables stack ring debugging. This option is only intended for internal
diff --git a/fvwm/fvwm3.c b/fvwm/fvwm3.c
index 90acfe13..7f4db058 100644
--- a/fvwm/fvwm3.c
+++ b/fvwm/fvwm3.c
@@ -1931,13 +1931,6 @@ int main(int argc, char **argv)
 			usage(1);
 			exit(0);
 		}
-		else if (strcmp(argv[i], "-blackout") == 0)
-		{
-			/* obsolete option */
-			fvwm_debug(__func__,
-   "The -blackout option is obsolete, it will be "
-   "removed in 3.0.");
-		}
 		else if (strcmp(argv[i], "-r") == 0 ||
 			 strcmp(argv[i], "-replace") == 0 ||
 			 strcmp(argv[i], "--replace") == 0)
--
2.30.2

From 6d4a0afc69f7ebe7c829025e220b40b43487137f Mon Sep 17 00:00:00 2001
From: Dominik Vogt 
Date: Sat, 20 Nov 2021 00:44:58 +0100
Subject: [PATCH 3/6] Document -v option and alias it to --verbose.

---
 doc/fvwm3_manpage_source.adoc | 2 +-
 fvwm/fvwm3.c  | 5 -
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/fvwm3_manpage_source.adoc b/doc/fvwm3_manpage_source.adoc
index 8509b27f..f647dffa 100644
--- a/doc/fvwm3_manpage_source.adoc
+++ b/doc/fvwm3_manpage_source.adoc
@@ -238,7 +238,7 @@ save a few bits of memory.
 Enables stack ring debugging. This option is only intended for internal
 debugging and should only be used by developers.

-*-v*::
+*-v* | *--verbose*::

 Enables debug logging. Writes in append mode to fvwm log file, which is
 ~/.fvwm/fvwm3-output.log by default. See ENVIRONMENT section on how to
diff --git a/fvwm/fvwm3.c b/fvwm/fvwm3.c
index 7f4db058..972c208d 100644
--- a/fvwm/fvwm3.c
+++ b/fvwm/fvwm3.c
@@ -1246,6 +1246,7 @@ static void usage(int is_verbose)
 		   " -r:   replace running window manager\n"
 		   " -s [screen]:  manage a single screen\n"
 		   " -S:   static palette\n"
+		   " -v:   verbose log output\n"
 		   " -V: