diff options
Diffstat (limited to 'bsd-misc.c')
-rw-r--r-- | bsd-misc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bsd-misc.c b/bsd-misc.c index 59814946c..2a0596593 100644 --- a/bsd-misc.c +++ b/bsd-misc.c | |||
@@ -26,6 +26,26 @@ | |||
26 | #include "xmalloc.h" | 26 | #include "xmalloc.h" |
27 | #include "ssh.h" | 27 | #include "ssh.h" |
28 | 28 | ||
29 | char *get_progname(char *argv0) | ||
30 | { | ||
31 | #ifdef HAVE___PROGNAME | ||
32 | extern char *__progname; | ||
33 | |||
34 | return __progname; | ||
35 | #else | ||
36 | char *p; | ||
37 | |||
38 | if (argv0 == NULL) | ||
39 | return "unknown"; /* XXX */ | ||
40 | p = strrchr(argv0, '/'); | ||
41 | if (p == NULL) | ||
42 | p = argv0; | ||
43 | else | ||
44 | p++; | ||
45 | return p; | ||
46 | #endif | ||
47 | } | ||
48 | |||
29 | #ifndef HAVE_SETLOGIN | 49 | #ifndef HAVE_SETLOGIN |
30 | int setlogin(const char *name) | 50 | int setlogin(const char *name) |
31 | { | 51 | { |