/* If setvbuf has the reversed format, exit 0. */
#include <stdio.h>
int
main ()
{
  /* This call has the arguments reversed.
     A reversed system may check and see that the address of main
     is not _IOLBF, _IONBF, or _IOFBF, and return nonzero.  */

  if (setvbuf(stdout, _IOLBF, (char *)main, BUFSIZ) != 0)
    exit(1);
  putc('\r', stdout);
  exit(0);                      /* Non-reversed systems segv here.  */
}

/*
SETBUF(3)

int setvbuf(FILE *stream, char *buf, int mode , size_t size);

The  setvbuf  function  may  be  used on any open stream to change its buffer.  The mode parameter must be one of the following three macros:
        _IONBF unbuffered
        _IOLBF line buffered
        _IOFBF fully buffered

gcc     junk.c   -o junk

junk.c: In function `main':
junk.c:9: warning: passing arg 2 of `setvbuf' makes pointer from integer without a cast
junk.c:9: warning: passing arg 3 of `setvbuf' makes integer from pointer without a cast
/usr/lib/gcc-lib/sparc-unknown-linux-gnu/3.3.2/../../../../sparc-unknown-linux-gnu/bin/ld: BFD 2.14.90.0.7 20031029 assertion fail elf32-sparc.c:2444
/usr/lib/gcc-lib/sparc-unknown-linux-gnu/3.3.2/../../../../sparc-unknown-linux-gnu/bin/ld: BFD 2.14.90.0.7 20031029 assertion fail elf32-sparc.c:2444

*/

/*

IA-32 as well.

gcc     junk.c   -o junk
junk.c: In function `main':
junk.c:9: warning: passing arg 2 of `setvbuf' makes pointer from integer without a cast
junk.c:9: warning: passing arg 3 of `setvbuf' makes integer from pointer without a cast
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/../../../../i686-pc-linux-gnu/bin/ld: cannot open output file junk: Is a directory
collect2: ld returned 1 exit status
make: *** [junk] Error 1

*/

