From 6e17cee57bae7447ee61a14e77bfe41f6efc8cdd Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 17 Nov 2003 17:25:59 +0000 Subject: * bsdlib.cc (getprogname): New function. (setprogname): New funtion. * cygwin.din: Export getprogname and setprogname. * include/cygwin/version.h: Bumb API version number. --- winsup/cygwin/libc/bsdlib.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'winsup/cygwin/libc') 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; + } +} -- cgit v1.2.3