/*----------------------------------------------------------------------
    Truncate a file to a specified length.  SCO doesn't have this
    function.  This comes close.  It isn't very important, and we
    can't help anyway if we don't have a real truncate.
  ----------------------------------------------------------------------*/

truncate(path, length)
char *path;
off_t length;
{
        FILE *temp;
	int retval;

        if((temp=fopen(path, "r"))==NULL)
                return -1;
        retval = chsize(fileno(temp), length);
	fclose(temp);
	return retval;
}
