File:  [DVB] / dietlibc / libstdio / ftell.c
Revision 1.7: download - view: text, annotated - select for diffs
Tue Jun 19 12:53:48 2012 UTC (11 years, 11 months ago) by leitner
Branches: MAIN
CVS tags: HEAD
try to accomodate current pedantic gnu configure scripts

#include <dietstdio.h>
#include <unistd.h>
#include <errno.h>

long ftell_unlocked(FILE *stream) {
  off_t l;
  if (stream->flags&1 || (l=lseek(stream->fd,0,SEEK_CUR))==-1) return -1;
  if (stream->flags&BUFINPUT)
    return l-(stream->bs-stream->bm)-stream->ungotten;
  else
    return l+stream->bm;
}

long ftell(FILE *stream) __attribute__((weak,alias("ftell_unlocked")));

LinuxTV legacy CVS <linuxtv.org/cvs>