This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088
Dependents: MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more
NyLPC_cMimeType.c
00001 #include <stdio.h> 00002 #include "NyLPC_cMimeType.h" 00003 struct TMimeTypeTable{ 00004 const char* ext; 00005 const char* mimetype; 00006 }; 00007 const static struct TMimeTypeTable table[]= 00008 { 00009 {"zip" ,"application/zip"}, 00010 {"js" ,"application/x-javascript"}, 00011 {"txt" ,"text/plain"}, 00012 {"html","text/html"}, 00013 {"htm","text/html"}, 00014 {"css" ,"text/css"}, 00015 {"jpeg","image/jpeg"}, 00016 {"jpg" ,"image/jpeg"}, 00017 {"png" ,"image/png"}, 00018 {"gif" ,"image/gif"}, 00019 {NULL,NULL} 00020 }; 00021 const static char* default_mimetype="application/octet-stream"; 00022 00023 const char* NyLPC_cMiMeType_getFileName2MimeType(const char* i_file_name) 00024 { 00025 int i; 00026 const char* p=strrchr(i_file_name,'.'); 00027 if(p==NULL){ 00028 return default_mimetype; 00029 } 00030 for(i=0;table[i].ext!=NULL;i++){ 00031 if(NyLPC_stricmp(table[i].ext,p+1)==0){ 00032 return table[i].mimetype; 00033 } 00034 } 00035 return default_mimetype; 00036 }
Generated on Tue Jul 12 2022 15:46:16 by 1.7.2