2 /* memccpy - copy bytes up to a certain char
4 * CHARBITS should be defined only if the compiler lacks "unsigned char".
5 * It should be a mask, e.g. 0377 for an 8-bit machine.
11 _PROTOTYPE( void *memccpy
, (void *dst
, const void *src
,
12 int ucharstop
, size_t size
));
14 # define UNSCHAR(c) ((unsigned char)(c))
16 # define UNSCHAR(c) ((c)&CHARBITS)
19 void *memccpy(dst
, src
, ucharstop
, size
)
26 register _CONST
char *s
;
30 if (size
<= 0) return( (void *) NULL
);
34 uc
= UNSCHAR(ucharstop
);
35 for (n
= size
; n
> 0; n
--)
36 if (UNSCHAR(*d
++ = *s
++) == (char) uc
) return( (void *) d
);
38 return( (void *) NULL
);