Commits

Marius Eriksen  committed dfcebf0

acme: add $acmeshell to control execution shell

R=rsc
CC=plan9port.codebot
http://codereview.appspot.com/6614056

Committer: Russ Cox <rsc@swtch.com>

  • Participants
  • Parent commits c73dece

Comments (0)

Files changed (4)

File man/man1/acme.1

 set to the window's id number
 (see
 .IR acme (4)).
+.PP
+The environment variable
+.B $acmeshell
+determines which shell is used to execute such commands; the
+.IR rc (1)
+shell is used by default. 
 .SS "Mouse button 3
 Pointing at text with button 3 instructs
 .I acme

File src/cmd/acme/acme.c

 	cputype = getenv("cputype");
 	objtype = getenv("objtype");
 	home = getenv("HOME");
+	acmeshell = getenv("acmeshell");
+	if(acmeshell && *acmeshell == '\0')
+		acmeshell = nil;
 	p = getenv("tabstop");
 	if(p != nil){
 		maxtab = strtoul(p, nil, 0);

File src/cmd/acme/dat.h

 char			*cputype;
 char			*objtype;
 char			*home;
+char			*acmeshell;
 char			*fontnames[2];
 Image		*tagcols[NCOL];
 Image		*textcols[NCOL];

File src/cmd/acme/exec.c

 	char *rcarg[4];
 	void **argv;
 	CFsys *fs;
+	char *shell;
 
 	threadsetname("runproc");
 
 
 	if(argaddr)
 		putenv("acmeaddr", argaddr);
+	if(acmeshell != nil)
+		goto Hard;
 	if(strlen(t) > sizeof buf-10)	/* may need to print into stack */
 		goto Hard;
 	inarg = FALSE;
 		chdir(dir);	/* ignore error: probably app. window */
 		free(dir);
 	}
-	rcarg[0] = "rc";
+	shell = acmeshell;
+	if(shell == nil)
+		shell = "rc";
+	rcarg[0] = shell;
 	rcarg[1] = "-c";
 	rcarg[2] = t;
 	rcarg[3] = nil;
 			sendul(cpid, ret);
 		threadexits(nil);
 	}
-	warning(nil, "exec rc: %r\n");
+	warning(nil, "exec %s: %r\n", shell);
 
    Fail:
 	/* threadexec hasn't happened, so send a zero */