kolibrios/programs/develop/libraries/menuetlibc/src/libmgfx/format.c
right-hearted 6496d04506 Adding menuetlibc back to its place in /programs/develop/libraries
This version of menuetlibc was taken from revision 4743, right before I made any changes

git-svn-id: svn://kolibrios.org@4973 a494cfbc-eb01-0410-851d-a64ba20cac60
2014-06-12 10:43:21 +00:00

31 lines
562 B
C

#include <string.h>
#include"libmgfx.h"
static struct mgfx_image_format * the_fmts=NULL;
void register_image_format(struct mgfx_image_format * fmt)
{
fmt->next=the_fmts;
the_fmts=fmt;
}
struct mgfx_image_format * get_image_format(char * fname)
{
char * p;
int j;
struct mgfx_image_format * fmt;
if(!the_fmts) return NULL;
p=strstr(fname,".");
if(!p) return NULL;
p++;
j=strlen(p);
if(!j) return NULL;
strlwr(p);
for(fmt=the_fmts;fmt;fmt=fmt->next)
{
if(strlen(fmt->fmt_ext)==j)
if(!strncmp(p,fmt->fmt_ext,j)) return fmt;
}
return NULL;
}