(clang) extract file extensions

This commit is contained in:
root committed 2026-10-08 13:40:34 +02:00
1 parent 4f08a40e2f
commit eced4b3f7a
1 file changed
+20 -1
+20 -1
View File
@@ -11,7 +11,26 @@
int main(void)
{
(void)printf( "%salarm!%s", SEQUENCE_RED, SEQUENCE_RESET );
const char file_name[] = "readme.md";
const char* extension = strrchr( &file_name[ 0 ], '.' );
if ( extension == file_name )
{
extension = NULL;
}
else if ( extension )
{
extension += 1;
}
if ( extension )
{
( void )printf( "\nextension = %s;\n", extension );
}
else
{
( void )printf( "\nblargh\n" );
}
return 0;
}