/* fileleng.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */

#include <unistd.h>

long filelength (int handle)
{
  long cur, n;

  cur = lseek (handle, 0L, SEEK_CUR);
  if (cur == -1L)
    return -1;
  n = lseek (handle, 0L, SEEK_END);
  lseek (handle, cur, SEEK_SET);
  return n;
}
