From 7895a99e80db01f665bd8581833153872f9dcc99 Mon Sep 17 00:00:00 2001 From: arpi_esp Date: Sun, 27 May 2001 20:59:58 +0000 Subject: implemented ~/.mplayer/sub/filename.sub stuff git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@893 b3059339-0415-0410-9bf9-f77b7e298cf2 --- subreader.c | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) (limited to 'subreader.c') diff --git a/subreader.c b/subreader.c index 667eb2eeb3..e06e880a75 100644 --- a/subreader.c +++ b/subreader.c @@ -373,6 +373,7 @@ subtitle* sub_read_file (char *filename) { return first; } +#if 0 char * strreplace( char * in,char * what,char * whereof ) { int i; @@ -383,14 +384,16 @@ char * strreplace( char * in,char * what,char * whereof ) if ( strlen( what ) > strlen( whereof ) ) tmp[i]=0; return in; } +#endif -char * sub_filename( char * fname ) +char * sub_filename(char* path, char * fname ) { - char * sub_name = NULL; - char * sub_tmp = NULL; - int i; -#define SUB_EXTS 10 - char * sub_exts[SUB_EXTS] = + char * sub_name1; + char * sub_name2; + int i,j; + FILE * f; + int pos=0; + char * sub_exts[] = { ".sub", ".SUB", ".srt", @@ -401,29 +404,31 @@ char * sub_filename( char * fname ) ".RT", ".txt", ".TXT"}; - + if ( fname == NULL ) return NULL; - for( i=strlen( fname );i>0;i-- ) - if( fname[i] == '.' ) - { - sub_tmp=(char *)&fname[i]; - break; - } - if ( i == 0 ) return NULL; - sub_name=strdup( fname ); - for ( i=0;i