diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2003-11-17 17:25:59 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2003-11-17 17:25:59 +0000 |
commit | 6e17cee57bae7447ee61a14e77bfe41f6efc8cdd (patch) | |
tree | 8e3e746d56deb8402663a9d5a27edcf8acf4fc3e /winsup/cygwin/libc/bsdlib.cc | |
parent | 490d129f4ad49dd6682bc424a067a96cb4473a21 (diff) | |
download | cygnal-6e17cee57bae7447ee61a14e77bfe41f6efc8cdd.tar.gz cygnal-6e17cee57bae7447ee61a14e77bfe41f6efc8cdd.tar.bz2 cygnal-6e17cee57bae7447ee61a14e77bfe41f6efc8cdd.zip |
* bsdlib.cc (getprogname): New function.
(setprogname): New funtion.
* cygwin.din: Export getprogname and setprogname.
* include/cygwin/version.h: Bumb API version number.
Diffstat (limited to 'winsup/cygwin/libc/bsdlib.cc')
-rw-r--r-- | winsup/cygwin/libc/bsdlib.cc | 22 |
1 files changed, 22 insertions, 0 deletions
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; + } +} |