Flush out the last dregs in the terminal before quitting when
[unix-history] / usr / src / usr.bin / telnet / main.c
index 144dfa7..0bee9d6 100644 (file)
@@ -3,11 +3,16 @@
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of California at 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'' without express or implied warranty.
+ * 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
@@ -17,7 +22,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     1.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     1.10 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -41,6 +46,8 @@ tninit()
     init_telnet();
 
     init_sys();
     init_telnet();
 
     init_sys();
+
+    init_3270();
 }
 
 
 }
 
 
@@ -49,7 +56,7 @@ tninit()
  */
 
 
  */
 
 
-void
+int
 main(argc, argv)
        int argc;
        char *argv[];
 main(argc, argv)
        int argc;
        char *argv[];
@@ -76,12 +83,17 @@ main(argc, argv)
            if (!strcmp(argv[1], "-t")) {
                if ((argc > 1) && (argv[2][0] != '-')) { /* get file name */
                    transcom = tline;
            if (!strcmp(argv[1], "-t")) {
                if ((argc > 1) && (argv[2][0] != '-')) { /* get file name */
                    transcom = tline;
-                   (void) strcpy(transcom, argv[1]);
+                   (void) strcpy(transcom, argv[2]);
                    argv++;
                    argc--;
                }
            } else if (!strcmp(argv[1], "-noasynch")) {
                    argv++;
                    argc--;
                }
            } else if (!strcmp(argv[1], "-noasynch")) {
-               noasynch = 1;
+               noasynchtty = 1;
+               noasynchnet = 1;
+           } else if (!strcmp(argv[1], "-noasynchtty")) {
+               noasynchtty = 1;
+           } else if (!strcmp(argv[1], "-noasynchnet")) {
+               noasynchnet = 1;
            } else
 #endif /* defined(TN3270) && defined(unix) */
            if (argv[1][1] != '\0') {
            } else
 #endif /* defined(TN3270) && defined(unix) */
            if (argv[1][1] != '\0') {
@@ -94,9 +106,13 @@ main(argc, argv)
     if (argc != 1) {
        if (setjmp(toplevel) != 0)
            Exit(0);
     if (argc != 1) {
        if (setjmp(toplevel) != 0)
            Exit(0);
-       tn(argc, argv);
+       if (tn(argc, argv) == 1) {
+           return 0;
+       } else {
+           return 1;
+       }
     }
     }
-    setjmp(toplevel);
+    (void) setjmp(toplevel);
     for (;;) {
 #if    !defined(TN3270)
        command(1);
     for (;;) {
 #if    !defined(TN3270)
        command(1);