code: purgatorio

Download patch

ref: 00c219c7d9c2b9f60c2db0e1ba7289b2301209a7
parent: 6b84c3a6548f1c577948763b0a09a7b6e2460e04
author: henesy <devnull@localhost>
date: Mon Mar 25 15:41:47 EDT 2019

make emu start with `sh -l` if no other arguments are provided

--- a/appl/cmd/emuinit.b
+++ b/appl/cmd/emuinit.b
@@ -14,22 +14,25 @@
 init()
 {
 	sys = load Sys Sys->PATH;
+
 	sys->bind("#e", "/env", sys->MREPL|sys->MCREATE);	# if #e not configured, that's fine
 	args := getenv("emuargs");
 	arg = load Arg Arg->PATH;
-	if (arg == nil)
+	if (arg == nil) {
 		sys->fprint(sys->fildes(2), "emuinit: cannot load %s: %r\n", Arg->PATH);
-	else{
+	} else {
 		arg->init(args);
 		while((c := arg->opt()) != 0)
 			case c {
 			'g' or 'c' or 'C' or 'm' or 'p' or 'f' or 'r' or 'd' =>
 				arg->arg();
-	                  }
+			}
 		args = arg->argv();
 	}
+
 	mod: Command;
 	(mod, args) = loadmod(args);
+
 	mod->init(nil, args);
 }
 
@@ -36,10 +39,11 @@
 loadmod(args: list of string): (Command, list of string)
 {
 	path := Command->PATH;
+	
 	if(args != nil)
 		path = hd args;
 	else
-		args = "-l" :: nil;	# add startup option
+		args = "sh" :: "-l" :: nil;	# add startup option
 
 	# try loading the module directly.
 	mod: Command;
@@ -60,6 +64,7 @@
 		sys->fprint(sys->fildes(2), "emuinit: unable to load %s: %s\n", path, err);
 		raise "fail:error";
 	}
+
 	return (mod, "sh" :: "-c" :: "$*" :: args);
 }
 
--- a/appl/cmd/sh/sh.b
+++ b/appl/cmd/sh/sh.b
@@ -152,6 +152,8 @@
 			opts.ctxtflags |= Context.EXECPRINT;
 		'c' =>
 			opts.carg = argm->earg();
+		* =>
+			argm->usage();
 		}
 	}