xrectdraw

Draw geometry of a rectangular screen region
git clone git://git.noxz.tech/xrectdraw
Log | Files | Refs | README | LICENSE

commit 7e5d0260579619aa6c91d4149aee82cf9e6eacaf
parent 38eedb32ffe945c37dedb554afbb0fda70111c2f
Author: Chris Noxz <chris@noxz.tech>
Date:   Fri,  1 Nov 2019 15:05:33 +0100

Add 'die' function

Diffstat:
Mxrectdraw.c | 15++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/xrectdraw.c b/xrectdraw.c @@ -1,5 +1,6 @@ #include <stdio.h> #include <stdlib.h> +#include <stdarg.h> #include <string.h> #include <X11/Xlib.h> @@ -14,6 +15,18 @@ XColor color; XColor color_dim; void +die(char *format, ...) +{ + va_list args; + + va_start(args, format); + vprintf(format, args); + va_end(args); + + exit(1); +} + +void draw(int x, int y, int width, int height) { int i; @@ -139,7 +152,7 @@ main(int argc, char *argv[]) if (argc != 6 || strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) { - printf("usage: %s x y width height #RRGGBB\n", argv[0]); + die("usage: %s x y width height #RRGGBB\n", argv[0]); return 1; }