clean:
-rm -f fetchmail *.o core fetchmail.dvi \
rcfile_l.c rcfile_y.h rcfile_y.c fetchmail.tar fetchmail.tar.gz
+ -rm -f linetest[12]
distclean: clean
-rm -f Makefile config.h
configure: configure.in
autoconf $(ACFLAGS)
+config.h.in: acconfig.h
+ autoheader $(ACFLAGS)
+
# This tells versions [3.59,3.63) of GNU make not to export all variables.
.NOEXPORT:
fetchmail-$(VERS).tar.gz: fetchmail-$(VERS).tar
gzip -f fetchmail-$(VERS).tar
+# Test for stdio line-buffering lossage on sockets
+linetest1: socket.c
+ $(CC) -g -I. -DMAIN socket.c -o linetest1 # Use setlinebuf
+linetest2: socket.c
+ $(CC) -g -I. -DMAIN -D__SETVBUF_WORKS_OK__=1 socket.c -o linetest2 # Use setvnbuf
+
+
# The automatically generated dependencies below may omit config.h
# because it is included with ``#include <config.h>'' rather than
# ``#include "config.h"''. So we add the explicit dependency to make sure.
/* Define if you have GNU's getopt family of functions. */
#undef HAVE_GETOPTLONG
+/* Define if you have setlinebuf(3) */
+#undef HAVE_SETLINEBUF
+
\f
/* Leave that blank line there!! Autoheader needs it.
If you're adding to this file, keep in mind:
struct sockaddr_in ad;
struct hostent *hp;
FILE *fp;
- static char sbuf[INTERNAL_BUFSIZE];
memset(&ad, 0, sizeof(ad));
ad.sin_family = AF_INET;
}
fp = fdopen(sock, "r+");
-#ifdef FOO
+#ifdef __SETVBUF_WORKS_OK__
/*
- * For unknown reasons, this results in horrible lossage.
+ * For unknown reasons, this results in horrible lossage under Linux.
* To see this, condition in this line, generate a test pattern
* of 8K, fetch it, and watch it garble the test pattern.
- * I think there's a bug in stdio lurking here.
+ * I think there's a bug in Linux stdio lurking here.
*/
- setvbuf(fp, sbuf, _IOLBF, INTERNAL_BUFSIZE);
-#endif /* FOO */
+ {
+ static char sbuf[INTERNAL_BUFSIZE];
+ setvbuf(fp, sbuf, _IOLBF, INTERNAL_BUFSIZE);
+ }
+#endif /* __SETVBUF_WORKS_OK__ */
+
+#if !defined(__SETVBUF_WORKS_OK__) && defined(HAVE_SETLINEBUF)
+ /* this on the other hand works OK under Linux */
+ setlinebuf(fp);
+#endif
return(fp);
}
+#ifdef MAIN
+/*
+ * Use the chargen service to test buffering directly.
+ */
+main()
+{
+ FILE *fp = sockopen("localhost", 19);
+ char buf[80];
+
+ while (fgets(buf, sizeof(buf)-1, fp))
+ fputs(buf, stdout);
+}
+#endif /* MAIN */
+
/* socket.c ends here */