… | |
… | |
339 | rs[Rs_name] = rxvt_r_basename (argv[0]); |
339 | rs[Rs_name] = rxvt_r_basename (argv[0]); |
340 | |
340 | |
341 | /* |
341 | /* |
342 | * Open display, get options/resources and create the window |
342 | * Open display, get options/resources and create the window |
343 | */ |
343 | */ |
|
|
344 | { |
|
|
345 | TEMP_ENV; |
|
|
346 | |
344 | if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL) |
347 | if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL) |
345 | rs[Rs_display_name] = ":0"; |
348 | rs[Rs_display_name] = ":0"; |
346 | |
349 | |
347 | get_options (r_argc, r_argv); |
350 | get_options (r_argc, r_argv); |
348 | |
351 | |
349 | if (!(display = displays.get (rs[Rs_display_name]))) |
352 | if (!(display = displays.get (rs[Rs_display_name]))) |
350 | rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); |
353 | rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); |
|
|
354 | } |
351 | |
355 | |
352 | extract_resources (); |
356 | extract_resources (); |
353 | free (r_argv); |
357 | free (r_argv); |
354 | |
358 | |
355 | /* |
359 | /* |
… | |
… | |
576 | * This should support all European type languages. |
580 | * This should support all European type languages. |
577 | */ |
581 | */ |
578 | void |
582 | void |
579 | rxvt_term::set_locale (const char *locale) |
583 | rxvt_term::set_locale (const char *locale) |
580 | { |
584 | { |
|
|
585 | TEMP_ENV; |
|
|
586 | |
581 | #if HAVE_XSETLOCALE || HAVE_SETLOCALE |
587 | #if HAVE_XSETLOCALE || HAVE_SETLOCALE |
582 | free (this->locale); |
588 | free (this->locale); |
583 | this->locale = setlocale (LC_CTYPE, locale); |
589 | this->locale = setlocale (LC_CTYPE, locale); |
584 | |
590 | |
585 | if (!this->locale) |
591 | if (!this->locale) |
586 | { |
592 | { |
587 | if (*locale) |
593 | if (*locale) |
588 | { |
594 | { |
589 | rxvt_warn ("unable to set locale \"%s\", using default locale instead.\n", locale); |
595 | rxvt_warn ("unable to set locale \"%s\", using C locale instead.\n", locale); |
590 | setlocale (LC_CTYPE, ""); |
596 | setlocale (LC_CTYPE, "C"); |
591 | } |
597 | } |
592 | else |
598 | else |
593 | rxvt_warn ("default locale unavailable, check LC_* and LANG variables. Continuing.\n"); |
599 | rxvt_warn ("default locale unavailable, check LC_* and LANG variables. Continuing.\n"); |
594 | |
600 | |
595 | this->locale = ""; |
601 | this->locale = "C"; |
596 | } |
602 | } |
597 | |
603 | |
598 | |
604 | |
599 | this->locale = rxvt_strdup (this->locale); |
605 | this->locale = rxvt_strdup (this->locale); |
600 | SET_LOCALE (this->locale); |
606 | SET_LOCALE (this->locale); |
… | |
… | |
615 | } |
621 | } |
616 | |
622 | |
617 | void |
623 | void |
618 | rxvt_term::init_xlocale () |
624 | rxvt_term::init_xlocale () |
619 | { |
625 | { |
|
|
626 | TEMP_ENV; |
|
|
627 | |
620 | #ifdef USE_XIM |
628 | #ifdef USE_XIM |
621 | if (!locale) |
629 | if (!locale) |
622 | rxvt_warn ("setting locale failed, working without locale support.\n"); |
630 | rxvt_warn ("setting locale failed, working without locale support.\n"); |
623 | else |
631 | else |
624 | { |
632 | { |
… | |
… | |
1525 | int |
1533 | int |
1526 | rxvt_term::run_child (const char *const *argv) |
1534 | rxvt_term::run_child (const char *const *argv) |
1527 | { |
1535 | { |
1528 | char *login; |
1536 | char *login; |
1529 | |
1537 | |
|
|
1538 | TEMP_ENV; // not very temporary... |
|
|
1539 | |
1530 | SET_TTYMODE (STDIN_FILENO, &tio); /* init terminal attributes */ |
1540 | SET_TTYMODE (STDIN_FILENO, &tio); /* init terminal attributes */ |
1531 | |
1541 | |
1532 | if (OPTION (Opt_console)) |
1542 | if (OPTION (Opt_console)) |
1533 | { /* be virtual console, fail silently */ |
1543 | { /* be virtual console, fail silently */ |
1534 | #ifdef TIOCCONS |
1544 | #ifdef TIOCCONS |
… | |
… | |
1580 | execvp (argv[0], (char *const *)argv); |
1590 | execvp (argv[0], (char *const *)argv); |
1581 | /* no error message: STDERR is closed! */ |
1591 | /* no error message: STDERR is closed! */ |
1582 | } |
1592 | } |
1583 | else |
1593 | else |
1584 | { |
1594 | { |
1585 | const char *argv0, *shell; |
1595 | const char *argv0, *shell; |
1586 | |
1596 | |
1587 | if ((shell = getenv ("SHELL")) == NULL || *shell == '\0') |
1597 | if ((shell = getenv ("SHELL")) == NULL || *shell == '\0') |
1588 | shell = "/bin/sh"; |
1598 | shell = "/bin/sh"; |
1589 | |
1599 | |
1590 | argv0 = (const char *)rxvt_r_basename (shell); |
1600 | argv0 = (const char *)rxvt_r_basename (shell); |
… | |
… | |
1595 | |
1605 | |
1596 | login[0] = '-'; |
1606 | login[0] = '-'; |
1597 | strcpy (&login[1], argv0); |
1607 | strcpy (&login[1], argv0); |
1598 | argv0 = login; |
1608 | argv0 = login; |
1599 | } |
1609 | } |
|
|
1610 | |
1600 | execlp (shell, argv0, NULL); |
1611 | execlp (shell, argv0, NULL); |
1601 | /* no error message: STDERR is closed! */ |
1612 | /* no error message: STDERR is closed! */ |
1602 | } |
1613 | } |
1603 | |
1614 | |
1604 | #else /* __QNX__ uses qnxspawn () */ |
1615 | #else /* __QNX__ uses qnxspawn () */ |