aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2003-06-20 23:32:01 +0800
committerDan Winship <danw@src.gnome.org>2003-06-20 23:32:01 +0800
commite586397c0569f0b5ed6b7764f1d2ff74fc26d9b3 (patch)
treeae8edcad1cf52e1cf49c3672e4638ef83ffc7488
parentc20675d2016a9f52da128d09ca03a46bc679e946 (diff)
downloadgsoc2013-evolution-e586397c0569f0b5ed6b7764f1d2ff74fc26d9b3.tar.gz
gsoc2013-evolution-e586397c0569f0b5ed6b7764f1d2ff74fc26d9b3.tar.zst
gsoc2013-evolution-e586397c0569f0b5ed6b7764f1d2ff74fc26d9b3.zip
clean this up a little and make it deal with "evolution" vs
* tools/killev.c (kill_component): clean this up a little and make it deal with "evolution" vs "evolution-1.4" svn path=/trunk/; revision=21499
-rw-r--r--ChangeLog5
-rw-r--r--tools/killev.c37
2 files changed, 24 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 45dadec25e..6f5db1dfc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-06-19 Dan Winship <danw@ximian.com>
+
+ * tools/killev.c (kill_component): clean this up a little and make
+ it deal with "evolution" vs "evolution-1.4"
+
2003-06-19 Danilo Ĺ egan <dsegan@gmx.net>
* configure.in: Added "sr" and "sr@Latn" to ALL_LINGUAS.
diff --git a/tools/killev.c b/tools/killev.c
index 6904b02243..0c735c0a19 100644
--- a/tools/killev.c
+++ b/tools/killev.c
@@ -84,36 +84,37 @@ kill_process (const char *proc_name, KillevComponent *comp)
return TRUE;
};
+static const char *patterns[] = {
+ "%s", "%.16s", "lt-%s", "lt-%.13s"
+};
+static const int n_patterns = G_N_ELEMENTS (patterns);
+
static gboolean
kill_component (gpointer key, gpointer value, gpointer data)
{
KillevComponent *comp = value;
- char *exe_name;
-
- if (kill_process (comp->location, comp))
- return TRUE;
-
- exe_name = g_strdup_printf ("lt-%s", comp->location);
- if (kill_process (exe_name, comp)) {
- g_free (exe_name);
- return TRUE;
- }
+ char *base_name, *exe_name, *dash;
+ int i;
- if (strlen (exe_name) > 16) {
- exe_name[16] = '\0';
+ base_name = g_strdup (comp->location);
+ try_again:
+ for (i = 0; i < n_patterns; i++) {
+ exe_name = g_strdup_printf (patterns[i], base_name);
if (kill_process (exe_name, comp)) {
- g_free (exe_name);
+ g_free (exe_name);
+ g_free (base_name);
return TRUE;
}
+ g_free (exe_name);
}
- g_free (exe_name);
- if (strlen (comp->location) > 16) {
- exe_name = g_strndup (comp->location, 16);
- kill_process (exe_name, comp);
- g_free (exe_name);
+ dash = strrchr (base_name, '-');
+ if (dash && !strcmp (dash + 1, BASE_VERSION)) {
+ *dash = '\0';
+ goto try_again;
}
+ g_free (base_name);
return TRUE;
}