Back to index

courier  0.68.2
Functions
ldapsearch.c File Reference
#include "libldapsearch.h"
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>

Go to the source code of this file.

Functions

static int cb (const char *utf8_name, const char *address, void *callback_arg)
int main (int argc, char **argv)

Function Documentation

static int cb ( const char *  utf8_name,
const char *  address,
void *  callback_arg 
) [static]

Definition at line 12 of file ldapsearch.c.

{
       if (strchr(utf8_name, '\n') == NULL &&
           strchr(address, '\n') == NULL)
              /* filter out if it looks funny */

              printf("%s\n%s\n", utf8_name, address);
       return 0;
}

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 24 of file ldapsearch.c.

{
       const char *host, *port, *suffix, *search;
       int port_n;
       struct ldapsearch *s;

       if (argc < 5)
       {
              fprintf(stderr, "INTERNAL ERROR: Invalid # of parameters to ldapsearch\n");
              exit(1);
       }

       host=argv[1];
       port=argv[2];
       suffix=argv[3];
       search=argv[4];

       port_n=atoi(port);

       if (port_n <= 0)
              port_n=LDAP_PORT;

       s=l_search_alloc(host, port_n, argc > 5 ? argv[5]:NULL,
                      argc > 6 ?argv[6]:NULL, suffix);

       if (!s)
       {
              perror("l_search_alloc");
              exit(1);
       }

       if (l_search_do(s, search, cb, NULL))
       {
              perror("l_search_do");
              exit(1);
       }
       l_search_free(s);
       exit(0);
}

Here is the call graph for this function: