summaryrefslogtreecommitdiff
path: root/deb.c
diff options
context:
space:
mode:
authorLarry Wall <larry@netlabs.com>1994-03-18 00:00:00 +0000
committerLarry Wall <larry@netlabs.com>1994-03-18 00:00:00 +0000
commit8990e3071044a96302560bbdb5706f3e74cf1bef (patch)
tree6cf4a58108544204591f25bd2d4f1801d49334b4 /deb.c
parented6116ce9b9d13712ea252ee248b0400653db7f9 (diff)
downloadperl-8990e3071044a96302560bbdb5706f3e74cf1bef.tar.gz
perl 5.0 alpha 6
[editor's note: cleaned up from the September '94 InfoMagic CD, just like the last commit]
Diffstat (limited to 'deb.c')
-rw-r--r--deb.c53
1 files changed, 36 insertions, 17 deletions
diff --git a/deb.c b/deb.c
index 0af61104f9..d052db3feb 100644
--- a/deb.c
+++ b/deb.c
@@ -37,47 +37,66 @@
#include "EXTERN.h"
#include "perl.h"
-#ifdef I_VARARGS
-# include <varargs.h>
+#ifdef STANDARD_C
+# include <stdarg.h>
+#else
+# ifdef I_VARARGS
+# include <varargs.h>
+# endif
#endif
void deb_growlevel();
-# ifndef I_VARARGS
+#if !defined(STANDARD_C) && !defined(I_VARARGS)
+
+/*
+ * Fallback on the old hackers way of doing varargs
+ */
+
/*VARARGS1*/
-void deb(pat,a1,a2,a3,a4,a5,a6,a7,a8)
-char *pat;
+void
+deb(pat,a1,a2,a3,a4,a5,a6,a7,a8)
+ char *pat;
{
register I32 i;
- fprintf(stderr,"%-4ld",(long)curop->cop_line);
+ fprintf(stderr,"(%s:%ld)\t",
+ SvPVX(GvSV(curcop->cop_filegv)),(long)curcop->cop_line);
for (i=0; i<dlevel; i++)
fprintf(stderr,"%c%c ",debname[i],debdelim[i]);
fprintf(stderr,pat,a1,a2,a3,a4,a5,a6,a7,a8);
}
+
+#else /* !defined(STANDARD_C) && !defined(I_VARARGS) */
+
+# ifdef STANDARD_C
+void
+deb(char *pat, ...)
# else
/*VARARGS1*/
-#ifdef __STDC__
-void deb(char *pat,...)
-#else
-void deb(va_alist)
-va_dcl
-#endif
+void
+deb(pat, va_alist)
+ char *pat;
+ va_dcl
+# endif
{
va_list args;
- char *pat;
register I32 i;
- va_start(args);
- fprintf(stderr,"%-4ld",(long)curcop->cop_line);
+ fprintf(stderr,"(%s:%ld)\t",
+ SvPVX(GvSV(curcop->cop_filegv)),(long)curcop->cop_line);
for (i=0; i<dlevel; i++)
fprintf(stderr,"%c%c ",debname[i],debdelim[i]);
- pat = va_arg(args, char *);
+# if STANDARD_C
+ va_start(args, pat);
+# else
+ va_start(args);
+# endif
(void) vfprintf(stderr,pat,args);
va_end( args );
}
-# endif
+#endif /* !defined(STANDARD_C) && !defined(I_VARARGS) */
void
deb_growlevel()