[ekg2-commit] ekg2: ekg.c (HEAD) stuff.c (HEAD) stuff.h (HEAD) vars.c (HEAD) [peres]
CVS commit
cvs w toxygen.net
Wto, 1 Maj 2007, 13:37:09 CEST
Module name: ekg2
Changes by: peres 2007-05-01 13:37:07
Modified files:
ekg.c stuff.c stuff.h vars.c
Log message:
http://lists.ziew.org/mailman/pipermail/ekg2-devel/2007-May/001108.html
exit_exec, allows us to replace ekg2 with some other app on exit. Quite funky
thing, but nice - we don't need to keep any additional processes in memory
to do sth on EKG2's exit.
Index: ekg.c
===================================================================
RCS file: /home/cvs/ekg2/ekg/ekg.c,v
diff -d -u -r1.161 -r1.162
--- ekg.c 3 Apr 2007 16:12:32 -0000 1.161
+++ ekg.c 1 May 2007 11:37:06 -0000 1.162
@@ -1051,6 +1051,7 @@
*/
void ekg_exit()
{
+ char *exit_exec = config_exit_exec;
extern int ekg2_dlclose(void *plugin);
list_t l;
@@ -1154,6 +1155,7 @@
if (session_write())
printf(_("Error while saving.\n"));
}
+ config_exit_exec = NULL; /* avoid freeing it */
/* XXX, think about sequence of unloading. */
@@ -1226,6 +1228,17 @@
WSACleanup();
#endif
close(stderr_backup);
+
+ if (exit_exec) {
+#ifndef NO_POSIX_SYSTEM
+ execl("/bin/sh", "sh", "-c", exit_exec, NULL);
+#else
+ /* XXX, like in cmd_exec() */
+#endif
+ /* should we return some error code if exec() failed?
+ * AKA this line shouldn't be ever reached */
+ }
+
exit(0);
}
Index: stuff.c
===================================================================
RCS file: /home/cvs/ekg2/ekg/stuff.c,v
diff -d -u -r1.185 -r1.186
--- stuff.c 12 Apr 2007 11:05:24 -0000 1.185
+++ stuff.c 1 May 2007 11:37:06 -0000 1.186
@@ -166,6 +166,7 @@
int config_lastlog_case = 0;
int config_lastlog_display_all = 0;
int config_version = 0;
+char *config_exit_exec = NULL;
char *last_search_first_name = NULL;
char *last_search_last_name = NULL;
Index: stuff.h
===================================================================
RCS file: /home/cvs/ekg2/ekg/stuff.h,v
diff -d -u -r1.97 -r1.98
--- stuff.h 12 Apr 2007 11:20:58 -0000 1.97
+++ stuff.h 1 May 2007 11:37:06 -0000 1.98
@@ -233,6 +233,7 @@
extern int config_windows_save;
extern char *config_dcc_dir;
extern int config_version;
+extern char *config_exit_exec;
extern char *home_dir;
extern char *config_dir;
Index: vars.c
===================================================================
RCS file: /home/cvs/ekg2/ekg/vars.c,v
diff -d -u -r1.89 -r1.90
--- vars.c 12 Apr 2007 11:01:20 -0000 1.89
+++ vars.c 1 May 2007 11:37:06 -0000 1.90
@@ -112,6 +112,7 @@
variable_add(NULL, ("display_welcome"), VAR_BOOL, 1, &config_display_welcome, NULL, NULL, NULL);
variable_add(NULL, ("emoticons"), VAR_BOOL, 1, &config_emoticons, NULL, NULL, NULL);
variable_add(NULL, ("events_delay"), VAR_INT, 1, &config_events_delay, NULL, NULL, NULL);
+ variable_add(NULL, ("exit_exec"), VAR_STR, 1, &config_exit_exec, NULL, NULL, NULL);
variable_add(NULL, ("keep_reason"), VAR_INT, 1, &config_keep_reason, NULL, NULL, NULL);
variable_add(NULL, ("last"), VAR_MAP, 1, &config_last, NULL, variable_map(4, 0, 0, "none", 1, 2, "all", 2, 1, "separate", 4, 0, "sent"), NULL);
variable_add(NULL, ("last_size"), VAR_INT, 1, &config_last_size, NULL, NULL, NULL);
Więcej informacji o liście dyskusyjnej ekg2-commit