/* $Id: ps_osinit.c,v 1.1.1.1 90/11/28 16:45:17 altenhof Exp $ */

/*
 * Copyright (C) 1990 by Digital Equipment Corporation.
 * 
 * Author: Michael P. Altenhofen, CEC Karlsruhe e-mail:
 * Altenhofen@kampus.enet.dec.com
 * 
 * This file ist part of Shared X
 * 
 * Permission to use, copy, modify, and distribute this software and its
 * documentation without fee is hereby granted, but only for non-profit  use
 * and distribution,  and provided  that the copyright notice and this notice
 * is preserved on all copies.
 * 
 * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
 * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 * SOFTWARE.
 */

#include <dbm.h>
#undef NULL

#ifndef MAXPATHLEN

/*
 * just to get MAXPATHLEN.  Define it elsewhere if you need to avoid these
 * files.
 */
#include <sys/types.h>
#endif

#ifndef ADMPATH
#define ADMPATH "/usr/adm/X%smsgs"
#endif

int havergb = 0;

#define PUBLIC extern

#undef PUBLIC

OsInit ()
{
  /**************
      static Bool been_here = FALSE;
      char fname[MAXPATHLEN];
      char *rgbPath = "";
  
  #ifdef macII
      set42sig();
  #endif
  **************/
  /* hack test to decide where to log errors */
  /*************
      if (!been_here) {
	  if (write (2, fname, 0))
	  {
	      long t;
	      char *ctime();
	      FILE *err;
	      fclose(stdin);
	      fclose(stdout);
	      sprintf (fname, ADMPATH, display);
  *************/

  /*
   * uses stdio to avoid os dependencies here, a real os would use open
   * (fname, O_WRONLY|O_APPEND|O_CREAT, 0666)
   */
  /************
	      if (!(err = fopen (fname, "a+")))
		  err = fopen ("/dev/null", "w");
	      if (err && (fileno(err) != 2)) {
		  dup2 (fileno (err), 2);
		  fclose (err);
	      }
  #if defined(macII) || defined(hpux)
	      {
	      static char buf[BUFSIZ];
	      setvbuf (stderr, buf, _IOLBF, BUFSIZ);
	      }
  #else
	      setlinebuf(stderr);
  #endif
	      time (&t);
	      fprintf (stderr, "start %s", ctime(&t));
	  }
  
	  if (getpgrp (0) == 0)
	      setpgrp (0, getpid ());
  
	  been_here = TRUE;
      }
  
      if(!havergb)
          if(dbminit (rgbPath) == 0)
	      havergb = 1;
          else
	      ErrorF( "Couldn't open RGB_DB '%s'\n", rgbPath );
  *************/
}
