~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to lib/fpurge.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Flushing buffers of a FILE stream.
2
 
   Copyright (C) 2007-2011 Free Software Foundation, Inc.
 
2
   Copyright (C) 2007-2012 Free Software Foundation, Inc.
3
3
 
4
4
   This program is free software: you can redistribute it and/or modify
5
5
   it under the terms of the GNU General Public License as published by
29
29
int
30
30
fpurge (FILE *fp)
31
31
{
32
 
#if HAVE___FPURGE                   /* glibc >= 2.2, Haiku, Solaris >= 7 */
 
32
#if HAVE___FPURGE                   /* glibc >= 2.2, Haiku, Solaris >= 7, musl libc */
33
33
 
34
34
  __fpurge (fp);
35
35
  /* The __fpurge function does not have a return value.  */
36
36
  return 0;
37
37
 
38
 
#elif HAVE_FPURGE                   /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin 1.7 */
 
38
#elif HAVE_FPURGE                   /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin 1.7 */
39
39
 
40
40
  /* Call the system's fpurge function.  */
41
41
# undef fpurge
43
43
  extern int fpurge (FILE *);
44
44
# endif
45
45
  int result = fpurge (fp);
46
 
# if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
 
46
# if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
47
47
  if (result == 0)
48
48
    /* Correct the invariants that fpurge broke.
49
49
       <stdio.h> on BSD systems says:
71
71
      fp->_IO_save_base = NULL;
72
72
    }
73
73
  return 0;
74
 
# elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
 
74
# elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
75
75
  fp_->_p = fp_->_bf._base;
76
76
  fp_->_r = 0;
77
77
  fp_->_w = ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
134
134
  /* Nothing in the buffer, next putc is nontrivial.  */
135
135
  fp->__put_limit = fp->__buffer;
136
136
  return 0;
 
137
# elif defined EPLAN9               /* Plan9 */
 
138
  fp->rp = fp->wp = fp->lp = fp->buf;
 
139
  return 0;
137
140
# else
138
141
#  error "Please port gnulib fpurge.c to your platform! Look at the definitions of fflush, setvbuf and ungetc on your system, then report this to bug-gnulib."
139
142
# endif