1999-09-08 15:06:24 -04:00
|
|
|
/* $OpenLDAP$ */
|
1999-08-17 15:00:59 -04:00
|
|
|
/*
|
2002-01-04 16:17:25 -05:00
|
|
|
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
1999-08-17 15:00:59 -04:00
|
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "portable.h"
|
|
|
|
|
|
|
|
|
|
#include <ac/stdlib.h>
|
|
|
|
|
#include <ac/string.h>
|
2001-12-17 21:54:49 -05:00
|
|
|
#include <ac/unistd.h>
|
2001-12-17 23:52:55 -05:00
|
|
|
#ifdef HAVE_IO_H
|
|
|
|
|
#include <io.h>
|
|
|
|
|
#endif
|
2001-12-17 21:48:20 -05:00
|
|
|
#ifdef HAVE_FCNTL_H
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#endif
|
1999-08-17 15:00:59 -04:00
|
|
|
|
2000-06-07 14:49:36 -04:00
|
|
|
#include <lber.h>
|
1999-08-17 15:00:59 -04:00
|
|
|
#include <lutil.h>
|
|
|
|
|
#include <ldap_defaults.h>
|
|
|
|
|
|
|
|
|
|
char* lutil_progname( const char* name, int argc, char *argv[] )
|
|
|
|
|
{
|
|
|
|
|
char *progname;
|
|
|
|
|
|
|
|
|
|
if(argc == 0) {
|
2000-06-07 02:33:59 -04:00
|
|
|
return ber_strdup( name );
|
1999-08-17 15:00:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
progname = strrchr ( argv[0], *LDAP_DIRSEP );
|
2000-06-07 02:33:59 -04:00
|
|
|
progname = ber_strdup( progname ? &progname[1] : argv[0] );
|
1999-08-17 15:00:59 -04:00
|
|
|
|
|
|
|
|
return progname;
|
|
|
|
|
}
|
2001-06-15 00:16:55 -04:00
|
|
|
|
|
|
|
|
#ifndef HAVE_MKSTEMP
|
|
|
|
|
int mkstemp( char * template )
|
|
|
|
|
{
|
2001-12-17 21:54:49 -05:00
|
|
|
#ifdef HAVE_MKTEMP
|
2001-12-17 21:48:20 -05:00
|
|
|
return open ( mktemp ( template ), O_RDWR|O_CREAT|O_EXCL, 0600 );
|
2001-12-17 21:54:49 -05:00
|
|
|
#else
|
2001-12-17 21:55:38 -05:00
|
|
|
return -1;
|
2001-12-17 21:54:49 -05:00
|
|
|
#endif
|
2001-06-15 00:16:55 -04:00
|
|
|
}
|
2001-10-11 00:01:45 -04:00
|
|
|
#endif
|