patch for mb_exec(), comments on 0.5...
Greg Alexander <[email protected]>
| Newsgroups | gmane.comp.handhelds.matchbox |
|---|---|
| Message-ID | <E198Sgc-0002Xx-00@localhost> |
Greetings!
I decided to upgrade to the 0.5 release and I must say I'm pleased.
Building in cross mode was pretty easy (once I got over self-imposed
library issues), and it works great. I have finally begun using the
new versions of mbdock instead of my old fork...and I find it usable,
and very nice looking. But I have to say that as someone who switches
screen orientation on a regular basis, I find that the UI for dealing
with docks wider than the screen is poor. The old UI was much better,
even without movable icons.
Also, a possible bug report...For as long as I've been using matchbox
the support for changing orientation (the "xrandr" command) has always
been sketchy. It always works when I first start up the window
manager, but after it's been running for a few minutes it won't work
anymore, commands like "xrandr -o left" have zero effect. I'm pretty
sure that the window manager is what's dropping it here because I
restarted the window manager without restarting X and it was all
happy... so does anyone have any idea off the top of your head what
the problem would be?
>From the /usr/lib/menu/xrandr file:
command="xrandr -o inverted ; xmodmap /etc/X11/xmodmap-invert"
I wanted this to work, so after some debate, I decided to go ahead and
implement ; in mb_exec()... the alternative being to call /bin/sh,
but I decided I appreciated the existing approach of not using sh..
So here's the patch to support ; and & in libmb/mbutil.c:mb_exec()...
Thanks!!
- Greg
---cut---
--- mbutil.c 2003/04/23 21:40:11 1.1
+++ mbutil.c 2003/04/23 22:10:19
@@ -69,11 +69,40 @@
if (!squote && !dquote)
{
*bufp = 0;
- if (nargs < MAX_ARGS)
+ if (nargs < MAX_ARGS && bufp != buf)
argv[nargs++] = strdup (buf);
bufp = buf;
break;
+ } else {
+ *bufp++ = *p;
}
+ break;
+ case ';':
+ case '&':
+ if (!squote && !dquote)
+ {
+ pid_t child;
+
+ *bufp = 0;
+ if (nargs < MAX_ARGS && bufp != buf)
+ argv[nargs++] = strdup(buf);
+ bufp = buf;
+ argv[nargs] = NULL;
+ if ((child = fork()))
+ {
+ if (*p == ';')
+ waitpid(child, NULL, 0);
+ for (i = 0; i < nargs; i++)
+ free (argv[i]);
+ nargs = 0;
+ } else {
+ execvp (argv[0], argv);
+ exit(rc);
+ }
+ } else {
+ *bufp++ = *p;
+ }
+ break;
default:
*bufp++ = *p;
break;
---cut---