FreeCalypso > hg > fc-pcsc-tools
comparison libutil/filesearch.c @ 157:f064dbcc5f41
libutil split from libcommon
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 26 Feb 2021 20:19:58 +0000 |
parents | libcommon/filesearch.c@94d87d05f6c5 |
children |
comparison
equal
deleted
inserted
replaced
156:5f1f3f6fd865 | 157:f064dbcc5f41 |
---|---|
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 } |