Commit: b46c2113d0fca1cd74fb3d9c26d3c6729fe7ae46
Parent: 7c13a4869eaea10cd138ab616c873b0226a5ff7f
Author: звездочёт
Date: Thu, 8 Aug 2019 08:27:21 +0300
Resolve #10: Compilation options
Compilation options for README.md and Makefile
Co-Authored-By: Fabian Foerg <3429782+faf0@users.noreply.github.com>
Diffstat:
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,7 +1,7 @@
PROG = xsct
CC = gcc
-CFLAGS = -Wall -std=c99 -O2 -I /usr/X11R6/include
-LDFLAGS = -L /usr/X11R6/lib -lX11 -lXrandr -lm
+CFLAGS = -Wall -Wextra -Werror -pedantic -std=c99 -O2 -I /usr/X11R6/include
+LDFLAGS = -L /usr/X11R6/lib -lX11 -lXrandr -lm -s
SRCS = sct.c
PREFIX = /usr
BIN = $(PREFIX)/bin
diff --git a/README.md b/README.md
@@ -20,7 +20,7 @@ Minor modifications were made in order to get sct to:
Compile the code using the following command:
~~~
-gcc -Wall -std=c99 -O2 -I /usr/X11R6/include sct.c -o xsct -L /usr/X11R6/lib -lX11 -lXrandr -lm -s
+gcc -Wall -Wextra -Werror -pedantic -std=c99 -O2 -I /usr/X11R6/include sct.c -o xsct -L /usr/X11R6/lib -lX11 -lXrandr -lm -s
~~~
Execute sct using the following command:
@@ -29,8 +29,7 @@ Execute sct using the following command:
./xsct 3700
~~~
-The first parameter (`3700` above) denotes the color temperature and can be
-between `1000` and `10000`.
+The first parameter (`3700` above) denotes the color temperature.
If `xsct` is called with parameter 0, the color temperature is set to `6500`.
If `xsct` is called without parameters, the current display temperature is estimated.
diff --git a/sct.c b/sct.c
@@ -16,9 +16,9 @@
* - return EXIT_SUCCESS
*
* Public domain, do as you wish.
- *
- * gcc -Wall -std=c99 -O2 -I /usr/X11R6/include sct.c -o xsct -L /usr/X11R6/lib -lX11 -lXrandr -lm -s
- *
+ *
+ * gcc -Wall -Wextra -Werror -pedantic -std=c99 -O2 -I /usr/X11R6/include sct.c -o xsct -L /usr/X11R6/lib -lX11 -lXrandr -lm -s
+ *
*/
#include <X11/Xatom.h>
@@ -140,14 +140,13 @@ static void sct_for_screen(Display *dpy, int screen, int temp)
} else {
g = log(t - TEMPERATURE_ZERO);
gammag = DoubleTrim(GAMMA_K0GR + GAMMA_K1GR * g, 0.0, 1.0);
- gammab = DoubleTrim(GAMMA_K0BR + GAMMA_K1BR * g, 0.0, 1.0);
+ gammab = DoubleTrim(GAMMA_K0BR + GAMMA_K1BR * g, 0.0, 1.0);
}
} else {
g = log(t - (TEMPERATURE_NORM - TEMPERATURE_ZERO));
gammar = DoubleTrim(GAMMA_K0RB + GAMMA_K1RB * g, 0.0, 1.0);
gammag = DoubleTrim(GAMMA_K0GB + GAMMA_K1GB * g, 0.0, 1.0);
gammab = 1.0;
-
}
int n = res->ncrtc;