This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: terminal size problems


Hi, a few weeks ago I reported a problem with rlogin not transmitting
the correct window size when run from cygwin.  The fact that there was
no problem with telnet gnawed at me, so I investigated the code
differences and found that rlogin.c from the gnu inetutils distribution
(e.g. 1.4.2) has flawed support for TIOCGWINSZ and SIGWINCH.  I also
discovered that clients such as vim, mutt, etc. differ widely in their
sophistication in supporting TIOCGWINSZ and SIGWINCH ... e.g. mutt
must be compiled with ncurses, vim does not.

Anyway, here is my context diff for getting rlogin.c in the
inetutils-1.4.2 distribution to support TIOCGWINSZ and SIGWINCH
under cygwin; the changes are #if'ed out so to activate them compile
with -DWINSZ_HACK.  Also, since I couldn't figure out how to get a
root account working under cygwin, I #if'ed out the geteuid() call;
compile with -DNO_GETEUID to use.

Regards,

-Harold


*** rlogin.c	Thu Feb 26 18:55:58 2004
--- rlogin.c.new	Thu Feb 26 19:03:22 2004
***************
*** 325,332 ****
--- 325,334 ----
      usage (1);
  
    /* We must be uid root to access rcmd().  */
+ #ifndef NO_GETEUID
    if (geteuid ())
      errx (1, "must be setuid root.\n");
+ #endif
  
    /* Get the name of the user invoking us: the client-user-name.  */
    if (!(pw = getpwuid (uid = getuid ())))
***************
*** 406,411 ****
--- 408,417 ----
    setsig (SIGURG, copytochild);
    setsig (SIGUSR1, writeroob);
  
+ #ifdef WINSZ_HACK
+   setsig (SIGWINCH, sigwinch);
+ #endif
+ 
  #ifdef KERBEROS
   try_connect:
    if (use_kerberos)
***************
*** 683,689 ****
--- 689,699 ----
    exit (status);
  }
  
+ #ifdef WINSZ_HACK
+ int dosigwinch=1;
+ #else
  int dosigwinch;
+ #endif
  
  /*
   * This is called when the reader process gets the out-of-band (urgent)
***************
*** 732,737 ****
--- 742,751 ----
    register int bol, local, n;
    char c;
  
+ #ifdef WINSZ_HACK
+   sendwindow();
+ #endif
+ 
    bol = 1;			/* beginning of line */
    local = 0;
    for (;;)
***************
*** 944,949 ****
--- 958,966 ----
      {
        /* Let server know about window size changes */
        kill (ppid, SIGUSR1);
+ #ifdef WINSZ_HACK
+       sigwinch(0);
+ #endif
      }
    if (!eight && (mark & TIOCPKT_NOSTOP))
      {

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]