less verbose...
[unix-history] / usr / src / usr.bin / window / main.c
index 5674e80..1e9c188 100644 (file)
@@ -1,6 +1,23 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)main.c      3.24 84/04/16";
-#endif
+static char sccsid[] = "@(#)main.c     3.34 (Berkeley) %G%";
+#endif /* not lint */
 
 #include "defs.h"
 #include <sys/signal.h>
 
 #include "defs.h"
 #include <sys/signal.h>
@@ -22,6 +39,7 @@ char **argv;
        char *cmd = 0;
        char tflag = 0;
 
        char *cmd = 0;
        char tflag = 0;
 
+       escapec = ESCAPEC;      
        if (p = rindex(*argv, '/'))
                p++;
        else
        if (p = rindex(*argv, '/'))
                p++;
        else
@@ -62,18 +80,18 @@ char **argv;
                } else
                        (void) usage();
        }
                } else
                        (void) usage();
        }
-       nbufline = NLINE;
-       escapec = ESCAPEC;      
        if ((p = getenv("SHELL")) == 0)
                p = SHELL;
        if ((p = getenv("SHELL")) == 0)
                p = SHELL;
-       if ((shellfile = str_cpy(p)) == 0)
+       if ((default_shellfile = str_cpy(p)) == 0)
                nomem();
                nomem();
-       if (p = rindex(shellfile, '/'))
+       if (p = rindex(default_shellfile, '/'))
                p++;
        else
                p++;
        else
-               p = shellfile;
-       shell[0] = p;
-       shell[1] = 0;
+               p = default_shellfile;
+       default_shell[0] = p;
+       default_shell[1] = 0;
+       default_nline = NLINE;
+       default_smooth = 1;
        (void) gettimeofday(&starttime, (struct timezone *)0);
        if (wwinit() < 0) {
                (void) fprintf(stderr, "%s.\n", wwerror());
        (void) gettimeofday(&starttime, (struct timezone *)0);
        if (wwinit() < 0) {
                (void) fprintf(stderr, "%s.\n", wwerror());
@@ -86,9 +104,10 @@ char **argv;
                wwnewtty.ww_tchars.t_startc = wwoldtty.ww_tchars.t_startc;
        }
        if (debug || xflag)
                wwnewtty.ww_tchars.t_startc = wwoldtty.ww_tchars.t_startc;
        }
        if (debug || xflag)
-               (void) wwsettty(0, &wwnewtty);
+               (void) wwsettty(0, &wwnewtty, &wwoldtty);
 
 
-       if ((cmdwin = wwopen(WWO_REVERSE, 1, wwncol, 0, 0, 0)) == 0) {
+       if ((cmdwin = wwopen(wwbaud > 2400 ? WWO_REVERSE : 0, 1, wwncol,
+                            0, 0, 0)) == 0) {
                (void) wwflush();
                (void) fprintf(stderr, "%s.\r\n", wwerror());
                goto bad;
                (void) wwflush();
                (void) fprintf(stderr, "%s.\r\n", wwerror());
                goto bad;
@@ -119,18 +138,15 @@ char **argv;
        setterse(tflag);
        setcmd(1);
        if (cmd != 0)
        setterse(tflag);
        setcmd(1);
        if (cmd != 0)
-               (void) dolongcmd(cmd);
-       if (!fflag) {
+               (void) dolongcmd(cmd, (struct value *)0, 0);
+       if (!fflag)
                if (dflag || doconfig() < 0)
                        dodefault();
                if (dflag || doconfig() < 0)
                        dodefault();
-               if (selwin != 0)
-                       setcmd(0);
-       }
+       if (selwin != 0)
+               setcmd(0);
 
        mloop();
 
 
        mloop();
 
-       wwupdate();
-       wwflush();
 bad:
        wwend();
        return 0;
 bad:
        wwend();
        return 0;