Annotation of 43BSDTahoe/ucb/telnet/Source/main.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1988 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms are permitted
        !             6:  * provided that this notice is preserved and that due credit is given
        !             7:  * to the University of California at Berkeley. The name of the University
        !             8:  * may not be used to endorse or promote products derived from this
        !             9:  * software without specific prior written permission. This software
        !            10:  * is provided ``as is'' without express or implied warranty.
        !            11:  */
        !            12: 
        !            13: #ifndef lint
        !            14: char copyright[] =
        !            15: "@(#) Copyright (c) 1988 Regents of the University of California.\n\
        !            16:  All rights reserved.\n";
        !            17: #endif /* not lint */
        !            18: 
        !            19: #ifndef lint
        !            20: static char sccsid[] = "@(#)main.c     1.6 (Berkeley) 5/15/88";
        !            21: #endif /* not lint */
        !            22: 
        !            23: #include <sys/types.h>
        !            24: 
        !            25: #include "ring.h"
        !            26: 
        !            27: #include "externs.h"
        !            28: #include "defines.h"
        !            29: 
        !            30: /*
        !            31:  * Initialize variables.
        !            32:  */
        !            33: 
        !            34: void
        !            35: tninit()
        !            36: {
        !            37:     init_terminal();
        !            38: 
        !            39:     init_network();
        !            40:     
        !            41:     init_telnet();
        !            42: 
        !            43:     init_sys();
        !            44: 
        !            45:     init_3270();
        !            46: }
        !            47: 
        !            48: 
        !            49: /*
        !            50:  * main.  Parse arguments, invoke the protocol or command parser.
        !            51:  */
        !            52: 
        !            53: 
        !            54: void
        !            55: main(argc, argv)
        !            56:        int argc;
        !            57:        char *argv[];
        !            58: {
        !            59:     tninit();          /* Clear out things */
        !            60: 
        !            61:     TerminalSaveState();
        !            62: 
        !            63:     prompt = argv[0];
        !            64:     while ((argc > 1) && (argv[1][0] == '-')) {
        !            65:        if (!strcmp(argv[1], "-d")) {
        !            66:            debug = 1;
        !            67:        } else if (!strcmp(argv[1], "-n")) {
        !            68:            if ((argc > 1) && (argv[2][0] != '-')) {    /* get file name */
        !            69:                NetTrace = fopen(argv[2], "w");
        !            70:                argv++;
        !            71:                argc--;
        !            72:                if (NetTrace == NULL) {
        !            73:                    NetTrace = stdout;
        !            74:                }
        !            75:            }
        !            76:        } else {
        !            77: #if    defined(TN3270) && defined(unix)
        !            78:            if (!strcmp(argv[1], "-t")) {
        !            79:                if ((argc > 1) && (argv[2][0] != '-')) { /* get file name */
        !            80:                    transcom = tline;
        !            81:                    (void) strcpy(transcom, argv[1]);
        !            82:                    argv++;
        !            83:                    argc--;
        !            84:                }
        !            85:            } else if (!strcmp(argv[1], "-noasynch")) {
        !            86:                noasynch = 1;
        !            87:            } else
        !            88: #endif /* defined(TN3270) && defined(unix) */
        !            89:            if (argv[1][1] != '\0') {
        !            90:                fprintf(stderr, "Unknown option *%s*.\n", argv[1]);
        !            91:            }
        !            92:        }
        !            93:        argc--;
        !            94:        argv++;
        !            95:     }
        !            96:     if (argc != 1) {
        !            97:        if (setjmp(toplevel) != 0)
        !            98:            Exit(0);
        !            99:        tn(argc, argv);
        !           100:     }
        !           101:     setjmp(toplevel);
        !           102:     for (;;) {
        !           103: #if    !defined(TN3270)
        !           104:        command(1);
        !           105: #else  /* !defined(TN3270) */
        !           106:        if (!shell_active) {
        !           107:            command(1);
        !           108:        } else {
        !           109: #if    defined(TN3270)
        !           110:            shell_continue();
        !           111: #endif /* defined(TN3270) */
        !           112:        }
        !           113: #endif /* !defined(TN3270) */
        !           114:     }
        !           115: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.