formatting, strncpy

This commit is contained in:
Kamila Szewczyk 2023-10-08 18:20:19 +02:00
parent 3981746d2a
commit f10dd4afce
Signed by: Palaiologos
GPG Key ID: E34D7BADA3DACC14
7 changed files with 26 additions and 16 deletions

View File

@ -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 \ 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 \ 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 main.rel
.PHONY: all clean try .PHONY: all clean try

View File

@ -3,7 +3,7 @@
extern void main(); extern void main();
void AppHeader() { void _start() {
__asm __asm
.db 0x80, 0x0F .db 0x80, 0x0F
.db 0, 0, 0, 0 .db 0, 0, 0, 0

10
lib83/strncpy.c Normal file
View 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;
}