formatting, strncpy
This commit is contained in:
parent
3981746d2a
commit
f10dd4afce
2
Makefile
2
Makefile
|
@ -4,7 +4,7 @@ CFLAGS=-Ilib83 -c -mz80 --std-sdcc2x --no-std-crt0 --reserve-regs-iy --opt-code-
|
|||
|
||||
OBJS=_crt0.rel clrscr.rel putchar.rel puts.rel exit.rel gotoxy.rel __assert_fail.rel \
|
||||
getchar.rel put_int.rel ctype.rel memcpy.rel memset.rel memmove.rel memcmp.rel \
|
||||
strcpy.rel strlen.rel \
|
||||
strcpy.rel strlen.rel strncpy.rel \
|
||||
main.rel
|
||||
|
||||
.PHONY: all clean try
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
extern void main();
|
||||
|
||||
void AppHeader() {
|
||||
void _start() {
|
||||
__asm
|
||||
.db 0x80, 0x0F
|
||||
.db 0, 0, 0, 0
|
||||
|
|
10
lib83/strncpy.c
Normal file
10
lib83/strncpy.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
char * strncpy(char * d, const char * s, size_t n) {
|
||||
register char * d1 = d;
|
||||
while (n && *s) { n--; *d++ = *s++; }
|
||||
while (n--) *d++ = '\0' ;
|
||||
return d1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user