diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-02-22 22:59:56 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-02-22 22:59:56 -0800 |
commit | 07f1204a7d56e6b02098cf4b82f9f90576e7f289 (patch) | |
tree | f5787b0a143642126510af6bb39f7224969885fb /xkill.c | |
parent | acb8b93f9fe598bc58c050ca5272149fbca04b41 (diff) |
Get rid of dpy global so we don't get shadow warnings from every function
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'xkill.c')
-rw-r--r-- | xkill.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -46,7 +46,6 @@ from The Open Group. #include <X11/Xmu/WinUtil.h> -static Display *dpy = NULL; static char *ProgramName; #define SelectButtonAny (-1) @@ -62,7 +61,7 @@ static Bool wm_state_set ( Display *dpy, Window win ); static Bool wm_running ( Display *dpy, int screenno ); static void -Exit(int code) +Exit(int code, Display *dpy) { if (dpy) { XCloseDisplay (dpy); @@ -84,13 +83,14 @@ usage(void) fprintf (stderr, "usage: %s [-option ...]\n%s", ProgramName, options); - Exit (1); + Exit (1, NULL); } int main(int argc, char *argv[]) { int i; /* iterator, temp variable */ + Display *dpy = NULL; char *displayname = NULL; /* name of server to contact */ int screenno; /* screen number of dpy */ XID id = None; /* resource to kill */ @@ -137,14 +137,14 @@ main(int argc, char *argv[]) if (!dpy) { fprintf (stderr, "%s: unable to open display \"%s\"\n", ProgramName, XDisplayName (displayname)); - Exit (1); + Exit (1, dpy); } screenno = DefaultScreen (dpy); if (kill_all) { if (verify_okay_to_kill (dpy, screenno)) kill_all_windows (dpy, screenno, top); - Exit (0); + Exit (0, dpy); } /* @@ -158,7 +158,7 @@ main(int argc, char *argv[]) if (button_name && !parse_button (button_name, &button)) { fprintf (stderr, "%s: invalid button specification \"%s\"\n", ProgramName, button_name); - Exit (1); + Exit (1, dpy); } if (button >= 0 || button == SelectButtonFirst) { @@ -172,7 +172,7 @@ main(int argc, char *argv[]) fprintf (stderr, "%s: no pointer mapping, can't select window\n", ProgramName); - Exit (1); + Exit (1, dpy); } if (button >= 0) { /* check button */ @@ -183,7 +183,7 @@ main(int argc, char *argv[]) fprintf (stderr, "%s: no button number %u in pointer map, can't select window\n", ProgramName, ub); - Exit (1); + Exit (1, dpy); } } else { /* get first entry */ button = (int) ((unsigned int) pointer_map[0]); @@ -215,7 +215,7 @@ main(int argc, char *argv[]) XSync (dpy, 0); } - Exit (0); + Exit (0, dpy); /*NOTREACHED*/ return 0; } @@ -281,7 +281,7 @@ get_window_id(Display *dpy, int screen, int button, char *msg) if (cursor == None) { fprintf (stderr, "%s: unable to create selection cursor\n", ProgramName); - Exit (1); + Exit (1, dpy); } printf ("Select %s with ", msg); @@ -295,7 +295,7 @@ get_window_id(Display *dpy, int screen, int button, char *msg) if (XGrabPointer (dpy, root, False, MASK, GrabModeSync, GrabModeAsync, None, cursor, CurrentTime) != GrabSuccess) { fprintf (stderr, "%s: unable to grab cursor\n", ProgramName); - Exit (1); + Exit (1, dpy); } /* from dsimple.c in xwininfo */ |