grabc

Tool to identify pixel colors on X
git clone https://git.sinitax.com/muquit/grabc
Log | Files | Refs | README | Upstream | sfeed.txt

commit c70ba9ae8a6cf01431acfa9ec7525fa9ae192363
parent fb6a11964c8adfbae3c7d8d0c95af1cad232afab
Author: mmorgan <mikmorgan@gmail.com>
Date:   Thu, 12 Apr 2018 17:53:32 -0400

Delayed argument validation

Diffstat:
Mgrabc.c | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/grabc.c b/grabc.c @@ -547,12 +547,6 @@ int main(int argc,char **argv) (void) fprintf(stderr,"Example: -l +10+20\n"); return(1); } - if (g_window_id == (Window) NULL) - { - (void) fprintf(stderr,"ERROR: Please specify window id with -w in hex to use this option\n"); - (void) fprintf(stderr,"Use -W option to find the Window Id\n"); - return(1); - } g_loc_specified = True; break; @@ -587,6 +581,13 @@ int main(int argc,char **argv) */ } + if (g_loc_specified && (g_window_id == (Window) NULL)) + { + (void) fprintf(stderr,"ERROR: Please specify window id with -w in hex to use this option\n"); + (void) fprintf(stderr,"Use -W option to find the Window Id\n"); + return(1); + } + display=XOpenDisplay((char *) NULL); XSetErrorHandler(MXError);