mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-22 06:29:23 +00:00
Added missing fragment and strncpy() to string.h.
This commit is contained in:
parent
d372383d48
commit
599a757bf1
@ -0,0 +1,9 @@
|
||||
ldy #0
|
||||
lda ({z1}),y
|
||||
cmp #<{c1}
|
||||
bne !+
|
||||
iny
|
||||
lda ({z1}),y
|
||||
cmp #>{c1}
|
||||
beq {la1}
|
||||
!:
|
@ -19,6 +19,14 @@ void *memset(void *str, char c, size_t num);
|
||||
/// Copies the C string pointed by source into the array pointed by destination, including the terminating null character (and stopping at that point).
|
||||
char* strcpy( char* destination, char* source );
|
||||
|
||||
/// Copies up to n characters from the string pointed to, by src to dest.
|
||||
/// In a case where the length of src is less than that of n, the remainder of dest will be padded with null bytes.
|
||||
/// @param dst − This is the pointer to the destination array where the content is to be copied.
|
||||
/// @param src − This is the string to be copied.
|
||||
/// @param n − The number of characters to be copied from source.
|
||||
/// @return The destination
|
||||
char *strncpy(char *dst, const char *src, size_t n);
|
||||
|
||||
/// Computes the length of the string str up to but not including the terminating null character.
|
||||
size_t strlen(char *str);
|
||||
|
||||
|
@ -46,6 +46,21 @@ char* strcpy( char* destination, char* source ) {
|
||||
return destination;
|
||||
}
|
||||
|
||||
/// Copies up to n characters from the string pointed to, by src to dst.
|
||||
/// In a case where the length of src is less than that of n, the remainder of dst will be padded with null bytes.
|
||||
/// @param dst − This is the pointer to the destination array where the content is to be copied.
|
||||
/// @param src − This is the string to be copied.
|
||||
/// @param n − The number of characters to be copied from source.
|
||||
/// @return The destination
|
||||
char *strncpy(char *dst, const char *src, size_t n) {
|
||||
for(size_t i = 0;i<n;i++) {
|
||||
char c = *src;
|
||||
if(c) src++;
|
||||
*dst++ = c;
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
// Converts a string to uppercase.
|
||||
char * strupr(char *str) {
|
||||
char * src = str;
|
||||
|
Loading…
Reference in New Issue
Block a user