summaryrefslogtreecommitdiff
path: root/iperlsys.h
diff options
context:
space:
mode:
Diffstat (limited to 'iperlsys.h')
-rw-r--r--iperlsys.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/iperlsys.h b/iperlsys.h
index 6c093dd53f..237fab26d6 100644
--- a/iperlsys.h
+++ b/iperlsys.h
@@ -303,7 +303,17 @@ struct IPerlStdIOInfo
#define PerlSIO_fputs(f,s) fputs(s,f)
#define PerlSIO_fflush(f) Fflush(f)
#define PerlSIO_fgets(s, n, fp) fgets(s,n,fp)
-#define PerlSIO_ungetc(c,f) ungetc(c,f)
+#if defined(VMS) && defined(__DECC)
+ /* Unusual definition of ungetc() here to accomodate fast_sv_gets()'
+ * belief that it can mix getc/ungetc with reads from stdio buffer */
+ int decc$ungetc(int __c, FILE *__stream);
+# define PerlSIO_ungetc(c,f) ((c) == EOF ? EOF : \
+ ((*(f) && !((*(f))->_flag & _IONBF) && \
+ ((*(f))->_ptr > (*(f))->_base)) ? \
+ ((*(f))->_cnt++, *(--(*(f))->_ptr) = (c)) : decc$ungetc(c,f)))
+#else
+# define PerlSIO_ungetc(c,f) ungetc(c,f)
+#endif
#define PerlSIO_fileno(f) fileno(f)
#define PerlSIO_fdopen(f, s) fdopen(f,s)
#define PerlSIO_freopen(p, m, f) freopen(p,m,f)