#!/bin/csh
# @(#)scrline 1.2 91/09/13
#
# script to find specific line numbers in an automation .Scr file
# (useful for debugging given lex/yacc line number parser errors)
#
set argcnt = $#argv
if ($argcnt < 2) then
echo "usage: scrline ErrorLineNumber TestName[.Scr]"
exit 0
endif
@ errorline = $argv[1]
@ startline = $errorline - 2
@ endline = $errorline + 2
set testfile = $argv[2]
if !(-e ${testfile}.Scr) then
if !(-e ${testfile}) then
echo "'${testfile}' file not found."
exit 0
else
set TestFile = ${testfile}
endif
else
set TestFile = ${testfile}.Scr
endif
cat $TestFile | awk 'BEGIN{FS="\n"} ($1 !~ /#.*/) && ($1 !~ /^$/) {n++; if (n >= '"$startline"' && n <= '"$endline"') printf("%d %s\n", n, $1)}'