#!/usr/bin/muawk

BEGIN	{
	n=split(arg,opts)	
	
	if (n==0) opt="-a";
	else
		opt=opts[1];

	if (opt=="-h" )
		{
		print "(rustic) wc --  Print the number of bytes, words, \
and lines in stdin"
		print "Usage: wc [-h|-l|-w|-c] (stdin only)"
		exit
		}
	}


	{c+=length($0)+1; w+=NF }

END	{
	if ( opt=="-a" ) print NR, w, c;
	if ( opt=="-l" ) print NR;
	if ( opt=="-c" ) print c;
	if ( opt=="-w" ) print w;
	}
