From: root Date: Tue, 17 Jan 2006 12:22:59 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=04949f7711f7e268223ca3f1e76bf463e93159b2;p=dana%2Furxvt.git *** empty log message *** --- diff --git a/configure b/configure index 5506a10b..6bfda158 100755 --- a/configure +++ b/configure @@ -1371,9 +1371,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + ac_config_headers="$ac_config_headers config.h:config.h.in" + ac_aux_dir= -for ac_dir in autoconf $srcdir/autoconf; do +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" @@ -1389,17 +1392,14 @@ for ac_dir in autoconf $srcdir/autoconf; do fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&2;} + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - ac_config_headers="$ac_config_headers config.h:autoconf/config.h.in" - - # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 @@ -10132,6 +10132,15 @@ _ACEOF +case "$host_alias" in + *ultrix) ac_cv_func_setsid='no' ;; + *) break;; +esac + + + + + @@ -10149,11 +10158,15 @@ _ACEOF for ac_func in \ + atexit \ revoke \ unsetenv \ setutent \ seteuid \ setreuid \ + setsid \ + setpgrp \ + setpgid \ _getpty \ getpt \ posix_openpt \ @@ -13518,7 +13531,7 @@ do "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/rxvtlib.h" ) CONFIG_FILES="$CONFIG_FILES src/rxvtlib.h" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:autoconf/config.h.in" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.h.in" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; diff --git a/src/command.C b/src/command.C index f0226d46..b303e893 100644 --- a/src/command.C +++ b/src/command.C @@ -1139,7 +1139,7 @@ rxvt_term::pty_fill () cmdbuf_ptr = cmdbuf_base; cmdbuf_endp = cmdbuf_ptr + n; - ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); + ssize_t r = read (pty->pty, cmdbuf_endp, CBUFSIZ - n); if (r > 0) { @@ -3971,7 +3971,7 @@ rxvt_term::process_xterm_seq (int op, const char *str, char resp) else { set_locale (str); - pty.set_utf8_mode (enc_utf8); + pty->set_utf8_mode (enc_utf8); init_xlocale (); } break; @@ -4413,12 +4413,12 @@ rxvt_term::tt_write (const char *data, unsigned int len) if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) return; - if (pty.pty < 0) + if (pty->pty < 0) return; if (v_buflen == 0) { - ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); + ssize_t written = write (pty->pty, data, min (len, MAX_PTY_WRITE)); if ((unsigned int)written == len) return; @@ -4437,7 +4437,7 @@ rxvt_term::tt_write (const char *data, unsigned int len) void rxvt_term::pty_write () { - int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); + int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); if (written > 0) { diff --git a/src/init.C b/src/init.C index 207dab16..adbc9805 100644 --- a/src/init.C +++ b/src/init.C @@ -1372,23 +1372,23 @@ rxvt_term::run_command (const char *const *argv) #if ENABLE_FRILLS if (rs[Rs_pty_fd]) { - pty.pty = atoi (rs[Rs_pty_fd]); + pty->pty = atoi (rs[Rs_pty_fd]); - if (pty.pty >= 0) + if (pty->pty >= 0) { if (getfd_hook) - pty.pty = (*getfd_hook) (pty.pty); + pty->pty = (*getfd_hook) (pty->pty); - if (pty.pty < 0 || fcntl (pty.pty, F_SETFL, O_NONBLOCK)) + if (pty->pty < 0 || fcntl (pty->pty, F_SETFL, O_NONBLOCK)) rxvt_fatal ("unusable pty-fd filehandle, aborting.\n"); } } else #endif - if (!pty.get ()) + if (!pty->get ()) rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); - pty.set_utf8_mode (enc_utf8); + pty->set_utf8_mode (enc_utf8); /* set initial window size */ tt_winch (); @@ -1422,20 +1422,20 @@ rxvt_term::run_command (const char *const *argv) case 0: init_env (); - if (!pty.make_controlling_tty ()) + if (!pty->make_controlling_tty ()) fprintf (stderr, "%s: could not obtain control of tty.", RESNAME); else { /* Reopen stdin, stdout and stderr over the tty file descriptor */ - dup2 (pty.tty, STDIN_FILENO); - dup2 (pty.tty, STDOUT_FILENO); - dup2 (pty.tty, STDERR_FILENO); + dup2 (pty->tty, STDIN_FILENO); + dup2 (pty->tty, STDOUT_FILENO); + dup2 (pty->tty, STDERR_FILENO); // close all our file handles that we do no longer need for (rxvt_term **t = termlist.begin (); t < termlist.end (); t++) { - if ((*t)->pty.pty > 2) close ((*t)->pty.pty); - if ((*t)->pty.tty > 2) close ((*t)->pty.tty); + if ((*t)->pty->pty > 2) close ((*t)->pty->pty); + if ((*t)->pty->tty > 2) close ((*t)->pty->tty); } run_child (argv); @@ -1450,7 +1450,7 @@ rxvt_term::run_command (const char *const *argv) int fdstdin; fdstdin = dup (STDIN_FILENO); - dup2 (pty.tty, STDIN_FILENO); + dup2 (pty->tty, STDIN_FILENO); #endif #ifdef UTMP_SUPPORT @@ -1464,7 +1464,7 @@ rxvt_term::run_command (const char *const *argv) #endif } - pty.close_tty (); /* keep STDERR_FILENO, pty.pty, display->fd () open */ + pty->close_tty (); break; } } diff --git a/src/main.C b/src/main.C index 9a488f2c..0bfadb68 100644 --- a/src/main.C +++ b/src/main.C @@ -215,7 +215,7 @@ void rxvt_term::emergency_cleanup () privileged_utmp (RESTORE); #endif - pty.put (); + delete pty; pty = 0; } rxvt_term::~rxvt_term () @@ -511,6 +511,8 @@ rxvt_term::init (int argc, const char *const *argv) } #endif + pty = rxvt_new_ptytty (); + create_windows (argc, argv); dDisp; @@ -545,8 +547,8 @@ rxvt_term::init (int argc, const char *const *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 (); @@ -725,9 +727,9 @@ rxvt_term::privileged_utmp (rxvt_privaction action) rxvt_privileges (RESTORE); if (action == SAVE) - pty.login (cmd_pid, OPTION (Opt_loginShell), rs[Rs_display_name]); + pty->login (cmd_pid, OPTION (Opt_loginShell), rs[Rs_display_name]); else - pty.logout (); + pty->logout (); rxvt_privileges (IGNORE); } @@ -875,7 +877,7 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) void rxvt_term::tt_winch () { - if (pty.pty < 0) + if (pty->pty < 0) return; struct winsize ws; @@ -884,7 +886,7 @@ rxvt_term::tt_winch () ws.ws_row = nrow; ws.ws_xpixel = width; ws.ws_ypixel = height; - (void)ioctl (pty.pty, TIOCSWINSZ, &ws); + (void)ioctl (pty->pty, TIOCSWINSZ, &ws); #if 0 // TIOCSWINSZ⎈ is supposed to do this automatically and correctly diff --git a/src/ptytty.C b/src/ptytty.C index d8fa3bd2..bab59bde 100644 --- a/src/ptytty.C +++ b/src/ptytty.C @@ -56,6 +56,8 @@ #include #include +#include "ptytty.h" + ///////////////////////////////////////////////////////////////////////////// /* ------------------------------------------------------------------------- * @@ -443,5 +445,11 @@ rxvt_ptytty_unix::get () return true; } +// a "factory" *g* +rxvt_ptytty *rxvt_new_ptytty () +{ + return new rxvt_ptytty_unix; +} + /*----------------------- end-of-file (C source) -----------------------*/ diff --git a/src/ptytty.h b/src/ptytty.h index 8bbbba3f..2605d2cc 100644 --- a/src/ptytty.h +++ b/src/ptytty.h @@ -1,6 +1,7 @@ #ifndef PTYTTY_H #define PTYTTY_H +#include "rxvt.h" #include "feature.h" #if defined(HAVE_GRANTPT) && defined(HAVE_UNLOCKPT) @@ -50,29 +51,6 @@ #endif -enum rxvt_privaction { IGNORE = 'i', SAVE = 's', RESTORE = 'r' }; - -struct rxvt_ptytty { - int pty; // pty file descriptor; connected to rxvt - int tty; // tty file descriptor; connected to child - - virtual ~rxvt_ptytty () - { - // - } - - virtual bool get () = 0; - virtual void put () = 0; - - virtual void login (int cmd_pid, bool login_shell, const char *hostname) = 0; - virtual void logout () = 0; - - void close_tty (); - - bool make_controlling_tty (); - void set_utf8_mode (bool on); -}; - struct rxvt_ptytty_unix : rxvt_ptytty { char *name; diff --git a/src/rxvt.h b/src/rxvt.h index 3d43eb0c..205d5c9f 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -96,6 +96,8 @@ typedef struct { # define STDERR_FILENO 2 #endif +enum rxvt_privaction { IGNORE = 'i', SAVE = 's', RESTORE = 'r' };//TODO + /* ***************************************************************************** * PROTOTYPES @@ -174,6 +176,30 @@ typedef struct { } bgPixmap_t; #endif +struct rxvt_ptytty { + int pty; // pty file descriptor; connected to rxvt + int tty; // tty file descriptor; connected to child + + virtual ~rxvt_ptytty () + { + // + } + + virtual bool get () = 0; + virtual void put () = 0; + + virtual void login (int cmd_pid, bool login_shell, const char *hostname) = 0; + virtual void logout () = 0; + + void close_tty (); + + bool make_controlling_tty (); + void set_utf8_mode (bool on); +}; + +// a "factory" *g* +rxvt_ptytty *rxvt_new_ptytty (); + /* * the 'essential' information for reporting Mouse Events * pared down from XButtonEvent @@ -1124,7 +1150,7 @@ struct rxvt_term : zero_initialized, rxvt_vars { char *cmdbuf_ptr, *cmdbuf_endp; char cmdbuf_base[CBUFSIZ]; - rxvt_ptytty_unix pty; + rxvt_ptytty *pty; rxvt_salloc *talloc; // text line allocator rxvt_salloc *ralloc; // rend line allocator diff --git a/src/rxvtlib.h.in b/src/rxvtlib.h.in index 0a8bd7ff..6e8db268 100644 --- a/src/rxvtlib.h.in +++ b/src/rxvtlib.h.in @@ -30,8 +30,6 @@ // stdlib.h might provide it #endif -#include "ptytty.h" - extern "C" { #include /* Xlib, Xutil, Xresource, Xfuncproto */ }