home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / IO / EADCOPY.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  915 b   |  39 lines

  1. /* eadcopy.c (emx+gcc) -- Copyright (c) 1993 by Eberhard Mattes */
  2.  
  3. #define INCL_DOSFILEMGR
  4. #include <os2.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include <io.h>
  8. #include <errno.h>
  9. #include <sys/ead.h>
  10. #include "ea.h"
  11.  
  12. int _ead_copy (_ead dst_ead, _ead src_ead, int src_index)
  13. {
  14.   int i;
  15.   const FEA2 *s;
  16.  
  17.   if (src_index == 0)
  18.     for (i = 1; i <= src_ead->count; ++i)
  19.       {
  20.         s = src_ead->index[i-1];
  21.         if (_ead_add (dst_ead, s->szName, s->fEA, s->szName + s->cbName + 1,
  22.                       s->cbValue) < 0)
  23.           return (-1);
  24.       }
  25.   else if (src_index < 1 || src_index > src_ead->count)
  26.     {
  27.       errno = EINVAL;
  28.       return (-1);
  29.     }
  30.   else
  31.     {
  32.       s = src_ead->index[src_index-1];
  33.       if (_ead_add (dst_ead, s->szName, s->fEA, s->szName + s->cbName + 1,
  34.                     s->cbValue) < 0)
  35.         return (-1);
  36.     }
  37.   return (0);
  38. }
  39.