Professional Web Applications Themes

determining rows x columns on ttyS0 console - Linux Setup, Configuration & Administration

I am running getty from /dev/ttyS0, giving me a login on the console. When I try to determine the current screen size, I get 0x0. This seems to be true for stty -a or ioctl(fd,TIOCGWINSZ,...) Is there any way to determine the true screen size? Thanks, David...

  1. #1

    Default determining rows x columns on ttyS0 console

    I am running getty from /dev/ttyS0, giving me a login on the console.
    When I try to determine the current screen size, I get 0x0. This
    seems to be true for
    stty -a
    or
    ioctl(fd,TIOCGWINSZ,...)

    Is there any way to determine the true screen size?

    Thanks,
    David
    David Guest

  2. #2

    Default Re: determining rows x columns on ttyS0 console

    Hi,
     
     

    Not thru the device itself, since it is not the device that restricts
    the screen size, but the terminal on the other end. The best way to
    get this kind of information is thru the libncurses library which will
    use an apropriate terminal protocol (e.g. VT100) to read the screen
    size from the terminal. For exampe:

    void CmdLinePr::GetWidth(void)
    {
    #if HAVE_GETENV
    const char *colwidth;
    char *endptr;
    long value;
    //
    // Evaluate the COLUMNS environment variable and suppose this
    // is the width of the terminal in characters.
    colwidth = getenv("COLUMNS");
    if (colwidth) {
    value = strtol(colwidth,&endptr,10);
    // Check whether this value is legal.
    if (*endptr == '\0' && value >= 10 && value <= 512) {
    // Seems reasonable
    Columns = value;
    return;
    }
    }
    #endif
    //
    // Set this to the default.
    Columns = 80;
    //
    #if USE_CURSES && HAVE_NEWTERM && HAS_COLS && HAVE_ISATTY
    if (isatty(1)) {
    SCREEN *s = newterm(NULL,stdout,stdin);
    if (s) {
    if (COLS >= 10 && COLS <= 512) {
    Columns = COLS;
    }
    endwin();
    delscreen(s);
    }
    }
    #endif
    }

    See ncurses.h, curses.h or newterm(3NCURSES).

    So long,
    Thomas
    Thomas Guest

  3. #3

    Default Re: determining rows x columns on ttyS0 console

    Thomas Richter <math.tu-berlin.de> wrote in message news:<bq1s79$4v2$zrz.TU-Berlin.DE>... 

    >
    > Not thru the device itself, since it is not the device that restricts
    > the screen size, but the terminal on the other end. The best way to
    > get this kind of information is thru the libncurses library which will
    > use an apropriate terminal protocol (e.g. VT100) to read the screen
    > size from the terminal. For exampe:[/ref]

    Thanks for the example. Unfortunately, I do not have curses or ncurses
    available in my environment. I'm actually looking for the low-level
    way to do it using the terminal protocol. I'd like to be able to do
    it for vt100, xterm and ansi.

    Thanks,
    David
    David Guest

Similar Threads

  1. Add/Delete rows/columns in datagrid
    By Peepio in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: August 24th, 10:22 AM
  2. datagrid sort columns not rows
    By Mgala in forum Macromedia Flash Data Integration
    Replies: 2
    Last Post: September 23rd, 10:06 AM
  3. Span rows/columns?
    By Eagle in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: May 18th, 09:11 PM
  4. DataGrid, 7 columns on 2 rows?
    By Chris Podmore in forum ASP.NET Data Grid Control
    Replies: 5
    Last Post: April 9th, 01:00 AM
  5. Inverting DataGrid columns and rows in excel
    By Jack Mullins in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: December 2nd, 02:16 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139