File tree 3 files changed +15
-1
lines changed
3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,12 @@ ReturnCode fpp_openfile(struct Global *global, char *filename)
35
35
FILE * fp ;
36
36
ReturnCode ret ;
37
37
38
- if ((fp = fopen (filename , "r" )) == NULL )
38
+ if (global -> openfile )
39
+ fp = global -> openfile (filename , "r" , global -> userdata );
40
+ else
41
+ fp = fopen (filename , "r" );
42
+
43
+ if (fp == NULL )
39
44
ret = FPP_OPEN_ERROR ;
40
45
else
41
46
ret = fpp_addfile (global , fp , filename );
@@ -268,6 +273,9 @@ int fpp_dooptions(struct Global *global, struct fppTag *tags)
268
273
case FPPTAG_ALLOW_INCLUDE_LOCAL :
269
274
global -> allowincludelocal = (tags -> data ?1 :0 );
270
275
break ;
276
+ case FPPTAG_FILEOPENFUNC :
277
+ global -> openfile = (FILE * (* )(char * ,char * ))tags -> data ;
278
+ break ;
271
279
default :
272
280
fpp_cwarn (global , WARN_INTERNAL_ERROR , NULL );
273
281
break ;
Original file line number Diff line number Diff line change @@ -253,6 +253,8 @@ struct Global {
253
253
char webmode ; /* WWW process mode */
254
254
255
255
char allowincludelocal ;
256
+
257
+ FILE * (* openfile )(char * ,char * , void * );
256
258
};
257
259
258
260
typedef enum {
Original file line number Diff line number Diff line change @@ -165,6 +165,10 @@ struct fppTag {
165
165
/* Allow include "X" (rather than <X>) to search local files, default is FPP_TRUE */
166
166
#define FPPTAG_ALLOW_INCLUDE_LOCAL 35
167
167
168
+ /* Fileopen function. If set, this is called when FPP tries to open a file: */
169
+ #define FPPTAG_FILEOPENFUNC 36 /* data is function pointer to a
170
+ "FILE* (*)(char * filename, char * mode, void * userdata)", default is NULL */
171
+
168
172
int fppPreProcess (struct fppTag * );
169
173
170
174
#ifdef __cplusplus
You can’t perform that action at this time.
0 commit comments