Diff for /gforth/termsize.fs between versions 1.1 and 1.4

version 1.1, 1996/01/07 17:22:16 version 1.4, 1998/12/08 22:02:52
Line 1 Line 1
 \ terminal size stuff  \ terminal size stuff
   
 \ Copyright (C) 1996 Free Software Foundation, Inc.  \ Copyright (C) 1996,1997 Free Software Foundation, Inc.
   
 \ This file is part of Gforth.  \ This file is part of Gforth.
   
Line 18 Line 18
 \ along with this program; if not, write to the Free Software  \ along with this program; if not, write to the Free Software
 \ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  \ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   
   
 \ Currently we get the size from the environment. If the variables  
 \ LINES and COLUMNS are not set or wrong, do an "eval `resize`" before  
 \ starting Gforth. If you change the window size after starting  
 \ Gforth, you are out of luck.  
   
 \ To do: An implementation that uses termcap and/or ioctl TIOCGWINSZ.  
   
 \ # rows and columns that the terminal has.  \ # rows and columns that the terminal has.
 \ these words are also present in PFE.  \ these words are also present in PFE.
 &80 Value cols  
 &24 Value rows  
   
 : getenv-unum ( udefault c-addr ucount -- u )  [IFUNDEF] form : form &24 &80 ; [THEN]
     getenv over  
     IF  [IFUNDEF] rows
         0. 2swap >number 0=  : rows ( -- u )
         IF ( udefault d c-addr2 )      form drop ;
             drop drop nip  
         ELSE ( udefault djunk c-addr2 )  : cols ( -- u )
             drop 2drop      form nip ;
         ENDIF  [THEN]
     ELSE ( udefault c-addr ucount )  
         2drop  
     ENDIF ;  
   
 :noname ( -- )  
     defers 'cold  
     cols s" COLUMNS" getenv-unum TO cols  
     rows s" LINES" getenv-unum TO rows ;  
 IS 'cold  

Removed from v.1.1  
changed lines
  Added in v.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>