Parsing commandline arguments

This commit is contained in:
2025-09-13 15:43:31 +02:00
parent dc3d80d707
commit e6891b39cc
18 changed files with 448 additions and 59 deletions

View File

@ -111,3 +111,22 @@ char *string_strchr(const char *s, int c) {
}
return NULL;
}
// https://stackoverflow.com/questions/32560167/strncmp-implementation
int string_strncmp( const char * s1, const char * s2, size_t n )
{
while ( n && *s1 && ( *s1 == *s2 ) )
{
++s1;
++s2;
--n;
}
if ( n == 0 )
{
return 0;
}
else
{
return ( *(unsigned char *)s1 - *(unsigned char *)s2 );
}
}