1: #include "hd.h"
2: #include "mydir.h"
3: #include <signal.h>
4:
5: /* Extract data about environment */
6: #define ENV_COUNT 3
7:
8: char *env_defalt [ENV_COUNT] = /* Defaults */
9: {"/bin/csh", "/", "unknown"};
10: char *env_name [ENV_COUNT] = /* Names */
11: {"SHELL", "HOME", "TERM"};
12:
13: char *envshell, *envhome, *envterm;
14:
15: char **env_dest [ENV_COUNT] = /* Place stored */
16: {&envshell, &envhome, &envterm};
17:
18: main () {
19:
20: /* Initialize everything, then run. */
21:
22: int i;
23: extern char * mygetenv ();
24:
25: extern leave ();
26:
27: comein ();
28:
29: for (i = 0; i < ENV_COUNT; i++)
30: *env_dest [i] = mygetenv (env_name [i], env_default [i]);
31:
32: signal (SIGINT, leave);
33: tty_init (); curs_init ();
34: erase (); printf ("Vsh %0.1f\n", VERSION);
35: cmdldrc ();
36: wdfile = -1;
37: if (curdir () || enterdir (DOT) == FAILURE) leave ();
38: tty_push (RAWMODE);
39:
40: process ();
41: }
42:
43: /* Return environment value of pstr. If none found, or the string
44: length is too long, the default returned */
45:
46: char *mygetenv
47: (pstr, def)
48: char *pstr, *def; {
49:
50: char *rstr; /* return value */
51: char *getenv ();
52:
53: rstr = getenv (pstr);
54: if ((rstr == NULL) || (strlen (rstr) >= STRMAX)) return def;
55: else return rstr;
56: }
Defined functions
main
defined in line
18;
never used
Defined variables
Defined macros