================
@@ -37,5 +75,19 @@ void FORTRAN_PROCEDURE_NAME(getarg)(
   (void)RTNAME(GetCommandArgument)(
       n, &value, nullptr, nullptr, __FILE__, __LINE__);
 }
+
+void FORTRAN_PROCEDURE_NAME(getlog)(std::int8_t *arg, std::int64_t length) {
+  std::array<char, LOGIN_NAME_MAX + 1> str;
+  int error = getlogin_r(str.data(), str.size());
+  assert(error == 0 && "getlogin_r returned an error");
+
+  // Trim space from right/end
+  int i = str.size();
+  while (' ' == str[--i]) {
+    str[i] = 0;
+  }
+  strncpy(reinterpret_cast<char *>(arg), str.data(), length);
+}
----------------
PAX-12-WU wrote:

I have moved copyBufferAndPad out of anonymous namespace and define it in 
header file. Now I (and anyone in the  future) can use it by including the 
header file.

https://github.com/llvm/llvm-project/pull/70917
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to