comparison libutil/filesearch.c @ 8:34bbb0585cab

libutil: import from previous fc-pcsc-tools version
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Mar 2021 05:42:37 +0000
parents
children
comparison
equal deleted inserted replaced
7:b25d4dfe5798 8:34bbb0585cab
1 /*
2 * This module implements the function that searches for files
3 * in a dedicated directory for SIM programming scripts.
4 */
5
6 #include <stdio.h>
7 #include <string.h>
8 #include <strings.h>
9
10 static char script_install_dir[] = "/opt/freecalypso/sim-scripts";
11
12 FILE *
13 open_script_input_file(req_filename)
14 char *req_filename;
15 {
16 char pathbuf[256];
17 FILE *f;
18
19 if (!index(req_filename, '/') && strlen(req_filename) < 128) {
20 sprintf(pathbuf, "%s/%s", script_install_dir, req_filename);
21 f = fopen(pathbuf, "r");
22 if (f)
23 return f;
24 }
25 f = fopen(req_filename, "r");
26 return f;
27 }