Problem in getting screen size when 'rlogin' and 'telnet'

Problem in getting screen size when 'rlogin' and 'telnet'

Post by Vasanthakumar S. » Wed, 16 Mar 1994 02:36:46



Hi,
        I have a problem in getting screen size using "ioctl" function.

        The following program returns the correct screen size if the term is
by "rlogin" but does return an error if term is by "telnet".

#include<stdio.h>
#include<termios.h>
#include<unistd.h>
extern int errno;
main()
{
   struct winsize ws;

   if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) < 0)
        printf("%d is the errno\n", errno);

   printf("%d is the width\n", ws.ws_col);
   printf("%d is the length\n", ws.ws_row);

Quote:}

The output for the above program from an "rlogin" window is
90 is the width
58 is the length

The output from a "telnet" window is
22 is the errno
0 is the width
0 is the length

Could anybody educate me regarding this?

        Also "stty" behaves differently from "rlogin" window and from a "telnet"
window.
        The command "stty rows 24" works Okay on an "rlogin" terminal
but, on a "telnet" terminal it gives the following error:
        unknown mode: rows

Could anybody help me in this regard? Please send me email.

Thanks

vasant

 
 
 

Problem in getting screen size when 'rlogin' and 'telnet'

Post by R. Stewart Ell » Wed, 16 Mar 1994 11:02:15



 >Hi,
 >   I have a problem in getting screen size using "ioctl" function.

 >   The following program returns the correct screen size if the term is
 >by "rlogin" but does return an error if term is by "telnet".

[...]

 >The output for the above program from an "rlogin" window is
 >90 is the width
 >58 is the length

 >The output from a "telnet" window is
 >22 is the errno
 >0 is the width
 >0 is the length

 >Could anybody educate me regarding this?

 >   Also "stty" behaves differently from "rlogin" window and from a "telnet"
 >window.
 >   The command "stty rows 24" works Okay on an "rlogin" terminal
 >but, on a "telnet" terminal it gives the following error:
 >   unknown mode: rows

 >Could anybody help me in this regard? Please send me email.

 >Thanks

 >vasant

If you are only trying to get the size set, look at resize.  I use an
                  eval `/usr/openwin/bin/resize`
call at the end of my .cshrc, only if the session is interactive.

--
  R.Stewart(Stew) Ellis, Assoc.Prof., (Off)313-762-9765   ___________________
  Humanities & Social Science,  GMI Eng.& Mgmt. Inst.    /   _____  ______

  Gopher,News and  modem   maintainer, all around hack /________/ /  /  / /

 
 
 

1. My linux refuses 'rlogin' 'telnet' what is the problem??

Hi,

I upgraded my Linux to the latest Debian and suddenly
my rlogin and telnet give errors saying, connection
refused.

Can anybody tell me what happens when you try to
connect to a Linux with rlogin, telnet?

What config, or program do I have to look at?

Thanks,

J
--
#_________________________________________________________________________
# Name          : Jong

# Perl/Tk       :  http://w4.lns.cornell.edu/~pvhp/ptk/ptkPORT.html
# Perl/OpenGL   :  http://www.arc.ab.ca/vr/opengl/
# Perl          :  http://www.perl.com/perl/index.html
# Perl Win32    :  http://www.perl.hip.com/
# Debian Linux  :  http://www.debian.org/
# Biomatics Lab :  http://sonja.acad.cai.cam.ac.uk/
#
# PERL         : Also stands for Protein Engineering Research Language
# Linux        : Also stands for Leading Inter Net UniX
#-------------------------------------------------------------------------

2. HP8210e CD Writer

3. 'w' shows '-' if telnet or rlogin to linux box

4. Network problems

5. Will changing IP address affect 'rlogin'/'telnet'?

6. user account restriction

7. 'ping' sees route but 'telnet' doesn't??

8. /dev/audio error

9. What's 'side effects' of Ksh built-ins?

10. 'screen -x' problem '... on another display'

11. 'su' and 'rlogin' wierdness under 2.6 ...

12. Simple 'sed', 'awk', 'cut' problem

13. Help: problems with 'w', 'who' and 'last'