Subject: Let exit have an optional argument
From: Tollef Fog Heen <tfheen@debian.org>
Last-updated: 2010-04-04
Index: sash-3.7/cmds.c
===================================================================
--- sash-3.7.orig/cmds.c	2002-07-22 00:28:19.000000000 +0200
+++ sash-3.7/cmds.c	2010-04-04 10:58:51.604971262 +0200
@@ -993,14 +993,18 @@
 void
 do_exit(int argc, const char ** argv)
 {
+	int r = 0;
 	if (getpid() == 1)
 	{
 		fprintf(stderr, "You are the INIT process!\n");
 
 		return;
 	}
-
-	exit(0);
+	if (argc == 2)
+	{
+		r = atoi(argv[1]);
+	}
+	exit(r);
 }
 
 
Index: sash-3.7/sash.c
===================================================================
--- sash-3.7.orig/sash.c	2004-01-14 06:08:03.000000000 +0100
+++ sash-3.7/sash.c	2010-04-04 10:58:51.604971262 +0200
@@ -132,9 +132,9 @@
 	},
 
 	{
-		"exit",		do_exit,	1,	1,
+		"exit",		do_exit,	1,	2,
 		"Exit from sash",
-		""
+		"[exit value]"
 	},
 
 	{
