From b965fc04aab9a9ae48565588fa28392144c54e11 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 22 Jan 2006 00:36:59 +0000 Subject: [PATCH] *** empty log message *** --- Changes | 1 + src/logging.C | 5 +++++ src/main.C | 4 +++- src/ptytty.h | 3 ++- src/rxvt.C | 12 +++++++++++- src/rxvt.h | 12 +++++++++--- src/rxvtd.C | 8 +++----- src/rxvtperl.xs | 16 ++++++++-------- src/rxvtutil.h | 3 ++- 9 files changed, 44 insertions(+), 20 deletions(-) diff --git a/Changes b/Changes index 8da8ab53..6ebdf06a 100644 --- a/Changes +++ b/Changes @@ -17,6 +17,7 @@ WISH: just for fun, do shade and tint with XRender. DUMB: support tex fonts 7.2 +TODO: alsamixer/wild resize => secondary leaks into primary scrollback? - bugfix: urxvt (not urxvtd) did not correctly handle multiple environments necessary, which resulted in segfaults within getenv (reproducable: urxvt -fn 9x15, open a menu once, diff --git a/src/logging.C b/src/logging.C index 94fdee65..465e3be1 100644 --- a/src/logging.C +++ b/src/logging.C @@ -449,4 +449,9 @@ rxvt_update_lastlog (const char *fname, const char *pty, const char *host) #endif /* LASTLOG_SUPPORT */ /* ------------------------------------------------------------------------- */ +#else +void +rxvt_ptytty_unix::login (int cmd_pid, bool login_shell, const char *hostname) +{ +} #endif /* UTMP_SUPPORT */ diff --git a/src/main.C b/src/main.C index 8290a328..b2203d21 100644 --- a/src/main.C +++ b/src/main.C @@ -452,8 +452,10 @@ rxvt_xioerror_handler (Display *display) /*----------------------------------------------------------------------*/ bool -rxvt_term::init (int argc, const char *const *argv) +rxvt_term::init (int argc, const char *const *argv, stringvec *envv) { + this->envv = envv; + SET_R (this); set_locale (""); set_environ (envv); // few things in X do not call setlocale :( diff --git a/src/ptytty.h b/src/ptytty.h index 4025a8e7..0b762501 100644 --- a/src/ptytty.h +++ b/src/ptytty.h @@ -58,6 +58,8 @@ public: bool get (); void put (); + void login (int cmd_pid, bool login_shell, const char *hostname); + #if UTMP_SUPPORT int utmp_pos; int cmd_pid; @@ -73,7 +75,6 @@ public: char ut_id[5]; #endif - void login (int cmd_pid, bool login_shell, const char *hostname); void logout (); #endif }; diff --git a/src/rxvt.C b/src/rxvt.C index 617c7c8e..9d4b829a 100644 --- a/src/rxvt.C +++ b/src/rxvt.C @@ -23,15 +23,25 @@ #include "../config.h" #include "rxvt.h" +#include +#include + int main (int argc, const char *const *argv) try { rxvt_init (); + stringvec *envv = new stringvec; + + for (char **var = environ; *var; var++) + envv->push_back (strdup (*var)); + + envv->push_back (0); + rxvt_term *t = new rxvt_term; - if (!t->init (argc, argv)) + if (!t->init (argc, argv, envv)) return EXIT_FAILURE; io_manager::loop (); diff --git a/src/rxvt.h b/src/rxvt.h index 963456f6..708779ff 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -143,6 +143,7 @@ char * rxvt_wcstombs (const wchar_t *str, int len = wchar_t * rxvt_mbstowcs (const char *str, int len = -1); char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); wchar_t * rxvt_utf8towcs (const char *str, int len = -1); +char * rxvt_strdup_cpp (const char *str); #define rxvt_strdup(s) ((s) ? strdup(s) : 0) @@ -216,9 +217,7 @@ struct rxvt_ptytty { } virtual bool get () = 0; -#if UTMP_SUPPORT virtual void login (int cmd_pid, bool login_shell, const char *hostname) = 0; -#endif void close_tty (); bool make_controlling_tty (); @@ -1239,7 +1238,14 @@ struct rxvt_term : zero_initialized, rxvt_vars { void destroy (); void emergency_cleanup (); - bool init (int argc, const char *const *argv); + bool init (int argc, const char *const *argv, stringvec *envv); + + bool init (stringvec *argv, stringvec *envv) + { + this->argv = argv; + return init (argv->size (), argv->begin (), envv); + } + bool init_vars (); bool pty_fill (); diff --git a/src/rxvtd.C b/src/rxvtd.C index f55ce910..4758132d 100644 --- a/src/rxvtd.C +++ b/src/rxvtd.C @@ -168,7 +168,7 @@ void server::read_cb (io_watcher &w, short revents) if (!strcmp (tok, "END")) break; else if (!strcmp (tok, "ENV") && recv (tok)) - envv->push_back (tok.get ()); + envv->push_back (strdup (tok)); else if (!strcmp (tok, "CWD") && recv (tok)) { if (chdir (tok)) @@ -176,7 +176,7 @@ void server::read_cb (io_watcher &w, short revents) (char *)tok, strerror (errno)); } else if (!strcmp (tok, "ARG") && recv (tok)) - argv->push_back (tok.get ()); + argv->push_back (strdup (tok)); else return err ("protocol error: unexpected NEW token"); } @@ -188,14 +188,12 @@ void server::read_cb (io_watcher &w, short revents) term->log_hook = &log_cb; term->getfd_hook = &getfd_cb; - term->argv = argv; - term->envv = envv; bool success; try { - success = term->init (argv->size (), argv->begin ()); + success = term->init (argv, envv); } catch (const class rxvt_failure_exception &e) { diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs index 64ffdb82..6a324935 100644 --- a/src/rxvtperl.xs +++ b/src/rxvtperl.xs @@ -930,23 +930,23 @@ _new (...) rxvt_term *term = new rxvt_term; - term->argv = new stringvec; - term->envv = new stringvec; + stringvec *argv = new stringvec; + stringvec *envv = new stringvec; for (int i = 1; i < items; i++) - term->argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); + argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); - AV *envv = (AV *)SvRV (ST (0)); - for (int i = AvFILL (envv) + 1; i--; ) - term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1)))); + AV *env = (AV *)SvRV (ST (0)); + for (int i = AvFILL (env) + 1; i--; ) + envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1)))); - term->envv->push_back (0); + envv->push_back (0); bool success; try { - success = term->init (term->argv->size (), term->argv->begin ()); + success = term->init (argv, envv); } catch (const class rxvt_failure_exception &e) { diff --git a/src/rxvtutil.h b/src/rxvtutil.h index a16a4b28..2e62cc36 100644 --- a/src/rxvtutil.h +++ b/src/rxvtutil.h @@ -1,6 +1,7 @@ #ifndef RXVT_UTIL_H #define RXVT_UTIL_H +#include #include #define PP_CONCAT_(a, b) a ## b @@ -393,7 +394,7 @@ struct stringvec : simplevec ~stringvec () { for (char **c = begin (); c != end (); c++) - delete [] *c; + free (*c); } }; -- 2.34.1