See Bug#24805.
* lib/getprogname.c (getprogname) [__hpux]: Port.
* tests/test-getprogname.c (STREQ) [__hpux]:
Special-case for HP-UX limitations on program name length.
+2016-10-26 John David Anglin <dave.anglin@bell.net>
+
+ getprogname: port to HP-UX
+ See Bug#24805.
+ * lib/getprogname.c (getprogname) [__hpux]: Port.
+ * tests/test-getprogname.c (STREQ) [__hpux]:
+ Special-case for HP-UX limitations on program name length.
+
2016-10-20 Bruno Haible <bruno@clisp.org>
Update doc about target platforms.
# include <sys/ps.h>
#endif
+#ifdef __hpux
+# include <unistd.h>
+# include <sys/param.h>
+# include <sys/pstat.h>
+# include <string.h>
+#endif
+
#include "dirname.h"
#ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Cygwin */
p = "?";
}
return p;
+# elif defined __hpux
+ static char *p;
+ static int first = 1;
+ if (first)
+ {
+ first = 0;
+ pid_t pid = getpid ();
+ struct pst_status status;
+ p = (0 < pstat_getproc (&status, sizeof status, 0, pid)
+ ? strdup (status.pst_ucomm)
+ : NULL);
+ if (!p)
+ p = "?";
+ }
+ return p;
# elif __MVS__ /* z/OS */
/* https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/rtwgetp.htm */
static char *p = "?";
#include <string.h>
#include <assert.h>
-#define STREQ(a, b) (strcmp (a, b) == 0)
+#ifdef __hpux
+# define STREQ(a, b) (strncmp (a, b, 14) == 0)
+#else
+# define STREQ(a, b) (strcmp (a, b) == 0)
+#endif
int
main (void)