summaryrefslogtreecommitdiff
path: root/lib/getprogname.c
diff options
context:
space:
mode:
authorLarkin Nickle <me@larbob.org>2021-05-22 12:17:50 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2021-05-22 12:18:25 -0700
commit530ef0af967b773152642ca426d502575b48451d (patch)
tree4fd03ebfbc1928c03f2aeee66abbc9af8c796bd5 /lib/getprogname.c
parent31e46743abc894a70e420411e7d183e8ef0f8e45 (diff)
downloadgnulib-530ef0af967b773152642ca426d502575b48451d.tar.gz
getprogname: port to Tru64
* lib/getprogname.c: Treat __osf__ like __sgi, except with /proc/123 instead of /proc/pinfo/123.
Diffstat (limited to 'lib/getprogname.c')
-rw-r--r--lib/getprogname.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/getprogname.c b/lib/getprogname.c
index a3bd15ebb0..9a80281121 100644
--- a/lib/getprogname.c
+++ b/lib/getprogname.c
@@ -43,7 +43,7 @@
# include <string.h>
#endif
-#ifdef __sgi
+#if defined __sgi || defined __osf__
# include <string.h>
# include <unistd.h>
# include <stdio.h>
@@ -224,11 +224,15 @@ getprogname (void)
free (buf.ps_pathptr);
}
return p;
-# elif defined __sgi /* IRIX */
+# elif defined __sgi || defined __osf__ /* IRIX or Tru64 */
char filename[50];
int fd;
- sprintf (filename, "/proc/pinfo/%d", (int) getpid ());
+ # if defined __sgi
+ sprintf (filename, "/proc/pinfo/%d", (int) getpid ());
+ # else
+ sprintf (filename, "/proc/%d", (int) getpid ());
+ # endif
fd = open (filename, O_RDONLY | O_CLOEXEC);
if (0 <= fd)
{