#!/bin/sh

# cat a load of files giving their names. Probably want to pipe output of this
# into $PAGER but I'll let the user do this.
#
# Iain Murray 2005

# Simple but effective!
# head -c -0 "$@"
# But not accepted by all versions of head. And I want to list name even if only
# pass one file.

# My first version:

# Construct a horizontal rule the width of the terminal
# This seems to cause less to hang:
#eval `resize | sed /export/d`
# Whereas this doesn't --- Huh?
COLUMNS=`tput cols`
BAR=`printf '%'$COLUMNS's' | sed 's/ /-/g'`

for a in "$@" ; do
	#echo $BAR
	echo "$a"
	echo $BAR
	cat "$a"
	#fmt -s -w $COLUMNS "$a"
	#echo $BAR
	echo
done
