ARG_MAX
| Shells
| portability
| permissions
| UUOC
| ancient
| -
| ../Various
| HOME
$() vs )
| IFS
| using siginfo
| nanosleep
| line charset
| locale
The following was released under the licenses of BSD and Caldera.
Here are extracts from the 3BSD (03/'80) variant of the Bourne shell, usr/src/cmd/sh/service.c.
See also the corresponding code in csh in 2BSD (05/'79).
LOCAL STRING execs(ap,t)
STRING ap;
REG STRING t[];
{
[...]
execve(p, &t[0] ,xecenv);
SWITCH errno IN
case ENOEXEC:
[...]
/* band aid to get csh... 2/26/79 */
{
char c;
if (!isatty(input)) {
read(input, &c, 1);
if (c == '#')
gocsh(t, xecenv);
lseek(input, (long) 0, 0);
}
}
[...]
}
gocsh(t, xecenv)
register char **t, **xecenv;
{
char **newt[1000];
register char **p;
register int i;
for (i = 0; t[i]; i++)
newt[i+1] = t[i];
newt[i+1] = 0;
newt[0] = "/bin/csh";
execve("/bin/csh", newt, xecenv);
}