#!/bin/bash

function usage
{
    echo "Usage $0 <file name> <line> <context>"
    exit 1
}

code_file=$1
lineno=$2
context=$3

if [ "$lineno" = "" ] ; then
    usage
fi

if [ "$context" = "" ] ; then
    context=6
fi

cat -n $code_file | tail -n +$(($lineno - (($context + 1) / 2))) | head -n $(($context + 1))
