Introduction
Introduction Statistics Contact Development Disclaimer Help
Use SHELL to find a shell. - sam - An updated version of the sam text editor.
git clone git://vernunftzentrum.de/sam.git
Log
Files
Refs
LICENSE
---
commit 107d59adec9936d63ab3ca7e508911343473f6da
parent 078d234601dbb4122149ad46dbd9b2cf5c67a938
Author: Rob King <[email protected]>
Date: Fri, 23 Sep 2016 09:26:55 -0500
Use SHELL to find a shell.
Credit for this patch goes to Tommy Pettersson.
Diffstat:
sam/sam.c | 5 +++++
sam/sam.h | 2 ++
sam/shell.c | 3 ++-
3 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/sam/sam.c b/sam/sam.c
@@ -1,6 +1,7 @@
/* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
#include "sam.h"
+#include <libgen.h>
#include <stdbool.h>
#include <unistd.h>
@@ -31,6 +32,8 @@ int bpipeok;
int termlocked;
char *samterm = "samterm";
char *rsamname = "rsam";
+char *sh = "sh";
+char *shpath = "/bin/sh";
Rune baddir[] = { '<', 'b', 'a', 'd', 'd', 'i', 'r', '>', '\n'};
@@ -99,6 +102,8 @@ main(int argc, char *argv[])
home = getenv("HOME");
if(home == 0)
home = "/";
+ shpath = getenv("SHELL") ? getenv("SHELL") : shpath;
+ sh = basename(shpath);
if(!dflag)
startup(machine, Rflag, arg, ap);
Fstart();
diff --git a/sam/sam.h b/sam/sam.h
@@ -346,6 +346,8 @@ extern Rune *right[];
extern char *rsamname; /* globals */
extern char *samterm;
+extern char *sh;
+extern char *shpath;
extern Rune genbuf[];
extern char *genc;
extern int io;
diff --git a/sam/shell.c b/sam/shell.c
@@ -95,7 +95,8 @@ plan9(File *f, int type, String *s, int nest)
close(0); /* so it won't read from terminal */
open("/dev/null", 0);
}
- exit(system(Strtoc(&plan9cmd)));
+ execl(shpath, sh, "-c", Strtoc(&plan9cmd), NULL);
+ exits("exec");
}
if(pid == -1)
error(Efork);
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.