#include "Bdef.h"

#ifdef __STDC__
void BlacsWarn(int ConTxt, int line, char *file, char *form, ...)
#else
void BlacsWarn(va_alist)
va_dcl
#endif
{
   extern int Iam00;
   extern BLACSCONTEXT **MyConTxts00;
   int myrow, mycol;
   va_list argptr;
   char cline[100];

#ifdef __STDC__
   va_start(argptr, form);
#else
   char *file, *form;
   int ConTxt, line;

   va_start(argptr);
   ConTxt = va_arg(argptr, int);
   line = va_arg(argptr, int);
   file = va_arg(argptr, char *);
   form = va_arg(argptr, char *);
#endif
   vsprintf(cline, form, argptr);
   va_end(argptr);

   if (ConTxt > -1)
   {
      myrow = MyConTxts00[ConTxt]->myrow;
      mycol = MyConTxts00[ConTxt]->mycol;
   }
   else myrow = mycol = -1;

   fprintf(stderr,
"BLACS WARNING '%s'\nfrom {%d,%d}, pnum=%d, Contxt=%d, on line %d of file '%s'.\n\n",
           cline, myrow, mycol, Iam00, ConTxt, line, file);
}
