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 csh source code in 2BSD (05/'79).
See also the corresponding code in the 3BSD (03/'80) sh.
READ_ME:
Thu Apr 19 12:17:29 PST 1979 [...] For the shell to coexist with another shell you can define OTHERSH in sh.local.h as, e.g. "/bin/sh". If a file which purports to be a shell script doesn't start with a `#' this other shell interprets it. If necessary a longer string than just `#' could easily be used. If OTHERSH is not defined then this hack doesn't occur. For full sanity complementary code should be placed in OTHERSH! Look at sh.local.h for other things which you may need/want to change.
sh.local.h:
/* Copyright (c) 1979 Regents of the University of California */ /* * This file defines certain local parameters * A symbol should be defined in Makefile for conditional * compilation, e.g. CORY for U.C.B. Cory Hall 11/70 and * tested here and elsewhere. */ [...] #define SHELLPATH "/bin/csh" #define OTHERSH "/bin/sh" [...]
sh.exec.c:
/* Copyright (c) 1979 Regents of the University of California */ #include "sh.h" /* * C shell */ [...] /* Last resort shell */ char *lastsh[] = { SHELLPATH, 0 }; /* * Execute command f, arg list t. * Record error message if not found. * Also do shell scripts here. */ texec(f, t) char *f; register char **t; { register struct varent *v; register char **vp; extern char *sys_errlist[]; execv(f, t); switch (errno) { case ENOEXEC: /* * If there is an alias for shell, then * put the words of the alias in front of the * argument list replacing the command name. * Note no interpretation of the words at this point. */ v = adrof1("shell", &aliases); if (v == 0) { #ifdef OTHERSH register int ff = open(f, 0); char ch; #endif vp = lastsh; vp[0] = adrof("shell") ? value("shell") : SHELLPATH; #ifdef OTHERSH if (ff != -1 && read(ff, &ch, 1) == 1 && ch != '#') vp[0] = OTHERSH; close(ff); #endif } else vp = v->vec; t[0] = f; t = blkspl(vp, t); /* Splice up the new arglst */ f = *t; execv(f, t); xfree(t); /* The sky is falling, the sky is falling! */ case ENOMEM: Perror(f); case ENOENT: break; default: if (exerr == 0) { exerr = sys_errlist[errno]; expath = savestr(f); } } } [...]