#!d:csh
# Csh 5.19 test script for head/tail
# if all numbers match what the script says they should be, you're ok.

head -5c headtail.c >len1
head +5c headtail.c >len2
head -1b headtail.c >len3
head +1b headtail.c >len4
head -5l headtail.c >lin5
head +5l headtail.c >lin6
tail +5c headtail.c >len7
tail -5c headtail.c >len8
tail +1b headtail.c >len9
tail -1b headtail.c >lena
tail +5l headtail.c >linb
tail -5l headtail.c >linc

set truelin @word( `lines headtail.c` 4 )
set truelen @word( `lsl headtail.c` 3 )

set alt1 @rpn( $truelen 5 - )
set alt2 @rpn( $truelen 512 - )
echo Either 5, 512, $alt1, or $alt2:
foreach log ( len? ) "echo $log: @word( `lsl $log` 3 )"
set alt2 @rpn( $truelin 5 - )
echo
echo Either 5 or $alt2:
foreach log ( lin? ) "echo $log: @word( `lines $log` 4 )"
