comparison fteeprom/filesearch.c @ 7:b2c891299e83

ftee-gen*: look for EEPROM config file in /opt/freecalypso/ftdi
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 04 Sep 2023 20:37:52 +0000
parents
children
comparison
equal deleted inserted replaced
6:d4151cef9d95 7:b2c891299e83
1 /*
2 * This module implements the function that searches for FTDI EEPROM config
3 * files in a dedicated installation directory. It is based on the version
4 * in fc-sim-tools that looks in the sim-scripts directory.
5 */
6
7 #include <stdio.h>
8 #include <string.h>
9 #include <strings.h>
10
11 static char ftdi_install_dir[] = "/opt/freecalypso/ftdi";
12
13 FILE *
14 open_eeprom_config_file(req_filename)
15 char *req_filename;
16 {
17 char pathbuf[256];
18 FILE *f;
19
20 if (!index(req_filename, '/') && strlen(req_filename) < 128) {
21 sprintf(pathbuf, "%s/%s", ftdi_install_dir, req_filename);
22 f = fopen(pathbuf, "r");
23 if (f)
24 return f;
25 }
26 f = fopen(req_filename, "r");
27 return f;
28 }