rxvt_term::init (int argc, const char *const *argv)
{
SET_R (this);
+ TEMP_ENV; // few things in X do not call setlocale :(
- const char **cmd_argv;
-
- {
- TEMP_ENV; // few things in X do not call setlocale :(
-
- set_locale ("");
+ set_locale ("");
- if (!init_vars ())
- return false;
+ if (!init_vars ())
+ return false;
- init_secondary ();
+ init_secondary ();
- cmd_argv = init_resources (argc, argv);
+ const char **cmd_argv = init_resources (argc, argv);
#ifdef KEYSYM_RESOURCE
- keyboard->register_done ();
+ keyboard->register_done ();
#endif
#if MENUBAR_MAX
- menubar_read (rs[Rs_menu]);
+ menubar_read (rs[Rs_menu]);
#endif
#ifdef HAVE_SCROLLBARS
- if (OPTION (Opt_scrollBar))
- scrollBar.setIdle (); /* set existence for size calculations */
+ if (OPTION (Opt_scrollBar))
+ scrollBar.setIdle (); /* set existence for size calculations */
#endif
- }
#if ENABLE_PERL
if (!rs[Rs_perl_ext_1])
}
#endif
rxvt_perl.init ();
- setlocale (LC_CTYPE, curlocale); // perl destroys this info
+ setlocale (LC_CTYPE, curlocale); // perl init destroys this info
HOOK_INVOKE ((this, HOOK_INIT, DT_END));
}
#endif
- {
- TEMP_ENV;
-
- create_windows (argc, argv);
+ create_windows (argc, argv);
- dDisp;
+ dDisp;
- init_xlocale ();
+ init_xlocale ();
- scr_reset (); // initialize screen
+ scr_reset (); // initialize screen
#if 0
- XSynchronize (disp, True);
+ XSynchronize (disp, True);
#endif
#ifdef HAVE_SCROLLBARS
- if (OPTION (Opt_scrollBar))
- resize_scrollbar (); /* create and map scrollbar */
+ if (OPTION (Opt_scrollBar))
+ resize_scrollbar (); /* create and map scrollbar */
#endif
#if (MENUBAR_MAX)
- if (menubar_visible ())
- XMapWindow (disp, menuBar.win);
+ if (menubar_visible ())
+ XMapWindow (disp, menuBar.win);
#endif
#ifdef TRANSPARENT
- if (OPTION (Opt_transparent))
- {
- XSelectInput (disp, display->root, PropertyChangeMask);
- check_our_parents ();
- rootwin_ev.start (display, display->root);
- }
+ if (OPTION (Opt_transparent))
+ {
+ XSelectInput (disp, display->root, PropertyChangeMask);
+ check_our_parents ();
+ rootwin_ev.start (display, display->root);
+ }
#endif
- XMapWindow (disp, vt);
- XMapWindow (disp, parent[0]);
+ XMapWindow (disp, vt);
+ XMapWindow (disp, parent[0]);
- set_colorfgbg ();
+ set_colorfgbg ();
- init_command (cmd_argv);
+ init_command (cmd_argv);
- free (cmd_argv);
+ free (cmd_argv);
- if (pty.pty >= 0)
- pty_ev.start (pty.pty, EVENT_READ);
+ if (pty.pty >= 0)
+ pty_ev.start (pty.pty, EVENT_READ);
- check_ev.start ();
+ check_ev.start ();
- HOOK_INVOKE ((this, HOOK_START, DT_END));
- }
+ HOOK_INVOKE ((this, HOOK_START, DT_END));
return true;
}
}
} sig_handlers;
+char **rxvt_environ; // startup environment
+
void
rxvt_init ()
{
+ rxvt_environ = environ;
+
/*
* Save and then give up any super-user privileges
* If we need privileges in any area then we must specifically request it.
void rxvt_Draw_Triangle (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int type);
void rxvt_usleep (int usecs);
+/////////////////////////////////////////////////////////////////////////////
+
+// temporarily replace the process environment
+extern char **environ;
+extern char **rxvt_environ; // the original environ pointer
+
+struct temp_environ
+{
+ char **prev;
+
+ temp_environ (const stringvec *envv)
+ : prev(environ)
+ {
+ if (envv)
+ environ = (char **)envv->begin ();
+ }
+
+ temp_environ (char **env)
+ : prev(environ)
+ {
+ if (env)
+ environ = env;
+ }
+
+ ~temp_environ ()
+ {
+ environ = prev;
+ }
+};
+
+#define TEMP_ENV temp_environ temp_environ (envv)
+
/*
*****************************************************************************
* STRUCTURES AND TYPEDEFS
#define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth)
#define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight)
-#define TEMP_ENV temp_environ temp_environ (envv)
-
#define OPTION(opt) (options & (opt))
#define DEFAULT_OPTIONS (Opt_scrollBar | Opt_scrollTtyOutput \
| Opt_jumpScroll | Opt_secondaryScreen \