#!/bin/csh -f
#
# csh - script longlines
# Usage: longlines [-w width] [file(s)]
  if ($HOST != sun1) then
	set path=(~/bin/redhat $path)
  endif
  set width = 80                  # default
 
  if ($#argv > 0) then
    if ("$argv[1]" == '-w') then
      shift
      if ($#argv > 0) then
        set a = $argv[1]
        if ($a !~ [0-9]* || $a == 0 || $a > 999) then
          echo2 $0\: Bad width argument $a
          exit 1
        else
          set width = $a
          shift
        endif
      else
        echo2 $0\: Missing width argument
        exit 2
      endif
    endif
  endif
 
  if ($#argv > 0) then
       foreach file ($argv[*])
          if (-f $file) then
              echo $file
              awk "length > $width" $file
              echo ""
          else
                echo2 $0\: Not an ASCII-file $file
          endif
       end
  else
       awk "length > $width"           # standard input
  endif
  exit 0
