summary refs log tree commit diff
path: root/compat/getprogname_windows.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--compat/getprogname_windows.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/compat/getprogname_windows.c b/compat/getprogname_windows.c
new file mode 100644
index 0000000..eb04ec0
--- /dev/null
+++ b/compat/getprogname_windows.c
@@ -0,0 +1,13 @@
+#include <stdlib.h>
+
+#include <windows.h>
+
+const char *
+getprogname(void)
+{
+	static char progname[MAX_PATH + 1];
+	DWORD length = GetModuleFileName(NULL, progname, sizeof (progname) - 1);
+	if (length < 0)
+		return "?";
+	return progname;
+}