/* core.h								*/
/*	Have deliberately chosen NOT to have INNEROPTIONS in here, so	*/
/*	think hard before changing mind about that...			*/

/*	Note that there is a system core.h file (which presumably deals	*/
/*	with core dump files).  Presumably no conflict.  Even if there	*/
/*	would be, presumably one can get both into one's program by	*/
/*	using <core.h> "core.h" and/or fooling with -I on compile	*/

/*	Anticipate multiple attempted loads of core.h			*/
#ifndef COREH_VERSION

#define COREH_VERSION "core.h  version 1.4 30 Aug 2004"
/*  30 Aug 04.  v 1.4  WJS						*/
/*	jdb function defn stuff should not be in here, since that would	*/
/*	  require everything to use library.				*/
/*  25 Aug 04.  v 1.4  WJS						*/
/*	MAX_SERV_DCT_BUF						*/
/*	  [Begin 1.4]							*/
/*  13 Jul 04.  v 1.3  WJS						*/
/*	W_EXTEND ("width extender" char.  Needed in all width input	*/
/*	  processing)							*/
/*	  [Begin 1.3]							*/
/*  25 Mar 04.  v 1.2  WJS						*/
/*	stat.h								*/
/*  20 Feb 04.  v 1.2  WJS						*/
/*	Some OS-wide defns: PIPECHAR, INP_REDIRECT_CHAR,		*/
/*	  OUTP_REDIRECT_CHAR, & DIRSEP 					*/
/*  11 Feb 04.  v 1.2  WJS						*/
/*	JGOFS_ERR_PREFIX						*/
/*	MAXLEN_PROGRAM_ID_STRING 					*/
/*	pwd.h (needed for "approved" way to get user name)		*/
/*	Include error_exit_defn.h in here				*/
/*	  [Begin 1.2]							*/
/*  16 Jan 04.  v 1.1  WJS						*/
/*	MISSING_VALUE_REAL, NULL_DEVICE					*/

#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <limits.h>
#include <math.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include OPTIONS

#ifndef FALSE
  /*  Not sure where the system defns of these are on Bob's box, if 	*/
  /*  anywhere and we gotta have them.  C defines FALSE but doesn't	*/
  /*  care about TRUE, so define latter in terms of former in case	*/
  /*  there are system differences (eg, VMS generally likes -1 for	*/
  /*  TRUE...)								*/
#define FALSE 0
#define TRUE !FALSE
#endif
#if FALSE || !TRUE
#error "Bad TRUE/FALSE values got into program at compile time"
#endif
#define NOT_VALID -1
  /*  We use -1 as different from TRUE & FALSE.  Check this is OK	*/
#if (TRUE == NOT_VALID) || (FALSE == NOT_VALID)
#error "TRUE/FALSE value conflicts w/something we assume is neither"
#endif

#ifndef CYGWIN
#define CYGWIN FALSE
#endif

#ifndef HP
#define HP FALSE
#endif

#ifndef IBM
#define IBM FALSE
#endif

#ifndef IRIX
#define IRIX FALSE
#endif

#ifndef OSF
#define OSF FALSE
#endif

#ifndef PC
#define PC FALSE
#endif

#ifndef SOL
#define SOL FALSE
#endif

#ifndef SUN
#define SUN FALSE
#endif

#ifndef ULTRIX
#define ULTRIX FALSE
#endif

#ifndef VMS
#define VMS FALSE
#endif

double strtod();
extern char **environ;

typedef signed char Logical;	/*  NB: occasionally gets -1,		*/
				/*   hence need signed			*/

#define COPY_INTO_FIXED_LEN_BUFFER(dest,source,errmsg) \
	copy_into_fixed_len_buffer((dest),sizeof((dest)),(source),errmsg)

  /*  This size is used by a number of serv & dct buffers, most re-	*/
  /*  lating to pieces of .objects entries.  No real reason they should	*/
  /*  all be the same size, but one step at a time!			*/
#define MAX_SERV_DCT_BUF 1025

#if VMS
#define STDOUT_NAME "SYS$OUTPUT:"
#define STDERR_NAME "SYS$ERROR:"
#define NULL_DEVICE "NL:"
#define strcasecmp strcasecmp_wjs
#include <stat.h>
#include <types.h>
  /*  Looks like waitpid stuff not in VMS until v 7...			*/
  /*  Define WNOHANG here; a dummy waitpid() function in 		*/
  /*    wjsdummyunixlib (mult defns if defined here)			*/
#define WNOHANG 1	/* Defined in wait.h for VMS v 7 but not 6	*/
#else
#define STDOUT_NAME "/dev/stdout"
#define STDERR_NAME "/dev/stderr"
#define NULL_DEVICE "/dev/null"
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#endif

  /*  Next value is supposed to be an illegal major/minor device ID	*/
  /*  as returned by the stat/fstat/lstat series of system calls.  No	*/
  /*  biggie if it turns out to be legal - only used as a flag to	*/
  /*  prevent superfluous stat calls					*/
#define NO_SUCH_DEVICE 0

/* ATTRIB_SEP			Character which separates entries in	*/
/*			    a variable attribute list.  Note this is a	*/
/*			    a character, not a string.  Embedded	*/
/*			    whitespace (for example) is significant	*/
/*			    within an attribute string			*/
/* DIRSEP			Character in a file spec that indicates	*/
/*			    a directory name has just concluded		*/
/* INP_REDIRECT_CHAR		Character which indicates input 	*/
/*			    redirection to shell			*/
/* MISSING_VALUE_REAL 		Floating point number that represents	*/
/* 			    various data anomalies when data is		*/
/* 			    represented in floating point form		*/
/* MISSING_VALUE_STRING		String that represents various data	*/
/* 			    anomalies when data is presented in string	*/
/*			    form					*/
/* OUTP_REDIRECT_CHAR		Character which indicates output 	*/
/*			    redirection to shell			*/
/* PIPECHAR			Character which indicates I/O piping to	*/
/*			    shell					*/
/* W_EXTEND 			Trailing character in variable name 	*/
/* 			    which pads name length to output datum	*/
/*			    length.  Alternate to specifying [width]	*/
/*			    attribute					*/
#define ATTRIB_SEP ';'
#define DIRSEP '/'
#define INP_REDIRECT_CHAR '<'
#define MISSING_VALUE_REAL -9999.
#define MISSING_VALUE_STRING "nd"
#define OUTP_REDIRECT_CHAR '>'
#define PIPECHAR '|'
#define W_EXTEND '_'

/* ATTR_DELIM			Characters that surround variable	*/
/* 			    attribute list				*/
#define ATTR_DELIM "[]"

/* MAXLEVELS    Cannot be bigger than 10 (Email from Glenn ~20 Feb 96)	*/
/*		Somewhere, system assumes max level is 1 character long	*/
/*		(0-9; hence size of 10).  Don't see point in allowing	*/
/*		it to be smaller, hence not configurable		*/
/*		The "somewhere" might be the jdb routines which look at	*/
/*		1 char after the &v, or &d, or whatever			*/
#define MAXLEVELS 10

#define MAXLEN_PROGRAM_ID_STRING 256

#define JGOFS_ERR_PREFIX "&x"

/*	error_exit_defn.h  v 1.0  20 Apr 99	WJS			*/

/*	Define error exit status for program.  Problem from my per-	*/
/*  spective was that too many "things" used 1 (which, by the way, is	*/
/*  defined in stdlib.h as EXIT_FAILURE, so 1 is in fact standard in	*/
/*  some way).  I wanted a status that meant that the program had in-	*/
/*  deed begun and chosen to fail.  For example, if you try to exe-	*/
/*  cute a program in a child process and give the wrong file spec, you	*/
/*  will get a 1 back from whatever component tried to find the pro-	*/
/*  gram, which is too easily confused with the program exiting with	*/
/*  a 1.								*/
/*	Because the wait system service, which reports child process	*/
/*  termination information, only reports the low order 8 bits of exit	*/
/*  status, I wanted a number < 255.  0 is reserved for success.	*/
/*  250 chosen after looking through a couple of errno.h files for	*/
/*  unused statuses between 1 & 255.  No guarantee that it will stay	*/
/*  unused, of course.  255 ruled out because perl die function uses it	*/

#ifndef ERROR_EXIT_STATUS
#define ERROR_EXIT_STATUS 250
#endif

#if ERROR_EXIT_STATUS < 0
#error "ERROR_EXIT_STATUS < 0 will most likely be interpreted as pos #"
#endif
#if ERROR_EXIT_STATUS == 0
#error "ERROR_EXIT_STATUS = 0 conflicts with normal exit status"
#endif
#if ERROR_EXIT_STATUS > 255
#error "ERROR_EXIT_STATUS > 255 causes trouble when issued from child processes"
#endif


#endif
