use getprogname if we have, otherwise punt, remove roken dependency

This commit is contained in:
Love Hörnquist Åstrand
2011-10-28 19:30:55 -07:00
parent 1a1bd736c0
commit 3570802d59

View File

@@ -53,8 +53,11 @@ mandoc_template(SL_cmd *cmds,
t = time(NULL);
strftime(timestr, sizeof(timestr), "%b %d, %Y", localtime(&t));
printf(".Dd %s\n", timestr);
p = strrchr(getprogname(), '/');
if(p) p++; else p = getprogname();
#ifdef HAVE_GETPROGNAME
p = getprogname();
#else
p = "unknown-application";
#endif
strncpy(cmd, p, sizeof(cmd));
cmd[sizeof(cmd)-1] = '\0';
strupr(cmd);