projects
/
xmenu
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
config.h
[xmenu]
/
xmenu.c
diff --git
a/xmenu.c
b/xmenu.c
index
88b3d53
..
41303cc
100644
(file)
--- a/
xmenu.c
+++ b/
xmenu.c
@@
-79,7
+79,7
@@
static void setcurrmenu(struct Menu *currmenu_new);
static void parsestdin(void);
static void run(void);
static void freewindow(struct Menu *menu);
static void parsestdin(void);
static void run(void);
static void freewindow(struct Menu *menu);
-static void cleanup
exit
(void);
+static void cleanup(void);
static void usage(void);
/* X variables */
static void usage(void);
/* X variables */
@@
-146,7
+146,9
@@
main(int argc, char *argv[])
/* run event loop */
run();
/* run event loop */
run();
- return 1; /* UNREACHABLE */
+ cleanup();
+
+ return 0;
}
/* get color from color string */
}
/* get color from color string */
@@
-576,8
+578,6
@@
run(void)
struct Item *previtem = NULL;
XEvent ev;
struct Item *previtem = NULL;
XEvent ev;
- setcurrmenu(rootmenu);
-
while (!XNextEvent(dpy, &ev)) {
switch(ev.type) {
case Expose:
while (!XNextEvent(dpy, &ev)) {
switch(ev.type) {
case Expose:
@@
-608,11
+608,11
@@
run(void)
setcurrmenu(item->submenu);
} else {
printf("%s\n", item->output);
setcurrmenu(item->submenu);
} else {
printf("%s\n", item->output);
-
cleanupexit()
;
+
return
;
}
drawmenu();
} else {
}
drawmenu();
} else {
-
cleanupexit()
;
+
return
;
}
break;
case LeaveNotify:
}
break;
case LeaveNotify:
@@
-639,19
+639,18
@@
freewindow(struct Menu *menu)
/* cleanup and exit */
static void
/* cleanup and exit */
static void
-cleanup
exit
(void)
+cleanup(void)
{
freewindow(rootmenu);
XFreeFont(dpy, dc.font);
XFreeGC(dpy, dc.gc);
XCloseDisplay(dpy);
{
freewindow(rootmenu);
XFreeFont(dpy, dc.font);
XFreeGC(dpy, dc.gc);
XCloseDisplay(dpy);
- exit(0);
}
/* show usage */
static void
usage(void)
{
}
/* show usage */
static void
usage(void)
{
- (void)fprintf(stderr, "usage: xmenu [-w]
menuname
\n");
+ (void)fprintf(stderr, "usage: xmenu [-w]\n");
exit(1);
}
exit(1);
}