Index: trunk/appswitch/appswitch/README
===================================================================
--- trunk/appswitch/appswitch/README	(revision 97)
+++ trunk/appswitch/appswitch/README	(revision 99)
@@ -1,4 +1,4 @@
-appswitch 1.0b2 [11 February 2003]
-===============
+appswitch 1.0 [19 February 2003]
+=============
 
 A command-line interface to the Mac OS X process manager.
@@ -73,4 +73,11 @@
 ---------------
 
+1.0   - 19 February 2003
+ - added description of -q delay bug (no workaround)
+1.0b3 - 13 February 2003
+ - display spaces instead of ? characters when unprintable
+ - properly handle very narrow window width with -l
+ - further revised and clarified man page
+ - added -q, -K, -L options
 1.0b2 - 11 February 2003
  - display ? characters for unprintable creator code characters
Index: trunk/appswitch/appswitch/VERSION
===================================================================
--- trunk/appswitch/appswitch/VERSION	(revision 97)
+++ trunk/appswitch/appswitch/VERSION	(revision 99)
@@ -1,1 +1,1 @@
-1.0b2
+1.0b3
Index: trunk/appswitch/appswitch/appswitch.1
===================================================================
--- trunk/appswitch/appswitch/appswitch.1	(revision 97)
+++ trunk/appswitch/appswitch/appswitch.1	(revision 99)
@@ -1,5 +1,5 @@
-.Dd Mon Feb 11 2003               \" DATE 
-.Dt APPSWITCH 1 LOCAL      \" Program name and manual section number 
-.Os appswitch 1.0b2
+.Dd Wed Feb 19 2003      \" DATE 
+.Dt APPSWITCH 1 LOCAL    \" Program name and manual section number 
+.Os appswitch 1.0
 .Sh NAME
 .Nm appswitch
@@ -7,5 +7,5 @@
 .Sh SYNOPSIS
 .Nm appswitch
-.Op Fl sShHkFlP          \" [-sShHkFlP]
+.Op Fl sShHqkKFlLP       \" [-sShHqkKFlLP]
 .Op Fl c Ar creator      \" [-c creator]
 .Op Fl i Ar bundleID     \" [-i bundleID]
@@ -34,5 +34,5 @@
 match method is faster than a match by bundle identifier.
 .It Fl p Ar pid
-Match by process identifier, a positive number.
+Match by process identifier, a positive integer.
 .It Ar path
 Match by bundle path.  For packaged applications, this is the package
@@ -50,13 +50,28 @@
 .Bl -tag -width -indent
 .It Fl s
-Show the application, making the application's windows frontmost. Do
+Show the application, making the application's windows frontmost.  Do
 not switch to the application.
 .It Fl h
 Hide the application's windows.
+.It Fl q
+Quit the application.
 .It Fl k
-Kill (force quit) the application.
+Kill (force quit) the application.  Sends the
+.Dv SIGINT
+signal to the application, which the application may
+ignore.  Equivalent to selecting 
+.Dq Force Quit
+from an application's menu in the Dock for the first time.
+.It Fl K
+Kill (force quit) the application.  Sends the
+.Dv SIGKILL
+signal to the application, which the application may not ignore.
+Equivalent to selecting
+.Dq Force Quit
+from an application's menu in the Dock for the second time.
 .It Fl l
 List applications in a format similar to that of
-.Xr ps 1 . The columns of the listing are as follows:
+.Xr ps 1 .
+The columns of the listing are as follows:
 .Bl -tag -width indent
 .It PSN
@@ -65,5 +80,5 @@
 applications.
 .It PID
-The process identifier, a positive number which uniquely identifies
+The process identifier, a positive integer which uniquely identifies
 native Mac OS X processes, usable with the
 .Fl p
@@ -103,6 +118,14 @@
 characters if the window width cannot be determined.
 .El
+.It Fl L
+List applications in a format similar to that of
+.Xr ps 1 .
+The columns of the listing are as above, but the path field is not
+truncated to the window width, and a bundle identifier is added in
+parentheses after the path, usable with the
+.Fl i
+matching option.
 .It Fl P
-Print the application's process identifier (PID), a positive number
+Print the application's process identifier (PID), a positive integer
 and unique identifier for all applications except Classic
 applications.
@@ -135,5 +158,12 @@
 .Xr sleep 1
 command before it.
-.Sh AUTHORS
+.Pp
+The
+.Fl q
+option is very slow on Mac OS X 10.2.4 and earlier; this is an
+acknowledged bug in AECreateAppleEvent with no known workaround. Chris
+Espinosa from Apple has stated that they plan to fix it in a future
+release.
+.Sh AUTHOR
 .An "Nicholas Riley" Aq appswitch@sabi.net
 .\" .Sh HISTORY           \" Document history if command behaves in a unique manner 
Index: trunk/appswitch/appswitch/appswitch.pbproj/nicholas.pbxuser
===================================================================
--- trunk/appswitch/appswitch/appswitch.pbproj/nicholas.pbxuser	(revision 97)
+++ trunk/appswitch/appswitch/appswitch.pbproj/nicholas.pbxuser	(revision 99)
@@ -14,515 +14,5 @@
 		);
 		perUserDictionary = {
-			PBXPerProjectTemplateStateSaveDate = 66554412;
-			"PBXTemplateGeometry-F5314676015831810DCA290F" = {
-				ContentSize = "{618, 257}";
-				LeftSlideOut = {
-					Collapsed = NO;
-					Frame = "{{0, 23}, {618, 234}}";
-					Split0 = {
-						ActiveTab = 2;
-						ActiveTabName = PBXBuildResultsModule;
-						Collapsed = YES;
-						Frame = "{{0, 0}, {618, 234}}";
-						Split0 = {
-							Frame = "{{1e+06, 1e+06}, {618, 0}}";
-						};
-						SplitCount = 1;
-						Tab0 = {
-							Frame = "{{0, 0}, {952, 321}}";
-						};
-						Tab1 = {
-							Debugger = {
-								Collapsed = NO;
-								Frame = "{{0, 0}, {781, 452}}";
-								Split0 = {
-									Frame = "{{0, 24}, {781, 428}}";
-									Split0 = {
-										Frame = "{{0, 0}, {383, 428}}";
-									};
-									Split1 = {
-										DebugVariablesTableConfiguration = (
-											Name,
-											123,
-											Value,
-											85,
-											Summary,
-											155.123,
-										);
-										Frame = "{{392, 0}, {389, 428}}";
-									};
-									SplitCount = 2;
-								};
-								SplitCount = 1;
-								Tab0 = {
-									Frame = "{{0, 0}, {100, 50}}";
-								};
-								Tab1 = {
-									Frame = "{{0, 0}, {100, 50}}";
-								};
-								TabCount = 2;
-								TabsVisible = YES;
-							};
-							Frame = "{{0, 0}, {781, 452}}";
-							LauncherConfigVersion = 7;
-						};
-						Tab2 = {
-							Frame = "{{0, 0}, {618, 228}}";
-							LauncherConfigVersion = 3;
-							Runner = {
-								Frame = "{{0, 0}, {618, 228}}";
-							};
-						};
-						Tab3 = {
-							BuildMessageFrame = "{{0, 0}, {620, 195}}";
-							BuildTranscriptFrame = "{{0, 204}, {620, 2}}";
-							BuildTranscriptFrameExpanded = YES;
-							Frame = "{{0, 0}, {618, 228}}";
-						};
-						Tab4 = {
-							Frame = "{{0, 0}, {612, 295}}";
-						};
-						TabCount = 5;
-						TabsVisible = NO;
-					};
-					SplitCount = 1;
-					Tab0 = {
-						Frame = "{{0, 0}, {300, 533}}";
-						GroupTreeTableConfiguration = (
-							TargetStatusColumn,
-							18,
-							MainColumn,
-							267,
-						);
-					};
-					Tab1 = {
-						ClassesFrame = "{{0, 0}, {280, 398}}";
-						ClassesTreeTableConfiguration = (
-							PBXBookColumnIdentifier,
-							20,
-							PBXClassColumnIdentifier,
-							237,
-						);
-						Frame = "{{0, 0}, {278, 659}}";
-						MembersFrame = "{{0, 407}, {280, 252}}";
-						MembersTreeTableConfiguration = (
-							PBXBookColumnIdentifier,
-							20,
-							PBXMethodColumnIdentifier,
-							236,
-						);
-					};
-					Tab2 = {
-						Frame = "{{0, 0}, {200, 100}}";
-					};
-					Tab3 = {
-						Frame = "{{0, 0}, {200, 100}}";
-						TargetTableConfiguration = (
-							ActiveObject,
-							16,
-							ObjectNames,
-							202.296,
-						);
-					};
-					Tab4 = {
-						BreakpointsTreeTableConfiguration = (
-							breakpointColumn,
-							197,
-							enabledColumn,
-							31,
-						);
-						Frame = "{{0, 0}, {250, 100}}";
-					};
-					TabCount = 5;
-					TabsVisible = NO;
-				};
-				NavBarShownByDefault = YES;
-				StatusViewVisible = YES;
-				Template = F5314676015831810DCA290F;
-				ToolbarVisible = YES;
-				WindowLocation = "{819, 244}";
-			};
-			"PBXTemplateGeometry-F5534CB2020F3F8A0DCA290F" = {
-				ContentSize = "{594, 303}";
-				LeftSlideOut = {
-					Collapsed = NO;
-					Frame = "{{0, 23}, {594, 280}}";
-					Split0 = {
-						ActiveTab = 1;
-						ActiveTabName = PBXRunSessionModule;
-						Collapsed = YES;
-						Frame = "{{0, 0}, {594, 280}}";
-						Split0 = {
-							Frame = "{{1e+06, 1e+06}, {594, 0}}";
-						};
-						SplitCount = 1;
-						Tab0 = {
-							Frame = "{{0, 0}, {804, 321}}";
-						};
-						Tab1 = {
-							Debugger = {
-								Collapsed = NO;
-								Frame = "{{0, 0}, {594, 274}}";
-								Split0 = {
-									Frame = "{{0, 24}, {594, 250}}";
-									Split0 = {
-										Frame = "{{0, 0}, {290, 250}}";
-									};
-									Split1 = {
-										DebugVariablesTableConfiguration = (
-											Name,
-											123,
-											Value,
-											85,
-											Summary,
-											62.123,
-										);
-										Frame = "{{299, 0}, {295, 250}}";
-									};
-									SplitCount = 2;
-								};
-								SplitCount = 1;
-								Tab0 = {
-									Frame = "{{0, 0}, {100, 50}}";
-								};
-								Tab1 = {
-									Frame = "{{0, 0}, {100, 50}}";
-								};
-								TabCount = 2;
-								TabsVisible = YES;
-							};
-							Frame = "{{0, 0}, {594, 274}}";
-							LauncherConfigVersion = 7;
-						};
-						Tab2 = {
-							Frame = "{{0, 0}, {594, 274}}";
-							LauncherConfigVersion = 3;
-							Runner = {
-								Frame = "{{0, 0}, {594, 274}}";
-							};
-						};
-						Tab3 = {
-							BuildMessageFrame = "{{0, 0}, {614, 262}}";
-							BuildTranscriptFrame = "{{0, 271}, {614, 2}}";
-							BuildTranscriptFrameExpanded = YES;
-							Frame = "{{0, 0}, {612, 295}}";
-						};
-						Tab4 = {
-							Frame = "{{0, 0}, {612, 295}}";
-						};
-						TabCount = 5;
-						TabsVisible = NO;
-					};
-					SplitCount = 1;
-					Tab0 = {
-						Frame = "{{0, 0}, {300, 533}}";
-						GroupTreeTableConfiguration = (
-							TargetStatusColumn,
-							18,
-							MainColumn,
-							267,
-						);
-					};
-					Tab1 = {
-						ClassesFrame = "{{0, 0}, {280, 398}}";
-						ClassesTreeTableConfiguration = (
-							PBXBookColumnIdentifier,
-							20,
-							PBXClassColumnIdentifier,
-							237,
-						);
-						Frame = "{{0, 0}, {278, 659}}";
-						MembersFrame = "{{0, 407}, {280, 252}}";
-						MembersTreeTableConfiguration = (
-							PBXBookColumnIdentifier,
-							20,
-							PBXMethodColumnIdentifier,
-							236,
-						);
-					};
-					Tab2 = {
-						Frame = "{{0, 0}, {200, 100}}";
-					};
-					Tab3 = {
-						Frame = "{{0, 0}, {200, 386}}";
-						TargetTableConfiguration = (
-							ActiveObject,
-							16,
-							ObjectNames,
-							202.296,
-						);
-					};
-					Tab4 = {
-						BreakpointsTreeTableConfiguration = (
-							breakpointColumn,
-							197,
-							enabledColumn,
-							31,
-						);
-						Frame = "{{0, 0}, {250, 386}}";
-					};
-					TabCount = 5;
-					TabsVisible = NO;
-				};
-				NavBarShownByDefault = YES;
-				StatusViewVisible = YES;
-				Template = F5534CB2020F3F8A0DCA290F;
-				ToolbarVisible = YES;
-				WindowLocation = "{72, 222}";
-			};
-			"PBXTemplateGeometry-F5CA7ECB015C094F0DCA290F" = {
-				ContentSize = "{796, 742}";
-				LeftSlideOut = {
-					Collapsed = NO;
-					Frame = "{{0, 0}, {796, 742}}";
-					Split0 = {
-						Collapsed = NO;
-						Frame = "{{0, 0}, {796, 742}}";
-						Split0 = {
-							Frame = "{{0, 0}, {796, 742}}";
-						};
-						SplitCount = 1;
-						Tab0 = {
-							Frame = "{{0, 0}, {484, 208}}";
-						};
-						Tab1 = {
-							Debugger = {
-								Collapsed = NO;
-								Frame = "{{0, 0}, {664, 208}}";
-								Split0 = {
-									Frame = "{{0, 24}, {664, 184}}";
-									Split0 = {
-										Frame = "{{0, 0}, {325, 184}}";
-									};
-									Split1 = {
-										DebugVariablesTableConfiguration = (
-											Name,
-											123,
-											Value,
-											85,
-											Summary,
-											96.123,
-										);
-										Frame = "{{334, 0}, {330, 184}}";
-									};
-									SplitCount = 2;
-								};
-								SplitCount = 1;
-								Tab0 = {
-									Frame = "{{0, 0}, {100, 50}}";
-								};
-								Tab1 = {
-									Frame = "{{0, 0}, {100, 50}}";
-								};
-								TabCount = 2;
-								TabsVisible = YES;
-							};
-							Frame = "{{0, 0}, {664, 208}}";
-							LauncherConfigVersion = 7;
-						};
-						Tab2 = {
-							Frame = "{{0, 0}, {664, 50}}";
-							LauncherConfigVersion = 3;
-							Runner = {
-								Frame = "{{0, 0}, {664, 50}}";
-							};
-						};
-						Tab3 = {
-							BuildMessageFrame = "{{0, 0}, {614, 262}}";
-							BuildTranscriptFrame = "{{0, 271}, {614, 2}}";
-							BuildTranscriptFrameExpanded = YES;
-							Frame = "{{0, 0}, {612, 295}}";
-						};
-						Tab4 = {
-							Frame = "{{0, 0}, {612, 295}}";
-						};
-						TabCount = 5;
-						TabsVisible = NO;
-					};
-					SplitCount = 1;
-					Tab0 = {
-						Frame = "{{0, 0}, {313, 531}}";
-						GroupTreeTableConfiguration = (
-							TargetStatusColumn,
-							18,
-							MainColumn,
-							280,
-						);
-					};
-					Tab1 = {
-						ClassesFrame = "{{0, 0}, {280, 398}}";
-						ClassesTreeTableConfiguration = (
-							PBXBookColumnIdentifier,
-							20,
-							PBXClassColumnIdentifier,
-							237,
-						);
-						Frame = "{{0, 0}, {278, 659}}";
-						MembersFrame = "{{0, 407}, {280, 252}}";
-						MembersTreeTableConfiguration = (
-							PBXBookColumnIdentifier,
-							20,
-							PBXMethodColumnIdentifier,
-							236,
-						);
-					};
-					Tab2 = {
-						Frame = "{{0, 0}, {200, 100}}";
-					};
-					Tab3 = {
-						Frame = "{{0, 0}, {200, 557}}";
-						TargetTableConfiguration = (
-							ActiveObject,
-							16,
-							ObjectNames,
-							202.296,
-						);
-					};
-					Tab4 = {
-						BreakpointsTreeTableConfiguration = (
-							breakpointColumn,
-							197,
-							enabledColumn,
-							31,
-						);
-						Frame = "{{0, 0}, {250, 100}}";
-					};
-					TabCount = 5;
-					TabsVisible = NO;
-				};
-				NavBarShownByDefault = YES;
-				StatusViewVisible = NO;
-				Template = F5CA7ECB015C094F0DCA290F;
-				ToolbarVisible = NO;
-				WindowLocation = "{687, 68}";
-			};
-			"PBXTemplateGeometry-F5E465990156DFB90DCA290F" = {
-				ContentSize = "{352, 553}";
-				LeftSlideOut = {
-					ActiveTab = 0;
-					ActiveTabName = PBXGroupTreeModule;
-					Collapsed = YES;
-					Frame = "{{0, 23}, {352, 530}}";
-					Split0 = {
-						Collapsed = NO;
-						Frame = "{{1e+06, 1e+06}, {0, 530}}";
-						Split0 = {
-							Frame = "{{0, 0}, {0, 530}}";
-						};
-						SplitCount = 1;
-						Tab0 = {
-							Frame = "{{0, 0}, {484, 208}}";
-						};
-						Tab1 = {
-							Debugger = {
-								Collapsed = NO;
-								Frame = "{{0, 0}, {664, 208}}";
-								Split0 = {
-									Frame = "{{0, 24}, {664, 184}}";
-									Split0 = {
-										Frame = "{{0, 0}, {325, 184}}";
-									};
-									Split1 = {
-										DebugVariablesTableConfiguration = (
-											Name,
-											123,
-											Value,
-											85,
-											Summary,
-											96.123,
-										);
-										Frame = "{{334, 0}, {330, 184}}";
-									};
-									SplitCount = 2;
-								};
-								SplitCount = 1;
-								Tab0 = {
-									Frame = "{{0, 0}, {100, 50}}";
-								};
-								Tab1 = {
-									Frame = "{{0, 0}, {100, 50}}";
-								};
-								TabCount = 2;
-								TabsVisible = YES;
-							};
-							Frame = "{{0, 0}, {664, 208}}";
-							LauncherConfigVersion = 7;
-						};
-						Tab2 = {
-							Frame = "{{0, 0}, {664, 50}}";
-							LauncherConfigVersion = 3;
-							Runner = {
-								Frame = "{{0, 0}, {664, 50}}";
-							};
-						};
-						Tab3 = {
-							BuildMessageFrame = "{{0, 0}, {614, 262}}";
-							BuildTranscriptFrame = "{{0, 271}, {614, 2}}";
-							BuildTranscriptFrameExpanded = YES;
-							Frame = "{{0, 0}, {612, 295}}";
-						};
-						Tab4 = {
-							Frame = "{{0, 0}, {612, 295}}";
-						};
-						TabCount = 5;
-						TabsVisible = NO;
-					};
-					SplitCount = 1;
-					Tab0 = {
-						Frame = "{{0, 0}, {328, 530}}";
-						GroupTreeTableConfiguration = (
-							TargetStatusColumn,
-							18,
-							MainColumn,
-							295,
-						);
-					};
-					Tab1 = {
-						ClassesFrame = "{{0, 0}, {343, 348}}";
-						ClassesTreeTableConfiguration = (
-							PBXBookColumnIdentifier,
-							20,
-							PBXClassColumnIdentifier,
-							300,
-						);
-						Frame = "{{0, 0}, {341, 578}}";
-						MembersFrame = "{{0, 357}, {343, 221}}";
-						MembersTreeTableConfiguration = (
-							PBXBookColumnIdentifier,
-							20,
-							PBXMethodColumnIdentifier,
-							299,
-						);
-					};
-					Tab2 = {
-						Frame = "{{0, 0}, {319, 576}}";
-					};
-					Tab3 = {
-						Frame = "{{0, 0}, {341, 578}}";
-						TargetTableConfiguration = (
-							ActiveObject,
-							16,
-							ObjectNames,
-							308.296,
-						);
-					};
-					Tab4 = {
-						BreakpointsTreeTableConfiguration = (
-							breakpointColumn,
-							266,
-							enabledColumn,
-							31,
-						);
-						Frame = "{{0, 0}, {319, 576}}";
-					};
-					TabCount = 5;
-					TabsVisible = YES;
-				};
-				NavBarShownByDefault = YES;
-				StatusViewVisible = YES;
-				Template = F5E465990156DFB90DCA290F;
-				ToolbarVisible = YES;
-				WindowLocation = "{19, 217}";
-			};
+			PBXPerProjectTemplateStateSaveDate = 67398120;
 			PBXWorkspaceContents = (
 				{
@@ -531,5 +21,5 @@
 							Split0 = {
 								NavContent0 = {
-									bookmark = E16C83ED03F83AD700050002;
+									bookmark = E1098C8203FDAAC300050002;
 									history = (
 										E16C83D103F83AD700050002,
@@ -544,9 +34,13 @@
 										E16C83DA03F83AD700050002,
 										E16C83DB03F83AD700050002,
-										E16C83DC03F83AD700050002,
 										E16C83DD03F83AD700050002,
 										E16C83DE03F83AD700050002,
 										E16C83DF03F83AD700050002,
-										E16C83E003F83AD700050002,
+										E16C840303FB5E7100050002,
+										E16C842A03FB74A500050002,
+										E132404B03FD7BD400050002,
+									);
+									nextStack = (
+										E16C842C03FB74A500050002,
 									);
 									prevStack = (
@@ -761,5 +255,5 @@
 					Template = 64ABBB4501FA494900185B06;
 					ToolbarVisible = YES;
-					WindowLocation = "{21, 114}";
+					WindowLocation = "{4, 111}";
 				},
 				{
@@ -892,7 +386,9 @@
 				},
 			);
-			PBXWorkspaceStateSaveDate = 66554412;
+			PBXWorkspaceStateSaveDate = 67398120;
 		};
 		perUserProjectItems = {
+			E1098C8203FDAAC300050002 = E1098C8203FDAAC300050002;
+			E132404B03FD7BD400050002 = E132404B03FD7BD400050002;
 			E16C83D103F83AD700050002 = E16C83D103F83AD700050002;
 			E16C83D203F83AD700050002 = E16C83D203F83AD700050002;
@@ -906,9 +402,7 @@
 			E16C83DA03F83AD700050002 = E16C83DA03F83AD700050002;
 			E16C83DB03F83AD700050002 = E16C83DB03F83AD700050002;
-			E16C83DC03F83AD700050002 = E16C83DC03F83AD700050002;
 			E16C83DD03F83AD700050002 = E16C83DD03F83AD700050002;
 			E16C83DE03F83AD700050002 = E16C83DE03F83AD700050002;
 			E16C83DF03F83AD700050002 = E16C83DF03F83AD700050002;
-			E16C83E003F83AD700050002 = E16C83E003F83AD700050002;
 			E16C83E103F83AD700050002 = E16C83E103F83AD700050002;
 			E16C83E203F83AD700050002 = E16C83E203F83AD700050002;
@@ -923,5 +417,7 @@
 			E16C83EB03F83AD700050002 = E16C83EB03F83AD700050002;
 			E16C83EC03F83AD700050002 = E16C83EC03F83AD700050002;
-			E16C83ED03F83AD700050002 = E16C83ED03F83AD700050002;
+			E16C840303FB5E7100050002 = E16C840303FB5E7100050002;
+			E16C842A03FB74A500050002 = E16C842A03FB74A500050002;
+			E16C842C03FB74A500050002 = E16C842C03FB74A500050002;
 		};
 		projectwideBuildSettings = {
@@ -936,4 +432,24 @@
 		);
 	};
+	E1098C8203FDAAC300050002 = {
+		fRef = 08FB7796FE84155DC02AAC07;
+		isa = PBXTextBookmark;
+		name = "main.c: matchApplication";
+		rLen = 0;
+		rLoc = 11680;
+		rType = 0;
+		vrLen = 1813;
+		vrLoc = 10964;
+	};
+	E132404B03FD7BD400050002 = {
+		fRef = 08FB7796FE84155DC02AAC07;
+		isa = PBXTextBookmark;
+		name = "main.c: matchApplication";
+		rLen = 0;
+		rLoc = 11680;
+		rType = 0;
+		vrLen = 1716;
+		vrLoc = 11138;
+	};
 	E16C83D103F83AD700050002 = {
 		fRef = E16C83EF03F83AD700050002;
@@ -1046,14 +562,4 @@
 		vrLoc = 0;
 	};
-	E16C83DC03F83AD700050002 = {
-		fRef = E1A0BD3203EFAD9E00050001;
-		isa = PBXTextBookmark;
-		name = "CPS.h: 281";
-		rLen = 0;
-		rLoc = 4865;
-		rType = 0;
-		vrLen = 1136;
-		vrLoc = 4090;
-	};
 	E16C83DD03F83AD700050002 = {
 		fRef = E16C83EE03F83AD700050002;
@@ -1086,14 +592,4 @@
 		vrLoc = 2592;
 	};
-	E16C83E003F83AD700050002 = {
-		fRef = 08FB7796FE84155DC02AAC07;
-		isa = PBXTextBookmark;
-		name = "main.c: 117";
-		rLen = 0;
-		rLoc = 4782;
-		rType = 0;
-		vrLen = 1813;
-		vrLoc = 0;
-	};
 	E16C83E103F83AD700050002 = {
 		fRef = E1A0BD3203EFAD9E00050001;
@@ -1131,5 +627,5 @@
 		name = "main.c: main";
 		rLen = 0;
-		rLoc = 12674;
+		rLoc = 16052;
 		rType = 0;
 		vrLen = 1650;
@@ -1151,5 +647,5 @@
 		name = "main.c: matchApplication";
 		rLen = 0;
-		rLoc = 10201;
+		rLoc = 12708;
 		rType = 0;
 		vrLen = 1426;
@@ -1161,5 +657,5 @@
 		name = "main.c: 51";
 		rLen = 0;
-		rLoc = 2325;
+		rLoc = 2379;
 		rType = 0;
 		vrLen = 801;
@@ -1191,5 +687,5 @@
 		name = "main.c: 117";
 		rLen = 0;
-		rLoc = 4782;
+		rLoc = 5052;
 		rType = 0;
 		vrLen = 1813;
@@ -1216,14 +712,4 @@
 		vrLoc = 2592;
 	};
-	E16C83ED03F83AD700050002 = {
-		fRef = 08FB7796FE84155DC02AAC07;
-		isa = PBXTextBookmark;
-		name = "main.c: 18";
-		rLen = 0;
-		rLoc = 1589;
-		rType = 0;
-		vrLen = 1813;
-		vrLoc = 0;
-	};
 	E16C83EE03F83AD700050002 = {
 		isa = PBXFileReference;
@@ -1296,4 +782,46 @@
 		name = NSFileManager.h;
 		path = /System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSFileManager.h;
+		refType = 0;
+	};
+	E16C840303FB5E7100050002 = {
+		fRef = E1A0BD3203EFAD9E00050001;
+		isa = PBXTextBookmark;
+		name = "CPS.h: 156";
+		rLen = 13;
+		rLoc = 2465;
+		rType = 0;
+		vrLen = 622;
+		vrLoc = 2176;
+	};
+	E16C842A03FB74A500050002 = {
+		fRef = E16C842F03FB74A500050002;
+		isa = PBXTextBookmark;
+		name = "CFString.h: 252";
+		rLen = 142;
+		rLoc = 12196;
+		rType = 0;
+		vrLen = 2097;
+		vrLoc = 10692;
+	};
+	E16C842C03FB74A500050002 = {
+		fRef = E16C842E03FB74A500050002;
+		isa = PBXTextBookmark;
+		name = "CFString.h: 252";
+		rLen = 142;
+		rLoc = 12196;
+		rType = 0;
+		vrLen = 2097;
+		vrLoc = 10692;
+	};
+	E16C842E03FB74A500050002 = {
+		isa = PBXFileReference;
+		name = CFString.h;
+		path = /System/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/CFString.h;
+		refType = 0;
+	};
+	E16C842F03FB74A500050002 = {
+		isa = PBXFileReference;
+		name = CFString.h;
+		path = /System/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/CFString.h;
 		refType = 0;
 	};
Index: trunk/appswitch/appswitch/main.c
===================================================================
--- trunk/appswitch/appswitch/main.c	(revision 97)
+++ trunk/appswitch/appswitch/main.c	(revision 99)
@@ -24,5 +24,5 @@
 const char *APP_NAME;
 
-#define VERSION "1.0b2"
+#define VERSION "1.0"
 
 struct {
@@ -36,6 +36,7 @@
     } matchType;
     enum {
-        APP_NONE, APP_SWITCH, APP_SHOW, APP_HIDE, APP_KILL, APP_LIST, APP_PRINT_PID
+        APP_NONE, APP_SWITCH, APP_SHOW, APP_HIDE, APP_QUIT, APP_KILL, APP_KILL_HARD, APP_LIST, APP_PRINT_PID
     } appAction;
+    Boolean longList;
     enum {
         ACTION_NONE, ACTION_SHOW_ALL, ACTION_HIDE_OTHERS
@@ -46,5 +47,5 @@
 } OPTS =
 {
-    kLSUnknownCreator, NULL, NULL, -1, NULL, MATCH_UNKNOWN, APP_NONE, ACTION_NONE, FINAL_NONE
+    kLSUnknownCreator, NULL, NULL, -1, NULL, MATCH_UNKNOWN, APP_NONE, ACTION_NONE, FINAL_NONE, false
 };
 
@@ -70,6 +71,9 @@
             "  -h            hide application\n"
             "  -H            hide other applications\n"
-            "  -k            kill application\n"
+            "  -q            quit application\n"
+            "  -k            kill application (SIGINT)\n"
+            "  -K            kill application hard (SIGKILL)\n"
             "  -l            list applications\n"
+            "  -L            list applications including full paths and bundle identifiers\n"
             "  -P            print application process ID\n"
             "  -F            bring current application's windows to front\n"
@@ -132,5 +136,5 @@
     if (argc == 1) usage();
 
-    const char *opts = "c:i:p:a:sShHklPF";
+    const char *opts = "c:i:p:a:sShHqkKlLPF";
 
     while ( (ch = getopt(argc, argv, opts)) != -1) {
@@ -159,21 +163,34 @@
                 break;
             case 's':
-                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -k, -l, -P options");
+                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -L, -P options");
                 OPTS.appAction = APP_SHOW;
                 break;
             case 'h':
-                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -k, -l, -P options");
+                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -L, -P options");
                 OPTS.appAction = APP_HIDE;
                 break;
+            case 'q':
+                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -L, -P options");
+                OPTS.appAction = APP_QUIT;
+                break;
             case 'k':
-                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -k, -l, -P options");
+                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -L, -P options");
                 OPTS.appAction = APP_KILL;
                 break;
+            case 'K':
+                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -L, -P options");
+                OPTS.appAction = APP_KILL_HARD;
+                break;
             case 'l':
-                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -k, -l, -P options");
+                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -L, -P options");
                 OPTS.appAction = APP_LIST;
                 break;
+            case 'L':
+                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -L, -P options");
+                OPTS.appAction = APP_LIST;
+                OPTS.longList = true;
+                break;
             case 'P':
-                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -k, -l, -P options");
+                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -P options");
                 OPTS.appAction = APP_PRINT_PID;
                 break;
@@ -227,4 +244,42 @@
 }
 
+Boolean bundleIdentifierForApplication(CFStringRef *bundleID, char *path) {
+    CFURLRef url = CFURLCreateFromFileSystemRepresentation(NULL, path, strlen(path), false);
+    if (url == NULL) return false;
+    CFBundleRef bundle = CFBundleCreate(NULL, url);
+    if (bundle != NULL) {
+        *bundleID = CFBundleGetIdentifier(bundle);
+#if DEBUG
+        CFShow(*bundleID);
+#endif
+    }
+    CFRelease(url);
+    return true;
+}
+
+OSStatus quitApplication(CPSProcessSerNum *psn) {
+    AppleEvent event;
+    AEAddressDesc appDesc;
+    OSStatus err;
+
+    AEInitializeDesc(&appDesc);
+    err = AECreateDesc(typeProcessSerialNumber, psn, sizeof(*psn), &appDesc);
+    if (err != noErr) return err;
+
+    // XXX AECreateAppleEvent is very slow in Mac OS X 10.2.4 and earlier.
+    // XXX This is Apple's bug: <http://lists.apple.com/archives/applescript-implementors/2003/Feb/19/aecreateappleeventfromco.txt>
+    err = AECreateAppleEvent(kCoreEventClass, kAEQuitApplication, &appDesc, kAutoGenerateReturnID, kAnyTransactionID, &event);
+    if (err != noErr) return err;
+
+    AppleEvent nullReply = {typeNull, nil};
+    err = AESendMessage(&event, &nullReply, kAENoReply, kNoTimeOut);
+    (void)AEDisposeDesc(&event);
+    if (err != noErr) return err;
+
+    (void)AEDisposeDesc(&nullReply); // according to docs, don't call unless AESend returned successfully
+
+    return noErr;
+}
+
 CPSProcessSerNum matchApplication(CPSProcessInfoRec *info) {
     long pathMaxLength = pathconf("/", _PC_PATH_MAX);
@@ -249,11 +304,20 @@
         char *banner = "       PSN   PID TYPE CREA NAME                ";
                      // 12345678.0 12345 1234 1234 12345678901234567890
-        printf("%s PATH\n", banner);
         if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) != -1 ||
              ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) != -1 ||
              ioctl(STDIN_FILENO,  TIOCGWINSZ, (char *)&ws) != -1) ||
             ws.ws_col != 0) termwidth = ws.ws_col;
+        char *formatButPath = "%8ld.%ld %5ld %c%c%c%c %c%c%c%c %-20.20s";
         int pathlen = termwidth - strlen(banner) - 1;
-        asprintf(&format, "%%8ld.%%ld %%5ld %%c%%c%%c%%c %%c%%c%%c%%c %%-20.20s %%-%d.%ds\n", pathlen, pathlen);
+        // XXX don't ever free 'format', should fix if we get called repeatedly
+        if (OPTS.longList) {
+            printf("%s PATH (bundle identifier)\n", banner);
+            asprintf(&format, "%s %%s", formatButPath);
+        } else if (pathlen >= 4) {
+            printf("%s PATH\n", banner);
+            asprintf(&format, "%s %%-%d.%ds", formatButPath, pathlen, pathlen);
+        } else {
+            format = formatButPath;
+        }
     }
     
@@ -279,16 +343,9 @@
             case MATCH_BUNDLE_ID:
                {
-                   CFURLRef url = CFURLCreateFromFileSystemRepresentation(NULL, path, strlen(path), false);
-                   if (url == NULL) errexit("can't get bundle location for process '%s' (PSN %ld.%ld, pid %ld)", name, psn.hi, psn.lo, info->UnixPID);
-                   CFBundleRef bundle = CFBundleCreate(NULL, url);
-                   if (bundle != NULL) {
-                       CFStringRef bundleID = CFBundleGetIdentifier(bundle);
-#if DEBUG
-                       CFShow(bundleID);
-#endif
-                       if (bundleID != NULL && CFStringCompare(OPTS.bundleID, bundleID, kCFCompareCaseInsensitive) == kCFCompareEqualTo)
-                           break;
-                   }
-                   CFRelease(url);
+                   CFStringRef bundleID;
+                   if (!bundleIdentifierForApplication(&bundleID, path))
+                       errexit("can't get bundle location for process '%s' (PSN %ld.%ld, pid %ld)", name, psn.hi, psn.lo, info->UnixPID);
+                   if (bundleID != NULL && CFStringCompare(OPTS.bundleID, bundleID, kCFCompareCaseInsensitive) == kCFCompareEqualTo)
+                       break;
                    continue;
                }
@@ -298,9 +355,31 @@
         if (OPTS.appAction == APP_LIST) {
             char *type = (char *)&(info->ExecFileType), *crea = (char *)&(info->ExecFileCreator);
-#define CXX(c) ( (c) < ' ' ? '?' : (c) )
+#define CXX(c) ( (c) < ' ' ? ' ' : (c) )
 #define OSTYPE_CHAR_ARGS(t) CXX(t[0]), CXX(t[1]), CXX(t[2]), CXX(t[3])
             printf(format, psn.hi, psn.lo, info->UnixPID,
 		   OSTYPE_CHAR_ARGS(type), OSTYPE_CHAR_ARGS(crea),
                    name, path);
+            if (OPTS.longList) {
+                CFStringRef bundleID = NULL;
+                if (!bundleIdentifierForApplication(&bundleID, path))
+                    errexit("can't get bundle location for process '%s' (PSN %ld.%ld, pid %ld)", name, psn.hi, psn.lo, info->UnixPID);
+                if (bundleID != NULL) {
+                    char *bundleIDStr = (char *)CFStringGetCStringPtr(bundleID, CFStringGetSystemEncoding());
+                    if (bundleIDStr == NULL) {
+                        CFIndex bundleIDLength = CFStringGetLength(bundleID) + 1;
+                        bundleIDStr = (char *)malloc(bundleIDLength * sizeof(char));
+                        if (!CFStringGetCString(bundleID, bundleIDStr, bundleIDLength, CFStringGetSystemEncoding())) {
+                            CFShow(bundleIDStr);
+                            errexit("internal error: string encoding conversion failed for bundle identifier");
+                        }
+                        printf(" (%s)", bundleIDStr);
+                        free(bundleIDStr);
+                    } else {
+                        printf(" (%s)", bundleIDStr);
+                    }
+                    CFRelease(bundleID);
+                }
+            }
+            putchar('\n');
             continue;
         }
@@ -334,5 +413,7 @@
         case APP_SHOW: err = CPSPostShowReq(&psn); verb = "show"; break;
         case APP_HIDE: err = CPSPostHideReq(&psn); verb = "hide"; break;
+        case APP_QUIT: err = quitApplication(&psn); verb = "quit"; break;
         case APP_KILL: err = CPSPostKillRequest(&psn, kNilOptions); verb = "kill"; break;
+        case APP_KILL_HARD: err = CPSPostKillRequest(&psn, bfCPSKillHard); verb = "kill"; break;
         case APP_PRINT_PID:
             if (info.UnixPID <= 0) errexit("can't get process ID");
