~ubuntu-branches/ubuntu/precise/xterm/precise-updates

« back to all changes in this revision

Viewing changes to main.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Hooker
  • Date: 2010-06-10 22:13:44 UTC
  • mfrom: (1.1.18 upstream) (11.1.19 sid)
  • Revision ID: james.westby@ubuntu.com-20100610221344-s4wbmxbevlklu7fv
Tags: 259-1ubuntu1
* Merge from debian unstable. Remaining Ubuntu changes:
  - Revert the libutempter change because it's in universe. (LP: #539473)
  - Enabled URL highlighting
  - Add 100_uxterm_utf8_title.patch: Set utf8Titles to true by default
    when using uxterm, so that it displays utf8 directories in titles
    properly.  May cause issues with apps that use control sequences for
    updating the xterm titlebar - users should use xterm or set utf8Title
    to false in this case. (LP: #320388, #408496)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $XTermId: main.c,v 1.602 2010/01/20 22:07:23 tom Exp $ */
 
1
/* $XTermId: main.c,v 1.617 2010/06/04 09:45:06 tom Exp $ */
2
2
 
3
3
/*
4
4
 *                               W A R N I N G
844
844
    Bres("messages", "Messages", messages, True),
845
845
    Ires("minBufSize", "MinBufSize", minBufSize, 4096),
846
846
    Ires("maxBufSize", "MaxBufSize", maxBufSize, 32768),
847
 
    Sres("menuLocale", "MenuLocale", menuLocale, ""),
 
847
    Sres("menuLocale", "MenuLocale", menuLocale, DEF_MENU_LOCALE),
848
848
    Sres("keyboardType", "KeyboardType", keyboardType, "unknown"),
849
849
#if OPT_SUNPC_KBD
850
850
    Bres("sunKeyboard", "SunKeyboard", sunKeyboard, False),
1294
1294
#endif
1295
1295
#if defined(_PC_VDISABLE)
1296
1296
                if (value == -1) {
1297
 
                    value = fpathconf(0, _PC_VDISABLE);
 
1297
                    value = (int) fpathconf(0, _PC_VDISABLE);
1298
1298
                    if (value == -1) {
1299
1299
                        if (errno != 0)
1300
1300
                            break;      /* skip this (error) */
1315
1315
        ++string;
1316
1316
    } else if (termcap && (*string == '\\')) {
1317
1317
        char *d;
1318
 
        int temp = strtol(string + 1, &d, 8);
 
1318
        int temp = (int) strtol(string + 1, &d, 8);
1319
1319
        if (temp > 0 && d != string) {
1320
1320
            value = temp;
1321
1321
            string = d;
1818
1818
                Version();
1819
1819
            } else if (abbrev(argv[n], "-help", unique)) {
1820
1820
                Help();
1821
 
            } else if (abbrev(argv[n], "-class", 3)) {
 
1821
            } else if (abbrev(argv[n], "-class", (size_t) 3)) {
1822
1822
                if ((my_class = argv[++n]) == 0) {
1823
1823
                    Help();
1824
1824
                } else {
1827
1827
                unique = 3;
1828
1828
            } else {
1829
1829
#if OPT_COLOR_RES
1830
 
                if (abbrev(argv[n], "-reverse", 2)
 
1830
                if (abbrev(argv[n], "-reverse", (size_t) 2)
1831
1831
                    || !strcmp("-rv", argv[n])) {
1832
1832
                    reversed = True;
1833
1833
                } else if (!strcmp("+rv", argv[n])) {
2908
2908
    int why;
2909
2909
 
2910
2910
    TRACE_IDS;
2911
 
    TRACE(("set_owner(%s, uid=%d, gid=%d, mode=%#o\n", device, uid, gid, mode));
 
2911
    TRACE(("set_owner(%s, uid=%d, gid=%d, mode=%#o\n",
 
2912
           device, uid, gid, (unsigned) mode));
2912
2913
 
2913
2914
    if (chown(device, uid, gid) < 0) {
2914
2915
        why = errno;
2936
2937
                        (unsigned long) (sb.st_mode & 0777U),
2937
2938
                        strerror(why));
2938
2939
                TRACE(("...stat uid=%d, gid=%d, mode=%#o\n",
2939
 
                       sb.st_uid, sb.st_gid, sb.st_mode));
 
2940
                       sb.st_uid, sb.st_gid, (unsigned) sb.st_mode));
2940
2941
            }
2941
2942
        }
2942
2943
        TRACE(("...chmod failed: %s\n", strerror(why)));
2990
2991
 
2991
2992
#define close_fd(fd) close(fd), fd = -1
2992
2993
 
 
2994
#if defined(TIOCNOTTY) && (!defined(__GLIBC__) || (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))
 
2995
#define USE_NO_DEV_TTY 1
 
2996
#else
 
2997
#define USE_NO_DEV_TTY 0
 
2998
#endif
 
2999
 
2993
3000
/*
2994
3001
 *  Inits pty and tty and forks a login process.
2995
3002
 *  Does not close fd Xsocket.
3039
3046
#endif /* TERMIO_STRUCT */
3040
3047
 
3041
3048
    char *ptr, *shname, *shname_minus;
3042
 
    int i, no_dev_tty = False;
 
3049
    int i;
 
3050
#if USE_NO_DEV_TTY
 
3051
    int no_dev_tty = False;
 
3052
#endif
3043
3053
    const char **envnew;        /* new environment */
3044
3054
    char buf[64];
3045
3055
    char *TermName = NULL;
3125
3135
         * seem to return EIO.  Solaris 2.3 is said to return EINVAL.
3126
3136
         * Cygwin returns ENOENT.
3127
3137
         */
 
3138
#if USE_NO_DEV_TTY
3128
3139
        no_dev_tty = False;
 
3140
#endif
3129
3141
        if (ttyfd < 0) {
3130
3142
            if (tty_got_hung || errno == ENXIO || errno == EIO ||
3131
3143
#ifdef ENODEV
3135
3147
                errno == ENOENT ||
3136
3148
#endif
3137
3149
                errno == EINVAL || errno == ENOTTY || errno == EACCES) {
 
3150
#if USE_NO_DEV_TTY
3138
3151
                no_dev_tty = True;
 
3152
#endif
3139
3153
#ifdef HAS_LTCHARS
3140
3154
                ltc = d_ltc;
3141
3155
#endif /* HAS_LTCHARS */
3173
3187
                lmode = d_lmode;
3174
3188
#endif /* TIOCLSET */
3175
3189
#ifdef TERMIO_STRUCT
3176
 
            if ((rc = ttyGetAttr(ttyfd, &tio)) == -1)
 
3190
            rc = ttyGetAttr(ttyfd, &tio);
 
3191
            if (rc == -1)
3177
3192
                tio = d_tio;
3178
3193
#else /* !TERMIO_STRUCT */
3179
 
            if ((rc = ioctl(ttyfd, TIOCGETP, (char *) &sg)) == -1)
 
3194
            rc = ioctl(ttyfd, TIOCGETP, (char *) &sg);
 
3195
            if (rc == -1)
3180
3196
                sg = d_sg;
3181
3197
            if (ioctl(ttyfd, TIOCGETC, (char *) &tc) == -1)
3182
3198
                tc = d_tc;
3225
3241
        if (resource.ptyInitialErase) {
3226
3242
#ifdef TERMIO_STRUCT
3227
3243
            TERMIO_STRUCT my_tio;
3228
 
            if ((rc = ttyGetAttr(screen->respond, &my_tio)) == 0)
 
3244
            rc = ttyGetAttr(screen->respond, &my_tio);
 
3245
            if (rc == 0)
3229
3246
                initial_erase = my_tio.c_cc[VERASE];
3230
3247
#else /* !TERMIO_STRUCT */
3231
3248
            struct sgttyb my_sg;
3232
 
            if ((rc = ioctl(screen->respond, TIOCGETP, (char *) &my_sg)) == 0)
 
3249
            rc = ioctl(screen->respond, TIOCGETP, (char *) &my_sg);
 
3250
            if (rc == 0)
3233
3251
                initial_erase = my_sg.sg_erase;
3234
3252
#endif /* TERMIO_STRUCT */
3235
3253
            TRACE(("%s initial_erase:%d (from pty)\n",
3332
3350
           resource.backarrow_is_erase ? "" : "not "));
3333
3351
    if (resource.backarrow_is_erase) {  /* see input.c */
3334
3352
        if (initial_erase == ANSI_DEL) {
3335
 
            xw->keyboard.flags &= ~MODE_DECBKM;
 
3353
            UIntClr(xw->keyboard.flags, MODE_DECBKM);
3336
3354
        } else {
3337
3355
            xw->keyboard.flags |= MODE_DECBKM;
3338
3356
            xw->keyboard.reset_DECBKM = 1;
3357
3375
    } else
3358
3376
#endif
3359
3377
    {
3360
 
        TTYSIZE_ROWS(ts) = MaxRows(screen);
3361
 
        TTYSIZE_COLS(ts) = MaxCols(screen);
 
3378
        TTYSIZE_ROWS(ts) = (ttySize_t) MaxRows(screen);
 
3379
        TTYSIZE_COLS(ts) = (ttySize_t) MaxCols(screen);
3362
3380
#if defined(USE_STRUCT_WINSIZE)
3363
 
        ts.ws_xpixel = FullWidth(screen);
3364
 
        ts.ws_ypixel = FullHeight(screen);
 
3381
        ts.ws_xpixel = (ttySize_t) FullWidth(screen);
 
3382
        ts.ws_ypixel = (ttySize_t) FullHeight(screen);
3365
3383
#endif
3366
3384
    }
3367
 
    i = SET_TTYSIZE(screen->respond, ts);
 
3385
    TRACE_RC(i, SET_TTYSIZE(screen->respond, ts));
3368
3386
    TRACE(("spawn SET_TTYSIZE %dx%d return %d\n",
3369
3387
           TTYSIZE_ROWS(ts),
3370
3388
           TTYSIZE_COLS(ts), i));
3394
3412
 
3395
3413
        if (screen->pid == 0) {
3396
3414
#ifdef USE_USG_PTYS
3397
 
            int ptyfd;
 
3415
            int ptyfd = -1;
3398
3416
            char *pty_name;
3399
3417
#endif
3400
3418
            /*
3411
3429
#ifdef USE_ISPTS_FLAG
3412
3430
                if (IsPts) {    /* SYSV386 supports both, which did we open? */
3413
3431
#endif
3414
 
                ptyfd = 0;
3415
 
                pty_name = 0;
3416
 
 
3417
3432
                setpgrp();
3418
3433
                grantpt(screen->respond);
3419
3434
                unlockpt(screen->respond);
3420
3435
                if ((pty_name = ptsname(screen->respond)) == 0) {
3421
3436
                    SysError(ERROR_PTSNAME);
3422
 
                }
3423
 
                if ((ptyfd = open(pty_name, O_RDWR)) < 0) {
 
3437
                } else if ((ptyfd = open(pty_name, O_RDWR)) < 0) {
3424
3438
                    SysError(ERROR_OPPTSNAME);
3425
3439
                }
3426
3440
#ifdef I_PUSH
3427
 
                if (ioctl(ptyfd, I_PUSH, "ptem") < 0) {
 
3441
                else if (ioctl(ptyfd, I_PUSH, "ptem") < 0) {
3428
3442
                    SysError(ERROR_PTEM);
3429
3443
                }
3430
3444
#if !defined(SVR4) && !(defined(SYSV) && defined(i386))
3431
 
                if (!x_getenv("CONSEM") && ioctl(ptyfd, I_PUSH, "consem") < 0) {
 
3445
                else if (!x_getenv("CONSEM")
 
3446
                         && ioctl(ptyfd, I_PUSH, "consem") < 0) {
3432
3447
                    SysError(ERROR_CONSEM);
3433
3448
                }
3434
3449
#endif /* !SVR4 */
3435
 
                if (ioctl(ptyfd, I_PUSH, "ldterm") < 0) {
 
3450
                else if (ioctl(ptyfd, I_PUSH, "ldterm") < 0) {
3436
3451
                    SysError(ERROR_LDTERM);
3437
3452
                }
3438
3453
#ifdef SVR4                     /* from Sony */
3439
 
                if (ioctl(ptyfd, I_PUSH, "ttcompat") < 0) {
 
3454
                else if (ioctl(ptyfd, I_PUSH, "ttcompat") < 0) {
3440
3455
                    SysError(ERROR_TTCOMPAT);
3441
3456
                }
3442
3457
#endif /* SVR4 */
3459
3474
                } else
3460
3475
#endif /* OPT_TEK4014 */
3461
3476
                {
3462
 
                    TTYSIZE_ROWS(ts) = MaxRows(screen);
3463
 
                    TTYSIZE_COLS(ts) = MaxCols(screen);
 
3477
                    TTYSIZE_ROWS(ts) = (ttySize_t) MaxRows(screen);
 
3478
                    TTYSIZE_COLS(ts) = (ttySize_t) MaxCols(screen);
3464
3479
#ifdef USE_STRUCT_WINSIZE
3465
 
                    ts.ws_xpixel = FullWidth(screen);
3466
 
                    ts.ws_ypixel = FullHeight(screen);
 
3480
                    ts.ws_xpixel = (ttySize_t) FullWidth(screen);
 
3481
                    ts.ws_ypixel = (ttySize_t) FullHeight(screen);
3467
3482
#endif
3468
3483
                }
3469
3484
#endif /* TTYSIZE_STRUCT */
3487
3502
                     */
3488
3503
                    if (cp_pipe[1] <= 2) {
3489
3504
                        if ((i = fcntl(cp_pipe[1], F_DUPFD, 3)) >= 0) {
3490
 
                            (void) close(cp_pipe[1]);
 
3505
                            IGNORE_RC(close(cp_pipe[1]));
3491
3506
                            cp_pipe[1] = i;
3492
3507
                        }
3493
3508
                    }
3494
3509
                    if (pc_pipe[0] <= 2) {
3495
3510
                        if ((i = fcntl(pc_pipe[0], F_DUPFD, 3)) >= 0) {
3496
 
                            (void) close(pc_pipe[0]);
 
3511
                            IGNORE_RC(close(pc_pipe[0]));
3497
3512
                            pc_pipe[0] = i;
3498
3513
                        }
3499
3514
                    }
3501
3516
                    /* we don't need the socket, or the pty master anymore */
3502
3517
                    close(ConnectionNumber(screen->display));
3503
3518
#ifndef __MVS__
3504
 
                    close(screen->respond);
 
3519
                    if (screen->respond >= 0)
 
3520
                        close(screen->respond);
3505
3521
#endif /* __MVS__ */
3506
3522
 
3507
3523
                    /* Now is the time to set up our process group and
3509
3525
                     */
3510
3526
#ifdef USE_SYSV_PGRP
3511
3527
#if defined(CRAY) && (OSMAJORVERSION > 5)
3512
 
                    (void) setsid();
 
3528
                    IGNORE_RC(setsid());
3513
3529
#else
3514
 
                    (void) setpgrp();
 
3530
                    IGNORE_RC(setpgrp());
3515
3531
#endif
3516
3532
#endif /* USE_SYSV_PGRP */
3517
3533
 
3530
3546
                    }
3531
3547
 
3532
3548
                    while (1) {
3533
 
#if defined(TIOCNOTTY) && (!defined(__GLIBC__) || (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))
 
3549
#if USE_NO_DEV_TTY
3534
3550
                        if (!no_dev_tty
3535
3551
                            && (ttyfd = open("/dev/tty", O_RDWR)) >= 0) {
3536
3552
                            ioctl(ttyfd, TIOCNOTTY, (char *) NULL);
3537
3553
                            close_fd(ttyfd);
3538
3554
                        }
3539
 
#endif /* TIOCNOTTY && !glibc >= 2.1 */
 
3555
#endif /* USE_NO_DEV_TTY */
3540
3556
#ifdef CSRG_BASED
3541
 
                        (void) revoke(ttydev);
 
3557
                        IGNORE_RC(revoke(ttydev));
3542
3558
#endif
3543
3559
                        if ((ttyfd = open(ttydev, O_RDWR)) >= 0) {
3544
3560
#if defined(CRAY) && defined(TCSETCTTY)
3578
3594
                                        sizeof(handshake)));
3579
3595
 
3580
3596
                        /* get reply from parent */
3581
 
                        i = read(pc_pipe[0], (char *) &handshake,
3582
 
                                 sizeof(handshake));
 
3597
                        i = (int) read(pc_pipe[0], (char *) &handshake,
 
3598
                                       sizeof(handshake));
3583
3599
                        if (i <= 0) {
3584
3600
                            /* parent terminated */
3585
3601
                            exit(1);
3592
3608
 
3593
3609
                        /* We have a new pty to try */
3594
3610
                        free(ttydev);
3595
 
                        ttydev = CastMallocN(char, strlen(handshake.buffer));
3596
 
                        if (ttydev == NULL) {
3597
 
                            SysError(ERROR_SPREALLOC);
3598
 
                        }
3599
 
                        strcpy(ttydev, handshake.buffer);
 
3611
                        ttydev = x_strdup(handshake.buffer);
3600
3612
                    }
3601
3613
 
3602
3614
                    /* use the same tty name that everyone else will use
3603
3615
                     * (from ttyname)
3604
3616
                     */
3605
3617
                    if ((ptr = ttyname(ttyfd)) != 0) {
3606
 
                        /* it may be bigger */
3607
 
                        ttydev = TypeRealloc(char, strlen(ptr) + 1, ttydev);
3608
 
                        if (ttydev == NULL) {
3609
 
                            SysError(ERROR_SPREALLOC);
3610
 
                        }
3611
 
                        (void) strcpy(ttydev, ptr);
 
3618
                        free(ttydev);
 
3619
                        ttydev = x_strdup(ptr);
3612
3620
                    }
3613
3621
                }
3614
3622
#endif /* OPT_PTY_HANDSHAKE -- from near fork */
3641
3649
                 * child pty.
3642
3650
                 */
3643
3651
                /* input: nl->nl, don't ignore cr, cr->nl */
3644
 
                tio.c_iflag &= ~(INLCR | IGNCR);
 
3652
                UIntClr(tio.c_iflag, (INLCR | IGNCR));
3645
3653
                tio.c_iflag |= ICRNL;
3646
3654
#if OPT_WIDE_CHARS && defined(linux) && defined(IUTF8)
3647
3655
#if OPT_LUIT_PROG
3652
3660
#endif
3653
3661
                /* ouput: cr->cr, nl is not return, no delays, ln->cr/nl */
3654
3662
#ifndef USE_POSIX_TERMIOS
3655
 
                tio.c_oflag &=
3656
 
                    ~(OCRNL
3657
 
                      | ONLRET
3658
 
                      | NLDLY
3659
 
                      | CRDLY
3660
 
                      | TABDLY
3661
 
                      | BSDLY
3662
 
                      | VTDLY
3663
 
                      | FFDLY);
 
3663
                UIntClr(tio.c_oflag,
 
3664
                        (OCRNL
 
3665
                         | ONLRET
 
3666
                         | NLDLY
 
3667
                         | CRDLY
 
3668
                         | TABDLY
 
3669
                         | BSDLY
 
3670
                         | VTDLY
 
3671
                         | FFDLY));
3664
3672
#endif /* USE_POSIX_TERMIOS */
3665
3673
#ifdef ONLCR
3666
3674
                tio.c_oflag |= ONLCR;
3672
3680
# if defined(Lynx) && !defined(CBAUD)
3673
3681
#  define CBAUD V_CBAUD
3674
3682
# endif
3675
 
                tio.c_cflag &= ~(CBAUD);
 
3683
                UIntClr(tio.c_cflag, CBAUD);
3676
3684
#ifdef BAUD_0
3677
3685
                /* baud rate is 0 (don't care) */
3678
3686
#elif defined(HAVE_TERMIO_C_ISPEED)
3752
3760
                    HsSysError(ERROR_TIOCSETP);
3753
3761
 
3754
3762
                /* ignore errors here - some platforms don't work */
3755
 
                tio.c_cflag &= ~CSIZE;
 
3763
                UIntClr(tio.c_cflag, CSIZE);
3756
3764
                if (screen->input_eight_bits)
3757
3765
                    tio.c_cflag |= CS8;
3758
3766
                else
3827
3835
                    if (fd == -1 || ioctl(fd, SRIOCSREDIR, ttyfd) == -1)
3828
3836
                        fprintf(stderr, "%s: cannot open console: %s\n",
3829
3837
                                ProgramName, strerror(errno));
3830
 
                    (void) close(fd);
 
3838
                    IGNORE_RC(close(fd));
3831
3839
#endif
3832
3840
                }
3833
3841
#endif /* TIOCCONS */
3868
3876
                old_erase = tio.c_cc[VERASE];
3869
3877
#endif
3870
3878
                tio.c_cc[VERASE] = initial_erase;
3871
 
                rc = ttySetAttr(ttyfd, &tio);
 
3879
                TRACE_RC(rc, ttySetAttr(ttyfd, &tio));
3872
3880
#else /* !TERMIO_STRUCT */
3873
3881
                if (ioctl(ttyfd, TIOCGETP, (char *) &sg) == -1)
3874
3882
                    sg = d_sg;
3907
3915
#if defined(CRAY) && (OSMAJORVERSION >= 6)
3908
3916
                close_fd(ttyfd);
3909
3917
 
3910
 
                (void) close(0);
 
3918
                IGNORE_RC(close(0));
3911
3919
 
3912
3920
                if (open("/dev/tty", O_RDWR)) {
3913
3921
                    SysError(ERROR_OPDEVTTY);
3914
3922
                }
3915
 
                (void) close(1);
3916
 
                (void) close(2);
 
3923
                IGNORE_RC(close(1));
 
3924
                IGNORE_RC(close(2));
3917
3925
                dup(0);
3918
3926
                dup(0);
3919
3927
#else
3920
3928
                /* dup the tty */
3921
3929
                for (i = 0; i <= 2; i++)
3922
3930
                    if (i != ttyfd) {
3923
 
                        (void) close(i);
 
3931
                        IGNORE_RC(close(i));
3924
3932
                        IGNORE_RC(dup(ttyfd));
3925
3933
                    }
3926
3934
#ifndef ATT
4015
4023
 
4016
4024
            /* position to entry in utmp file */
4017
4025
            /* Test return value: beware of entries left behind: PSz 9 Mar 00 */
4018
 
            if (!(utret = find_utmp(&utmp))) {
 
4026
            utret = find_utmp(&utmp);
 
4027
            if (utret == 0) {
4019
4028
                (void) call_setutent();
4020
4029
                init_utmp(USER_PROCESS, &utmp);
4021
 
                if (!(utret = find_utmp(&utmp))) {
 
4030
                utret = find_utmp(&utmp);
 
4031
                if (utret == 0) {
4022
4032
                    (void) call_setutent();
4023
4033
                }
4024
4034
            }
4027
4037
                TRACE(("getutid: NULL\n"));
4028
4038
            else
4029
4039
                TRACE(("getutid: pid=%d type=%d user=%s line=%s id=%s\n",
4030
 
                       utret->ut_pid, utret->ut_type, utret->ut_user,
 
4040
                       (int) utret->ut_pid, utret->ut_type, utret->ut_user,
4031
4041
                       utret->ut_line, utret->ut_id));
4032
4042
#endif
4033
4043
 
4196
4206
                handshake.error = 0;
4197
4207
                strcpy(handshake.buffer, ttydev);
4198
4208
                TRACE_HANDSHAKE("writing", &handshake);
4199
 
                (void) write(cp_pipe[1], (char *) &handshake, sizeof(handshake));
 
4209
                IGNORE_RC(write(cp_pipe[1], (char *) &handshake, sizeof(handshake)));
4200
4210
            }
4201
4211
#endif /* OPT_PTY_HANDSHAKE */
4202
4212
#endif /* USE_UTEMPTER */
4203
4213
#endif /* HAVE_UTMP */
4204
4214
 
4205
 
            (void) setgid(screen->gid);
 
4215
            IGNORE_RC(setgid(screen->gid));
4206
4216
            TRACE_IDS;
4207
4217
#ifdef HAS_BSD_GROUPS
4208
4218
            if (geteuid() == 0 && pw) {
4235
4245
                                sizeof(handshake)));
4236
4246
 
4237
4247
                if (resource.wait_for_map) {
4238
 
                    i = read(pc_pipe[0], (char *) &handshake,
4239
 
                             sizeof(handshake));
 
4248
                    i = (int) read(pc_pipe[0], (char *) &handshake,
 
4249
                                   sizeof(handshake));
4240
4250
                    if (i != sizeof(handshake) ||
4241
4251
                        handshake.status != PTY_EXEC) {
4242
4252
                        /* some very bad problem occurred */
4249
4259
                        set_max_col(screen, handshake.cols);
4250
4260
#ifdef TTYSIZE_STRUCT
4251
4261
                        got_handshake_size = True;
4252
 
                        TTYSIZE_ROWS(ts) = MaxRows(screen);
4253
 
                        TTYSIZE_COLS(ts) = MaxCols(screen);
 
4262
                        TTYSIZE_ROWS(ts) = (ttySize_t) MaxRows(screen);
 
4263
                        TTYSIZE_COLS(ts) = (ttySize_t) MaxCols(screen);
4254
4264
#if defined(USE_STRUCT_WINSIZE)
4255
 
                        ts.ws_xpixel = FullWidth(screen);
4256
 
                        ts.ws_ypixel = FullHeight(screen);
 
4265
                        ts.ws_xpixel = (ttySize_t) FullWidth(screen);
 
4266
                        ts.ws_ypixel = (ttySize_t) FullHeight(screen);
4257
4267
#endif
4258
4268
#endif /* TTYSIZE_STRUCT */
4259
4269
                    }
4302
4312
#if OPT_INITIAL_ERASE
4303
4313
                    unsigned len;
4304
4314
                    remove_termcap_entry(newtc, TERMCAP_ERASE "=");
4305
 
                    len = strlen(newtc);
 
4315
                    len = (unsigned) strlen(newtc);
4306
4316
                    if (len != 0 && newtc[len - 1] == ':')
4307
4317
                        len--;
4308
4318
                    sprintf(newtc + len, ":%s=\\%03o:",
4325
4335
                && resource.ptySttySize
4326
4336
                && (got_handshake_size || !resource.wait_for_map0)) {
4327
4337
#ifdef TTYSIZE_STRUCT
4328
 
                i = SET_TTYSIZE(0, ts);
 
4338
                TRACE_RC(i, SET_TTYSIZE(0, ts));
4329
4339
                TRACE(("ptyHandshake SET_TTYSIZE %dx%d return %d\n",
4330
4340
                       TTYSIZE_ROWS(ts),
4331
4341
                       TTYSIZE_COLS(ts), i));
4418
4428
            /* Exec failed. */
4419
4429
            fprintf(stderr, "%s: Could not exec %s: %s\n", ProgramName,
4420
4430
                    ptr, strerror(errno));
4421
 
            (void) sleep(5);
 
4431
            IGNORE_RC(sleep(5));
4422
4432
            exit(ERROR_EXEC);
4423
4433
        }
4424
4434
        /* end if in child after fork */
4456
4466
                    /* The open of the pty failed!  Let's get
4457
4467
                     * another one.
4458
4468
                     */
4459
 
                    (void) close(screen->respond);
 
4469
                    IGNORE_RC(close(screen->respond));
4460
4470
                    if (get_pty(&screen->respond, XDisplayString(screen->display))) {
4461
4471
                        /* no more ptys! */
4462
4472
                        fprintf(stderr,
4732
4742
#endif
4733
4743
            TRACE(("closed display\n"));
4734
4744
        }
4735
 
        TRACE((0));
 
4745
        TRACE_CLOSE();
4736
4746
    }
4737
4747
#endif
4738
4748