================ @@ -10,13 +10,29 @@ // extensions that will eventually be implemented in Fortran. #include "flang/Runtime/extensions.h" +#include "flang/Runtime/character.h" #include "flang/Runtime/command.h" #include "flang/Runtime/descriptor.h" #include "flang/Runtime/io-api.h" +#if _REENTRANT || _POSIX_C_SOURCE >= 199506L +// System is posix-compliant and has getlogin_r +#include <unistd.h> +#endif + extern "C" { namespace Fortran::runtime { + +void GetUsernameEnvVar( + const char *envName, std::byte *arg, std::int64_t length) { + Descriptor name{ + *Descriptor::Create(1, sizeof(envName), const_cast<char *>(envName), 0)}; ---------------- jeanPerier wrote:
I think that when @klausler suggested using sizeof(), the type was a `char[n]`, here it is a `const char*` so I expect this will be 8 on 64bits machines which is OK by accident for `USERNAME`, but just wrong in general. https://github.com/llvm/llvm-project/pull/74628 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits