]> git.sur5r.net Git - openldap/blob - libraries/liblutil/utils.c
8bd298facfceadf7632c1da70d39c4eb82fa6a92
[openldap] / libraries / liblutil / utils.c
1 /*
2  * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
3  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
4  */
5
6 #include "portable.h"
7
8 #include <ac/stdlib.h>
9 #include <ac/string.h>
10
11 #include <lutil.h>
12 #include <ldap_defaults.h>
13
14 char* lutil_progname( const char* name, int argc, char *argv[] )
15 {
16         char *progname;
17
18         if(argc == 0) {
19                 return strdup( name );
20         }
21
22         progname = strrchr ( argv[0], *LDAP_DIRSEP );
23         progname = strdup( progname ? &progname[1] : argv[0] );
24
25         return progname;
26 }