#include "portable.h"
#include <stdio.h>
-#include <stdlib.h>
+
+#include <ac/stdlib.h>
#ifdef HAVE_READLINE
# include <readline/readline.h>
void do_commands(FILE *file);
int is_whitespace(register char *s);
char *make_dn(char *dn, int relative);
-void show_syntax(int cmdnum);
+void show_syntax(unsigned int cmdnum);
char *skip_to_char(register char *s, register int c);
char *skip_to_whitespace(register char *s);
char *skip_whitespace(register char *s);
int cmd_help(char **cmdargv, int cmdargc)
{
- int i;
+ unsigned int i;
if (cmdargc == 2) {
for (i = 0; i < sizeof(cmdtable) / sizeof(cmdtable[0]); i++)
int cmd_show(char **cmdargv, int cmdargc)
{
char *dn = NULL;
- LDAPMessage *entry;
int errflag = 0;
int i;
static const char *const opts[] = { "absolute" };
for (entry = ldap_first_entry(ld, result); entry; entry = ldap_next_entry(ld, entry)) {
if (s = ldap_get_dn(ld, entry)) {
printf(" %s\n", s);
- free(s);
+ ldap_memfree(s);
}
/* Make one pass to calculate the length of the longest attribute name */
case 'd':
#ifdef LDAP_DEBUG
tmp = atoi(optarg);
- lber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &tmp);
+ ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &tmp);
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &tmp);
#endif
break;
rc = user_tailor();
- if (!(ld = ldap_open(hostname, portnum))) {
- fprintf(stderr, "%s: unable to connect to server at host `%s' on port %d\n",
+ if (!(ld = ldap_init(hostname, portnum))) {
+ fprintf(stderr, "%s: unable to initialize LDAP session (%s:%d)\n",
progname, hostname, portnum);
exit(2);
}
char *make_dn(char *dn, int relative)
{
static char dn_buf[DN_MAXLEN];
- char *s;
if (!dn)
dn = "";
return strcat(strcat(strcpy(dn_buf, dn), ", "), default_dn);
}
-void show_syntax(int cmdnum)
+void show_syntax(unsigned int cmdnum)
{
printf("Syntax: %s %s\n", cmdtable[cmdnum].cmd, cmdtable[cmdnum].help_msg);
}