Skip to content

jb55/extname.c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

extname.c Build Status

extname for clib

Installation

Install with clib:

$ clib install jb55/extname.c

Example

// build with -Ideps

#include "extname/extname.h"

strcmp(extname("some/extension.ext"), ".ext") == 0
strcmp(extname(".derp"), ".derp") == 0
strcmp(extname("."), ".") == 0
strcmp(extname("nothing"), "") == 0

API

const char *extname(const char *filename);

arguments

  • filename a filename

returns

  • pointer to the part of the filename which holds the extension, otherwise, a pointer to an empty string.

License

MIT