home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / config / next / make-support.c < prev    next >
C/C++ Source or Header  |  1996-06-12  |  2KB  |  80 lines

  1. #include "next/make.h"
  2. #include <string.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <stdarg.h>
  6. #include <mach/mach.h>
  7. #include <servers/netname.h>
  8. #include <sys/param.h>
  9. #ifdef _WIN32
  10. #include <direct.h>
  11. #endif
  12.  
  13. void
  14. v_make_support (type, name, file, line, msg, ap)
  15.       int type;
  16.       char *name;
  17.       char *file;
  18.       int line;
  19.       char *msg;
  20.       va_list ap;
  21. {
  22.   static port_t port = PORT_NULL;
  23.   static int already_tried = 0;
  24.   static char directory[MAXPATHLEN];
  25.   char message[1000];
  26.   
  27.   if (port == PORT_NULL && already_tried == 0)
  28.     {
  29.       char *port_name = getenv ("MAKEPORT");
  30.       char *host_name = getenv ("MAKEHOST");
  31.       
  32.       already_tried = 1;
  33.       
  34.       if (port_name == NULL)
  35.         return;
  36.       
  37.       if (host_name == NULL)
  38.         host_name = "";
  39.       
  40.       netname_look_up (name_server_port, host_name, port_name, &port);
  41.       
  42.       if (port == PORT_NULL)
  43.     return;
  44.  
  45. #ifdef _WIN32
  46.       getcwd (directory, MAXPATHLEN);
  47. #else
  48.       getwd (directory);
  49. #endif
  50.     }
  51.   
  52.   if (name == NULL)
  53.     name = "";
  54.   
  55.   if (file == NULL)
  56.     file = "";
  57.   
  58.   if (msg == NULL)
  59.     message[0] = '\0';
  60.   else
  61.     vsprintf (message, msg, ap);
  62.   
  63.   make_alert (port,
  64.           type,
  65.           name, strlen (name) + 1,
  66.           file, strlen (file) + 1,
  67.           directory, strlen (directory) + 1,
  68.           line,
  69.           message, strlen (message) + 1);
  70. }
  71.  
  72. void
  73. make_support (int type, char *name, char *file, int line, char *msg, ...)
  74. {
  75.   va_list ap;
  76.   va_start (ap, msg);
  77.   v_make_support (type, name, file, line, msg, ap);
  78.   va_end (ap);
  79. }
  80.