From: Richard Basch Date: Tue, 11 Feb 1997 19:19:10 +0000 (+0000) Subject: com_err.c: display the error via stderr if it is a character device X-Git-Tag: krb5-1.1-beta1~1337 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b1d7deae24bc019a2ea5ee6ee2f7428fef2cff7d;p=krb5.git com_err.c: display the error via stderr if it is a character device (win32 console apps) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9854 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/util/et/ChangeLog b/src/util/et/ChangeLog index 66daf0747..e536e6a58 100644 --- a/src/util/et/ChangeLog +++ b/src/util/et/ChangeLog @@ -1,3 +1,8 @@ +Tue Feb 11 13:31:49 1997 Richard Basch + + * com_err.c: If the application is a console application, simply + display the message to stderr. (win32) + Mon Feb 10 21:30:41 1997 Theodore Y. Ts'o * com_err.c, com_err.h (com_err_va): Fix broken Windows 16 diff --git a/src/util/et/com_err.c b/src/util/et/com_err.c index 2b1d10078..387458f95 100644 --- a/src/util/et/com_err.c +++ b/src/util/et/com_err.c @@ -22,6 +22,9 @@ #include "com_err.h" #include "error_table.h" +#if defined(_MSDOS) || defined(_WIN32) +#include +#endif #ifdef _MACINTOSH #include "icons.h" static void MacMessageBox(errbuf); @@ -96,7 +99,13 @@ void KRB5_CALLCONV default_com_err_proc(ectx, priv, whoami, code, fmt, ap) MacMessageBox(errbuf); #else /* For Windows */ - MessageBox ((HWND)NULL, errbuf, "Kerberos", MB_ICONEXCLAMATION); + if (_isatty(_fileno(stderr))) { + fputs(errbuf, stderr); + fputc('\r', stderr); + fputc('\n', stderr); + fflush(stderr); + } else + MessageBox ((HWND)NULL, errbuf, "Kerberos", MB_ICONEXCLAMATION); #endif } #endif