* See the file "LICENSE.TERMS" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * $Id: fcgiapp.h,v 1.10 2001/09/14 19:43:31 robs Exp $
+ * $Id: fcgiapp.h,v 1.11 2001/11/17 03:58:30 robs Exp $
*/
#ifndef _FCGIAPP_H
#include <varargs.h>
#endif
+#ifndef DLLAPI\r
+#ifdef _WIN32\r
+#define DLLAPI __declspec(dllimport)\r
+#else\r
+#define DLLAPI\r
+#endif\r
+#endif\r
+\r
#if defined (c_plusplus) || defined (__cplusplus)
extern "C" {
#endif
-#ifndef DLLAPI
-#ifdef _WIN32
-#define DLLAPI __declspec(dllimport)
-#else
-#define DLLAPI
-#endif
-#endif
-
/*
* Error codes. Assigned to avoid conflict with EOF and errno(2).
*/
/*
*----------------------------------------------------------------------
*
+ * FCGX_Peek --
+ *
+ * Return the next byte without removing it from the stream.
+ *
+ * Results:
+ * The byte, or EOF if the end of input has been reached.
+ *
+ *----------------------------------------------------------------------
+ */
+DLLAPI int FCGX_Peek(FCGX_Stream * stream);\r
+
+/*
+ *----------------------------------------------------------------------
+ *
* FCGX_GetChar --
*
* Reads a byte from the input stream and returns it.
*
*/
#ifndef lint
-static const char rcsid[] = "$Id: fcgiapp.c,v 1.30 2001/09/14 19:43:26 robs Exp $";
+static const char rcsid[] = "$Id: fcgiapp.c,v 1.31 2001/11/17 03:58:31 robs Exp $";
#endif /* not lint */
#include <assert.h>
return newString;
}
+int FCGX_Peek(FCGX_Stream * stream)\r
+{\r
+ if (stream->rdNext != stream->stop)
+ return *stream->rdNext;\r
+ if (stream->isClosed || ! stream->isReader) return EOF;\r
+
+ stream->fillBuffProc(stream);
+ stream->stopUnget = stream->rdNext;\r
+
+ if (stream->rdNext != stream->stop)
+ return *stream->rdNext;\r
+
+ ASSERT(stream->isClosed); /* bug in fillBufProc if not */
+ return EOF;
+}
+\r
/*
*----------------------------------------------------------------------
*
*/
int FCGX_GetChar(FCGX_Stream *stream)
{
- if(stream->rdNext != stream->stop)
- return *stream->rdNext++;
- if(stream->isClosed || !stream->isReader)
- return EOF;
- stream->fillBuffProc(stream);
- stream->stopUnget = stream->rdNext;
- if(stream->rdNext != stream->stop)
- return *stream->rdNext++;
- ASSERT(stream->isClosed); /* bug in fillBufProc if not */
- return EOF;
+ int rv = FCGX_Peek(stream);\r
+ if (rv != EOF) ++stream->rdNext;\r
+ return rv;\r
}
/*