/* sys/dup.c (emx+gcc) -- Copyright (c) 1992-1993 by Eberhard Mattes */

#include <sys/emx.h>
#include <os2emx.h>
#include "syscalls.h"

int __dup (int handle)
{
  ULONG rc;
  HFILE new;

  new = 0xffffffff;
  rc = DosDupHandle (handle, &new);
  if (rc != 0)
    {
      _sys_set_errno (rc);
      return (-1);
    }
  return (new);
}
