Commit 78b7ed8c authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Add function to get extension of a filename

parent 4eebd7c2
......@@ -252,7 +252,9 @@ char rand_char();
///Close both part (input/output) of a pipe
void blc_close_pipe(int *pipe);
//int set_iovec(struct iovec *iovec, void *data, size_t size, ...);
///Get the extension (text after last '.') in the filename
char const *blc_get_filename_extension(char const *filename);
#endif /* BLC_TOOLS_H */
......@@ -256,6 +256,20 @@ void blc_close_pipe(int *pipe)
char const *blc_get_filename_extension(char const *filename){
char const *ext=NULL, *next_ext;
next_ext=strchr(filename, '.');
if (next_ext==NULL) return NULL;
next_ext=strchr(ext+1, '.');
return ext+1;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment