diff options
Diffstat (limited to 'winsup/cygwin/libc')
-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; + } +} |