-
- TerminalSaveState();
-
- prompt = argv[0];
- while ((argc > 1) && (argv[1][0] == '-')) {
- if (!strcmp(argv[1], "-d")) {
- debug = 1;
- } else if (!strcmp(argv[1], "-n")) {
- if ((argc > 1) && (argv[2][0] != '-')) { /* get file name */
- SetNetTrace(argv[2]);
- argv++;
- argc--;
- }
- } else if (!strcmp(argv[1], "-l")) {
- if ((argc > 1) && (argv[2][0] != '-')) { /* get user name */
- user = argv[2];
- argv++;
- argc--;
- }
- } else if (!strncmp(argv[1], "-e", 2)) {
- set_escape_char(&argv[1][2]);
- } else {
-#if defined(TN3270) && defined(unix)
- if (!strcmp(argv[1], "-t")) {
- if ((argc > 1) && (argv[2][0] != '-')) { /* get file name */
- transcom = tline;
- (void) strcpy(transcom, argv[2]);
- argv++;
- argc--;
- }
- } else if (!strcmp(argv[1], "-noasynch")) {
- noasynchtty = 1;
- noasynchnet = 1;
- } else if (!strcmp(argv[1], "-noasynchtty")) {
- noasynchtty = 1;
- } else if (!strcmp(argv[1], "-noasynchnet")) {
- noasynchnet = 1;
- } else
+ TerminalSaveState();
+
+ if (prompt = rindex(argv[0], '/'))
+ ++prompt;
+ else
+ prompt = argv[0];
+
+ user = NULL;
+ autologin = 0;
+ while ((ch = getopt(argc, argv, "ade:l:n:")) != EOF)
+ switch(ch) {
+ case 'a':
+ autologin = 1;
+ break;
+ case 'd':
+ debug = 1;
+ break;
+ case 'e':
+ set_escape_char(optarg);
+ break;
+ case 'l':
+ autologin = 1;
+ user = optarg;
+ break;
+ case 'n':
+#if defined(TN3270) && defined(unix)
+ /* distinguish between "-n oasynch" and "-noasynch" */
+ if (argv[optind - 1][0] == '-' && argv[optind - 1][1]
+ == 'n' && argv[optind - 1][2] == 'o') {
+ if (!strcmp(optarg, "oasynch")) {
+ noasynchtty = 1;
+ noasynchnet = 1;
+ } else if (!strcmp(optarg, "oasynchtty"))
+ noasynchtty = 1;
+ } else if (!strcmp(optarg, "oasynchnet"))
+ noasynchnet = 1;
+ }
+ } else