Open VK3SIR opened 1 month ago
Even with the following "test" there is no successful outcome:
file: cobc/config.c ....
cb_load_conf (const char *fname, const int prefix_dir)
...
/* Get the name for the configuration file */
if (prefix_dir) {
/* CHECKME: would it be useful for at least MinGW to use "all slash"
if the first slash is a unix slash? */
snprintf (buff, (size_t)COB_NORMAL_MAX,
"%s%c%s", cob_config_dir,'/', fname);
// "%s%c%s", cob_config_dir, SLASH_CHAR, fname);
name = buff;
} else {
name = fname;
}
...
Note that the file /mingw64/share/gnucobol/config/default.conf exists !!!
Mind you this is not an exhaustive analysis and "hack" of code !
Result:
$ ./cobc
configuration error:
/mingw64/share/gnucobol/config/default.conf: No such file or directory
siri@I7-3770 ~/src/gnucobol-3.3-dev/cobc
Edit: This fixes the display only ... The main work is in _*static int cb_load_conf_file (const char conf_file, const enum cb_include_type includetype)** ...
Possibly a little crazy coding
Further Update ....
A little hack here and there:
File: config.c (note that a prototype has been added for this to cobc.h)
...
// Inerstion into config.c
int replacechar(char *str, char orig, char rep) {
char *ix = str;
int n = 0;
while((ix = strchr(ix, orig)) != NULL) {
*ix++ = rep;
n++;
}
return n;
}
....
Edit of existing code:
...
/* Open the configuration file */
replacechar(conf_file,'\\','/');
printf("conf_file: %s\n",conf_file);
fp = fopen (conf_file, "r");
if (fp == NULL) {
if (include_type != CB_INCLUDE_OPTIONAL) {
cb_perror (1, "%s: %s", conf_file, cb_get_strerror ());
return -1;
} else {
return 0;
}
}
...
This produces:
$ ./cobc
conf_file: /mingw64/share/gnucobol/config/default.conf <=== FILENAME NOW CORRECT !!!!
configuration error:
/mingw64/share/gnucobol/config/default.conf: No such file or directory
sir@I7-3770 ~/src/gnucobol-3.3-dev/cobc
WIth these simple and effective hacks - the solution needs to be put back at the Developers !
Description / Steps to reproduce the issue
Deploy GNG Cobol
pacman -S mingw-w64-x86_64-gnucobol
$ cobc configuration error: /mingw64/share/gnucobol/config\default.conf: No such file or directory
Note that "default.config" exists in /mingw64/share/gnucobol/config
s@I7-3770 ~ $ cd /mingw64/share/gnucobol/config s@I7-3770 /mingw64/share/gnucobol/config $ ls d* default.conf default.ttbl
Expected behavior
Unknown?
No configuration error: /mingw64/share/gnucobol/config\default.conf: No such file or directory Message !
Actual behavior
configuration error: /mingw64/share/gnucobol/config\default.conf: No such file or directory
Verification
Windows Version
MINGW64_NT-10.0-22631
MINGW environments affected
Are you willing to submit a PR?
No response