Re: Minor patch to oaf-slay



On Tue, Sep 25, 2001 at 10:29:52AM -0400, Dan Winship wrote:
> 
> But if you do the split first, and then compare $ps_array[1] against
> /^$filep[:blank:]?/, I think it should all work...

I suppose it helps to actually read the rest of the code.  Yes, that
is a better approach.  We don't even need the :blank: in that case
because the split handles it.  A new patch that also handles
    foo-server
is attached.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/oaf/ChangeLog,v
retrieving revision 1.181
diff -u -w -r1.181 ChangeLog
--- ChangeLog	2001/09/12 23:15:51	1.181
+++ ChangeLog	2001/09/25 16:34:12
@@ -1,3 +1,8 @@
+2001-09-25  Jody Goldberg <jgoldberg home com>
+
+	* test/oaf-slay.in : Do not kill processes that just have a server
+	  name somewhere on the command line.  eg vi server/main.c
+
 2001-09-12  Darin Adler  <darin bentspoon com>
 
 	* oafd/ac-corba.c: Add a missing include of config.h.
Index: test/oaf-slay.in
===================================================================
RCS file: /cvs/gnome/oaf/test/oaf-slay.in,v
retrieving revision 1.2
diff -u -w -r1.2 oaf-slay.in
--- test/oaf-slay.in	2001/09/04 03:46:54	1.2
+++ test/oaf-slay.in	2001/09/25 16:34:12
@@ -114,7 +114,7 @@
 
 					# oafd needs to be last.
 					#
-					if ($line ne "oafd") {
+					if ($line ne "oafd" and not($line =~m/^OAFIID:/)) {
 						push @file_process, $line;
 					}
 				} #end while(<FILE>)
@@ -129,18 +129,16 @@
 
 	foreach $filep (@file_process) {
 
-		if (not($filep =~m/^OAFIID:/)) {
-
 			# Search through @ps_result and look for matches
 			#
 			foreach $el (@ps_result) {
 				chomp $el;
-				if ($el =~m/$filep/ ) {
-					@ps_array = split(' ', $el);
+			@ps_array = split(' ', $el, 3);
+
+			if ($ps_array[1] =~m/(\A|\/)$filep$/ ) {
 					$list_array[$index]=$ps_array[0]."\t".$ps_array[1]."\n";
 					$process_pids[$index]=$ps_array[0]."\n";
 					$index++;
-					}
 				}
 			}
 		}




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]