/*  -*- Mode: C -*-
 * --------------------------------------------------------------------
 * DO NOT EDIT THIS FILE!  It has been automatically generated
 * from:    configure.in and common.h.in
 * on host: midas
 * --------------------------------------------------------------------
 */

#ifndef METAMAIL_COMMON_H
#define METAMAIL_COMMON_H 1

#include <stdio.h>
#include <ctype.h>        // ??? ok here
#include <sys/types.h>
#include <sys/stat.h>     // ??? ok here

// ??? following ok here without check?
#include <pwd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/file.h>
#include <signal.h>

#include <termio.h>
#include <fcntl.h>
#include <sys/utsname.h>

#include <linux/limits.h>

#include <stdlib.h>
#include <unistd.h>
#include <errno.h>

#ifndef errno
/* Some sytems #define this! */
extern int errno;
#endif

#include <string.h>

#include <stdarg.h>
#ifndef VA_START
#  define VA_START(a, f) va_start(a, f)
#endif /* VA_START */


#include <assert.h>
#define METAMAIL_ASSERT assert


#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
#  include <sys/time.h>
# else
#  include <time.h>
# endif
#endif

#ifndef PARAMS
#  if __STDC__
#    ifndef NOPROTOS
#      define PARAMS(args)        args
#    endif
#  endif
#  ifndef PARAMS
#    define PARAMS(args)          ()
#  endif
#endif

#ifndef EXIT_SUCCESS
#  define EXIT_SUCCESS  0
#  define EXIT_FAILURE  1
#endif
      
#ifdef __cplusplus
#  define BEGIN_C_DECLS         extern "C" {
#  define END_C_DECLS           }
#else
#  define BEGIN_C_DECLS
#  define END_C_DECLS
#endif

#ifdef __GNUC__
#  ifndef const
#    define const       __const
#  endif
#  ifndef signed
#    define signed      __signed
#  endif
#  ifndef volatile
#    define volatile    __volatile
#  endif
#else
#  ifdef __STDC__
#    undef  signed
#    define signed
#    undef  volatile
#    define volatile
#  endif
#endif

#ifdef __STDC__
#  define STR(x)          #x
#  define CONC(x, y)      x##y
   typedef void* sic_ptr;
#else
#  define STR(x)          "x"
#  define CONC(x, y)      x/**/y
   typedef char* sic_ptr;
#endif


#define XCALLOC(type, num)      ((type *) xcalloc ((num), sizeof(type)))
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
#define XREALLOC(type, p, num)  ((type *) xrealloc ((p), (num) * sizeof(type)))
#define XFREE(stale)                            do {        \
              if (stale) { free ((sic_ptr) stale);  stale = 0; }    \
                                                      } while (0)


BEGIN_C_DECLS

extern void *xcalloc    (size_t num, size_t size);
extern void *xmalloc    (size_t num);
extern void *xrealloc   (void *p, size_t num);
extern char *xstrdup    (const char *string);
extern char *xstrerror  (int errnum);

END_C_DECLS

#if WITH_DMALLOC
#  include <dmalloc.h>
#endif

//metamail specific stuff below (this are the additions from Michael Moerz)

#define RESET_PROGRAM "/usr/bin/reset"

//#define NO_RLIMITS 1
#define sigtype void

/* This constant should define the ASCII code for newlines on systems where 
   the newline convention is other than CRLF.  On UNIX, it is ^J, ASCII 10. 
    Here we define it as '\n' which should be right on MOST systems... */
#define NEWLINE_CHAR '\n'

/* The following defines the default size at which long
    messages will be split into multiple messages of type
    "message/partial" by the mailto and splitmail commands,
    at least. */
#ifndef DEFAULT_SPLIT_SIZE
#define DEFAULT_SPLIT_SIZE 250000
#endif

#define PATH_SEPARATOR ':'
#ifndef STDPATH
#define STDPATH "/.mailcap:/usr/local/etc/mailcap:/usr/etc/mailcap:/etc/mailcap:/etc/mail/mailcap:/usr/public/lib/mailcap"
#endif

/* The following can be set to a directory or colon-separated list of 
  directories that will be prepended to the user's search path before 
  executing any mailcap-derived commands. 

  It should be set to NULL if there are no directories to prepend.  
*/

#define AUXPATH NULL


#define TMPFILE_NAME_SIZE   1000
#define MAX_FILE_NAME_SIZE 1000

BEGIN_C_DECLS

extern char **environ, *gets();

extern char *getenv();
extern char *index();
extern char *rindex();

extern FILE *popen();

END_C_DECLS

//#ifndef NO_RLIMITS
//#include <sys/resource.h>
//#endif



#define LPRCOMMAND "lp"
#define LPRTEMPLATE "lp %s"
#define CATCOMMAND "cat"
#define CATTEMPLATE "cat %s"
#define TMPNAME_MAX NAME_MAX
static struct termio MyTtyStateIn, MyTtyStateOut;



#endif /* !METAMAIL_COMMON_H */
