On Wed 2012.10.31 at 20:40 +0400, Alexander Polakov wrote: > * Kent R. Spillner <[email protected]> [121031 01:20]: > > Howdy- > > > > > > > It seems people do really use that. How about this diff? > > > > > In short: do u_exec("cwm") in conf_reload(). This should probably be > > > > > u_exec(somewhere-argv0-is-saved). > > > > > > > > or use __progname ; also rename from 'reload' to 'restart' > > > > > > I like this approach a lot. Here's an update which also preserves > > > Conf.conf_path and display_name. > > > > void > > -kbfunc_reload(struct client_ctx *cc, union arg *arg) > > +kbfunc_restart(struct client_ctx *cc, union arg *arg) > > { > > - conf_reload(&Conf); > > + char *command, *display_name; > > + size_t command_len; > > + > > + display_name = XDisplayName(NULL); > > + > > + /* Need space for: __progname -c Conf.conf_path -d display_name */ > > + command_len = sizeof(__progname) + 4 + sizeof(Conf.conf_path) + 4 + > > sizeof(display_name) + 1; > > + command = malloc(command_len); > > + > > + snprintf(command, command_len, "%s -c %s -d %s", __progname, > > Conf.conf_path, display_name); > > + u_exec(command); > > } > > This looks really ugly to me. Save argv[] approach below.
heh, i have the same diff but with a different name, that's all :)
