summaryrefslogtreecommitdiff
path: root/missing
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-08-27 04:15:12 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-08-27 04:15:12 +0000
commitb15d33e108f8e402bcd60b6efafdb11089ceff09 (patch)
tree1df59a71875d216ad117f6cebe1d507e71952f3c /missing
parent707a0a946d55df772012b282c594df790371ec23 (diff)
snprintf.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'missing')
-rw-r--r--missing/snprintf.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/missing/snprintf.c b/missing/snprintf.c
index 68951c3d87..750372e6f7 100644
--- a/missing/snprintf.c
+++ b/missing/snprintf.c
@@ -59,24 +59,36 @@
#include <sys/types.h>
-
-# undef __P
+#undef __P
#if defined(__STDC__)
-# define __P(x) x
# include <stdarg.h>
# if !defined(__P)
# define __P(x) x
# endif
#else
-# undef __P
# define __P(x) ()
-# define const
+# if !defined(const)
+# define const
+# endif
# include <varargs.h>
#endif
#ifndef _BSD_VA_LIST_
#define _BSD_VA_LIST_ va_list
#endif
+#ifdef __STDC__
+# include <limits.h>
+#else
+# ifndef LONG_MAX
+# ifdef HAVE_LIMITS_H
+# include <limits.h>
+# else
+ /* assuming 32bit(2's compliment) long */
+# define LONG_MAX 2147483647
+# endif
+# endif
+#endif
+
#if defined(__hpux) && !defined(__GNUC__)
#define const
#endif
@@ -359,22 +371,13 @@ err:
#define u_short unsigned short
#define u_int unsigned int
-#if !defined(__CYGWIN32__) && (defined(__hpux) && !defined(__GNUC__))
+#if !defined(__CYGWIN32__) && defined(__hpux) && !defined(__GNUC__)
#include <stdlib.h>
#endif
#if defined(__hpux) && !defined(__GNUC__)
#include <string.h>
#endif
-#if defined(__STDC__)
-# include <stdarg.h>
-#else
-# include <varargs.h>
-# undef __P
-# define __P(x) ()
-#endif
-
-
/*
* Flush out all the vectors defined by the given uio,
* then reset it so that it can be reused.