diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index f70628af6..c3fe0a05b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2003-11-17  Corinna Vinschen  <corinna@vinschen.de>
+
+	* bsdlib.cc (getprogname): New function.
+	(setprogname): New funtion.
+	* cygwin.din: Export getprogname and setprogname.
+	* include/cygwin/version.h: Bumb API version number.
+
 2003-11-15  Christopher Faylor  <cgf@redhat.com>
 
 	* include/limits.h: Revert unsanctioned changes below.
diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din
index 3a2e957f4..62b152210 100644
--- a/winsup/cygwin/cygwin.din
+++ b/winsup/cygwin/cygwin.din
@@ -645,6 +645,7 @@ getpid
 _getpid = getpid
 getppid
 _getppid = getppid
+getprogname
 getpwduid
 _getpwduid = getpwduid
 getpwent
@@ -1178,6 +1179,7 @@ setpgid
 _setpgid = setpgid
 setpgrp
 _setpgrp = setpgrp
+setprogname
 setpwent
 _setpwent = setpwent
 setregid
diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h
index 3a39c2367..24b9eb62a 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -227,13 +227,14 @@ details. */
       100: CW_GET_SHMLBA addition to external.cc.
       101: Export err, errx, verr, verrx, warn, warnx, vwarn, vwarnx.
       102: CW_GET_UID_FROM_SID and CW_GET_GID_FROM_SID addition to external.cc.
+      103: Export getprogname, setprogname.
 
      */
 
      /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 102
+#define CYGWIN_VERSION_API_MINOR 103
 
      /* There is also a compatibity version number associated with the
 	shared memory regions.  It is incremented when incompatible
diff --git a/winsup/cygwin/libc/bsdlib.cc b/winsup/cygwin/libc/bsdlib.cc
index 0fad8525c..b0f8dbbad 100644
--- a/winsup/cygwin/libc/bsdlib.cc
+++ b/winsup/cygwin/libc/bsdlib.cc
@@ -236,3 +236,25 @@ errx (int eval, const char *fmt, ...)
   vwarnx (fmt, ap);
   exit (eval);
 }
+
+extern "C" const char *
+getprogname (void)
+{
+  return __progname;
+}
+
+extern "C" void
+setprogname (const char *newprogname)
+{
+  if (!check_null_str_errno (newprogname))
+    {
+      /* Per BSD man page, setprogname keeps a pointer to the last
+         path component of the argument.  It does *not* copy the
+	 argument before. */
+      __progname = strrchr (newprogname, '/');
+      if (__progname)
+        ++__progname;
+      else
+	__progname = (char *)newprogname;
+    }
+}