if test $# -eq 0
then
        echo "\n   nexts converts AIFF sound files into NEXT sound files"\
                "\n   using sfconvert. The source is saved.\n\n\
        \nUsage: \n\n\tnexts [.aiff sound file(s)]\n\n"
else
   while test $# -gt 0
   do
	aifftest=`sfinfo $1 | grep "File Format" | awk '{print $7}'`

        if test $aifftest != "(aiff)"
        then
		if test ! -s $1
		then
			notfound="$notfound $1"
			echo $1 is not a file!
		else
			echo $1 is not an .aiff file!
		fi
		noconvert="$noconvert $1"

        elif test -s $1
	then
		newname=`echo $1 | sed s/.aiff//g`
		newname="$newname".snd
		echo CONVERTING...............................................
                sfconvert $1 $newname format next integer 16 2
		
		if test -r $newname
		then
   		    echo ................SUCCESS!
		    convert="$convert $newname"
		else
		    echo .............FIXING FILE...................
		    fixaiff $1
		    echo ............TRY AGAIN ...................
		    sfconvert $1 $newname format next integer 16 2
		    if test -r $newname
		    then
			echo ................SUCCESS!
			convert="$convert $newname"
		    else
			echo "I'M HAVING REAL PROBLEMS CONVERTING $1. BYE."
			problemconvert="$problemconvert $1"
		    fi
		fi
   		echo ......................................................DONE!


	else
		notfound="$notfound $1"
        fi
        shift
   done

   if test -n "$convert"
   then echo "\n*******NEW CONVERTED FILES*******:\n\t $convert"
   fi
   if test -n "$noconvert"
   then echo "\n(((((((NON AIFF FILES)))))))) (No action taken):\n\t $noconvert"
   fi
   if test -n "$notfound"
   then echo "\n???????FILES NOT FOUND????????:\n\t $notfound"
   fi
   if test -n "$problemconvert"
   then echo "\n!!!!!!!!! PROBLEM FILES !!!!!!!!!(No action taken):\n\t $problemconvert"
   fi
echo ""
fi
