/* dlltest5.c (emx+gcc) */

#include <stdio.h>
#include <stdlib.h>
#include "testdll5.h"

int main (void)
{
  void *p1, *p2;

  p1 = malloc (1000);
  p2 = dalloc (1000);
  if (p1 == NULL)
    printf ("malloc() failed\n");
  else if (p2 == NULL)
    printf ("dalloc() failed\n");
  else
    {
      printf ("malloc -> %p\n", p1);
      printf ("dalloc -> %p\n", p2);
      free (p1);
      dfree (p2);
    }
  putchar ('\n');
  putenv ("DLLTEST5=not visible by dgetenv");
  printf ("getenv(\"DLLTEST5\")  -> %s\n", getenv ("DLLTEST5"));
  printf ("dgetenv(\"DLLTEST5\") -> %s\n", dgetenv ("DLLTEST5"));

  putchar ('\n');
  printf ("getenv(\"COMSPEC\")  -> %s\n", getenv ("COMSPEC"));
  printf ("dgetenv(\"COMSPEC\") -> %s\n", dgetenv ("COMSPEC"));

  /* The following statement has been inserted to work around a bug in
     LINK386 and ILINK (all versions available as of 25-Feb-1996).  The
     bug seems to occur only if the size of the code object is n*0x1000+4.
     The bug causes the entire data object to be initialized to
     zeros. */

  p1 = NULL;

  return 0;
}
