summaryrefslogtreecommitdiff
path: root/flat.c
diff options
context:
space:
mode:
Diffstat (limited to 'flat.c')
-rw-r--r--flat.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/flat.c b/flat.c
index 29c82303..72172f10 100644
--- a/flat.c
+++ b/flat.c
@@ -51,3 +51,34 @@ cSkinDisplayTracks *cFlat::DisplayTracks(const char *Title, int NumTracks, const
cSkinDisplayMessage *cFlat::DisplayMessage(void) {
return new cFlatDisplayMessage;
}
+
+
+char * substr(char * string, int start, int end)
+{
+ char * p = &string[start];
+ char * buf = (char*) malloc(strlen(p) + 1);
+ char * ptr = buf;
+ if(!buf) return NULL;
+
+ while(*p != '\0' && start < end) {
+ *ptr ++ = *p++;
+ start ++;
+ }
+ *ptr++ = '\0';
+
+ return buf;
+}
+
+char *GetFilenameWithoutext(char * fullfilename)
+{
+ int i, size;
+ i = size = 0;
+
+ while(fullfilename[i] != '\0') {
+ if(fullfilename[i] == '.') {
+ size = i;
+ }
+ i++;
+ }
+ return substr(fullfilename, 0, size);
+}