/* * MAIN.C * * Matthew Dillon, 28 Apr 1986 * * el main routine. */ #include "shell.h" char Inline[256]; main(argc, argv) char *argv[]; { char *prompt; int i; init_vars(); init(); for (i = 1; i < argc; ++i) { strcpy (Inline, "source "); strcat (Inline, argv[i]); do_source (Inline, 0); } for (;;) { if ((prompt = get_var (LEVEL_SET, V_PROMPT)) == NULL) prompt = "echo -n \"% \""; ++H_stack; exec_command (prompt); --H_stack; fflush (stdout); if (gets (Inline) == NULL) exit (0); if (*Inline) exec_command (Inline); } } init() { } init_vars() { set_var (LEVEL_SET, V_PROMPT, "echo -n \"% \""); set_var (LEVEL_SET, V_HIST, "20"); }