This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran] Patch to implement getenv g77 and get_environment_variable F2003 intrinsics


Hello folks,

the attached patch and file env.c implement the getenv g77 and
get_environment_variable F2003 intrinsic subroutines.

You'll notice a kludge: gfortran strings are not null-terminated, so
in both cases I have to copy the NAME input argument to a string one
character longer, adding '\0' at the end. Else the c library functions
get confused, as they scan strings until they find '\0'. Is there some
better way to do this?

A test program is also included (though I'm not familiar with dg).

gcc Changelog:

	* intrinsic.c (add_subroutines): Add getenv and
	get_environment_variable. (add_sym_5s): New function.
	* intrinsic.h (gfc_resolve_get_environment_variable): Add
	prototype.
	* iresolve.c (gfc_resolve_get_environment_variable): New
	function.

libgfortran Changelog:

	* intrinsics/env.c: New file.
	* Makefile.am: Add env.c to build.
	* Makefile.in: Regenerate.
	


-- 
Janne Blomqvist

Attachment: getenv.patch
Description: Text document

Attachment: env.c
Description: Text document

Attachment: getenv_1.f90
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]