cobol: Provide support for filenames with dollar sign prefix.
GCC COBOL now supports filenames prefixed with a dollar sign, mimicking behavior of other COBOL compilers for environment variable lookups.
GCC’s COBOL runtime now supports filenames that begin with a dollar sign ($). This behavior mimics other COBOL compilers, where such a prefix causes the runtime to look for the actual filename in an environment variable. The change involves copying relevant subroutines from GnuCOBOL and includes necessary adaptations for GCC’s internal file handling. Some compiler warnings and unused variables are also addressed.
In Details
This commit enhances libgcobol's file I/O to emulate a historical COBOL compiler behavior where a $ prefix on a filename triggers an environment variable lookup for the physical path. Routines such as cob_chk_file_env, has_directory_separator, looks_absolute, and establish_filename were copied from GnuCOBOL and adapted. The SLASH_CHAR, SLASH_STR, and NUM_PREFIX constants were updated, and the establish_filename function now uses the new dollar-sign handling logic. Additional cleanup in libgcobol.cc addresses warnings and removes unused variables.
- COBOL
- A compiled programming language designed for business applications. GCC includes a compiler for COBOL.
- runtime
- The collection of software and libraries that are required for a program to execute after it has been compiled.
- environment variable
- A dynamic-évő value in the operating system that can affect the way running processes will behave on a particular computer. In this context, it's used to specify file paths.
- GnuCOBOL
- A free software COBOL compiler, formerly known as OpenCOBOL. GCC has integrated some of its functionality.
- libgcobol
- The runtime library for the GNU COBOL compiler.