/* eawrite.c (emx+gcc) -- Copyright (c) 1993 by Eberhard Mattes */

#define INCL_DOSFILEMGR
#include <os2.h>
#include <stdlib.h>
#include "ea.h"

int _ea_write (const char *path, int handle, PFEA2LIST src)
{
  ULONG rc;
  EAOP2 eaop;

  eaop.fpGEA2List = NULL;
  eaop.fpFEA2List = src;
  eaop.oError = 0;
  if (path != NULL)
    rc = DosSetPathInfo (path, 2, &eaop, sizeof (eaop), 0);
  else
    rc = DosSetFileInfo (handle, 2, &eaop, sizeof (eaop));
  if (rc != 0)
    {
      _ea_set_errno (rc);
      return (-1);
    }
  return (0);
}
