File:  [DVB] / dietlibc / libstdio / ungetc.c
Revision 1.6: 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"

int ungetc_unlocked(int c, FILE *stream) {
  if (stream->ungotten || c<0 || c>255)
    return EOF;
  /* GNU configure configure wants us to differentiate between an ungetc
   * of the byte that was actually there ("backup ungetc") and a
   * different byte. Sigh. */
  if (stream->bm && stream->buf[stream->bm-1]==c) {
    --stream->bm;
  } else {
    stream->ungotten=1;
    stream->ungetbuf=(unsigned char)c;
  }
  stream->flags&=~(ERRORINDICATOR|EOFINDICATOR);
  return c;
}

int ungetc(int c, FILE *stream) __attribute__((weak,alias("ungetc_unlocked")));

LinuxTV legacy CVS <linuxtv.org/cvs>