#! /bin/csh -f
# Last modified on Tue Aug 30 17:41:23 1988 by stolfi
#================================================
# Usage: winit [-size <lines> <cols>]
# Initializes TEm/TS window state as I like it:
#   Auto-Repeat
#   Large Font
#================================================
# Parse options
set lines = 55
set cols = 80
set font = '[?1003h'
set name = ""
while ("x$1" != "x")
  switch ("$1")
    case "-size":
      set lines = "$2"
      set cols = "$3"
      shift; shift; shift;
      breaksw
    case "-name":
      set name = "$2"
      shift; shift;
      breaksw
    case "-font":
      if ( "$2" = "large" ) then
        set font = '[?1003h'
      else if ( "$2" = "small" ) then
        set font = '[?1003l'
      else
        echo Invalid font "$2"
        exit(1)
      endif
      shift; shift;
      breaksw
    default:
      echo Unknown option "$1"
      exit(1)
  endsw
end
clear
# Select large font:
echo -n "$font"
# turn on auto-repeat:
echo -n '[?8h'
# set name:
if ( "x$name" == "x" ) then
  set dir = (`pwd`)
  set name = "$dir:t"
  if ( "x$dir" != "x$dir:h" ) then
    set dir = "$dir:h"
    set name = "$dir:t/$name"
    if ( "x$dir" != "x$dir:h" ) then
      set dir = "$dir:h"
      set name = "$dir:t/$name"
    endif
  endif
  if ( "x$MACHINETYPE" != "xff" ) then
    set name = "$MACHINE"': '"$name"
  endif
endif
settemname "$name"
# set color:
if ( "x$MACHINETYPE" == "xff" ) then
  settemcolor \
    -tkc 210 255 210 black \
    -tnc 190 220 190 black \
    -h     0 210   0 \
    -b white black
else
  settemcolor \
    -tkc 255 255 200 black \
    -tnc 235 235 150 black \
    -h   255 220   0 \
    -b white black
endif
# Resize
set noglob; eval `/proj/ultrix/bin/resize $lines $cols`; unset noglob
