Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-08-02 07:42:31 +0400
committerChristopher Faylor <me@cgf.cx>2000-08-02 07:42:31 +0400
commita5a965ff62d95b01858f24d8e89c1dc39bbfb298 (patch)
tree97b94b0a33ffbefa30ef1073251dcdf0af9876d4 /winsup/cygwin/strace.cc
parent749d9bcd4b38c921930a9ce51bea2a8df0edf940 (diff)
* strace.h: Add kludgy workarounds to avoid using deprecated methods for
variable argument macros when possible. * sigproc.cc: Throughout, use sigproc_printf rather than sip_printf. * strace.cc (strace::prntf): Remove 'active' check, since callers are supposed to ensure this. (__system_printf): Remove. Subsumed by strace::prntf. * winsup.h: Define "NEW_MACRO_VARARGS" to indicate when to use new macro varargs capability.
Diffstat (limited to 'winsup/cygwin/strace.cc')
-rw-r--r--winsup/cygwin/strace.cc64
1 files changed, 19 insertions, 45 deletions
diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc
index c6656f9f0..a23ab5023 100644
--- a/winsup/cygwin/strace.cc
+++ b/winsup/cygwin/strace.cc
@@ -17,7 +17,6 @@ details. */
#define PROTECT(x) x[sizeof(x)-1] = 0
#define CHECK(x) if (x[sizeof(x)-1] != 0) { small_printf("array bound exceeded %d\n", __LINE__); ExitProcess(1); }
-
class strace NO_COPY strace;
/* 'twould be nice to declare this in winsup.h but winsup.h doesn't require
@@ -141,24 +140,30 @@ strace::write (unsigned category, const char *buf, int count)
Warning: DO NOT SET ERRNO HERE! */
void
-strace::prntf (unsigned category, const char *fmt,...)
+strace::prntf (unsigned category, const char *fmt, ...)
{
DWORD err = GetLastError ();
- if (active)
- {
- int count;
- va_list ap;
- char buf[10000];
+ int count;
+ char buf[10000];
+ va_list ap;
- PROTECT(buf);
- va_start (ap, fmt);
- SetLastError (err);
- count = this->vsprntf (buf, fmt, ap);
- va_end (ap);
- CHECK(buf);
+ PROTECT(buf);
+ SetLastError (err);
- this->write (category, buf, count);
+ va_start (ap, fmt);
+ count = this->vsprntf (buf, fmt, ap);
+ CHECK(buf);
+ if (category & _STRACE_SYSTEM)
+ {
+ DWORD done;
+ WriteFile (GetStdHandle (STD_ERROR_HANDLE), buf, count, &done, 0);
+ FlushFileBuffers (GetStdHandle (STD_ERROR_HANDLE));
}
+
+#ifndef NOSTRACE
+ if (active)
+ this->write (category, buf, count);
+#endif
SetLastError (err);
}
@@ -343,35 +348,4 @@ strace::wm (int message, int word, int lon)
this->prntf (_STRACE_WM, "wndproc %d unknown %d %d", message, word, lon);
}
}
-
-/* Print a message on stderr (bypassing anything that could prevent the
- message from being printed, for example a buggy or corrupted stdio).
- This is used, for example, to print diagnostics of fatal errors. */
-
-void
-__system_printf (const char *fmt,...)
-{
- char buf[6000];
- va_list ap;
- int count;
-
- PROTECT (buf);
- va_start (ap, fmt);
- count = strace.vsprntf (buf, fmt, ap);
- va_end (ap);
- CHECK (buf);
-
- DWORD done;
- WriteFile (GetStdHandle (STD_ERROR_HANDLE), buf, count, &done, 0);
- FlushFileBuffers (GetStdHandle (STD_ERROR_HANDLE));
-
-#ifndef NOSTRACE
- if (strace.active)
- strace.write (1, buf, count);
-#endif
-
-#ifdef DEBUGGING
-// try_to_debug ();
-#endif
-}
#endif /*NOSTRACE*/