From: Predrag "Pele" Balorda Date: Thu, 26 Nov 1998 13:23:06 +0000 (+0000) Subject: Updates: command-line parsing of parameters for server, port and baseDN. Started... X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~1018 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fd5cafd2d8573ff88c9e0421268533ef1405f8c4;p=openldap Updates: command-line parsing of parameters for server, port and baseDN. Started ChangeLog, updated TODO and README. --- diff --git a/contrib/gtk-tool/README b/contrib/gtk-tool/README index 35f0660548..fd9a625cb3 100644 --- a/contrib/gtk-tool/README +++ b/contrib/gtk-tool/README @@ -1,13 +1,33 @@ -This is the first version of this README -gtk-tool v0.5delta +README for gtk-tool v0.6 This package has been tested and run with the latest Gtk+/Gtk-- OpenLDAP 1.1-devel. This thing doesn't run as it should, please read TODO! +Just type 'make' to compile and if you have all the necessary stuff it'll do so. +You do need the latest version of Gtk+ and Gtk-- (which may be tricky to build). +After that, hopefully all goes well, you start the thing by doing: +./main + +It will default to base of o=University of Michigan, c=US", localhost, and +LDAP_PORT (389). This is because OpenLDAP comes with the UMICH ldif and the +assumption is that many of you have actually created a test db with that data +(to see that people don't lie when they say OpenLDAP actually works or +something). If you want to change any of these do ./main -h and it will give +you a list of supported parameters. + +In short this is what you can do: + +./main -h ldap-server.somewhere.net -p 28345 -b "o=OpenLDAP Foundation, c=US" + I really couldn't think of anything else to put here (at the moment that is). But please feel free to add whatever else you consider neccessary to understanding how this thing works. Enjoy, and I hope this can be useful to you in some miniscule way. +All emails to -devel list, and plase make sure you put "GTK-TOOL" +in the subject line, so other people who are not interested don't +have to read our garbage. + Pele +pele@openldap.org diff --git a/contrib/gtk-tool/TODO b/contrib/gtk-tool/TODO index a9ce70d042..27d85943a9 100644 --- a/contrib/gtk-tool/TODO +++ b/contrib/gtk-tool/TODO @@ -1,22 +1,18 @@ LOADS!!! -Someone please figure out how to _remove_ a widget from a container -in Gtk+/Gtk--. As far as I know, and from my discussion with a -certain person, it can't due to a design flaw of Gtk+ people. We -need that first to be able to continue. The bug is reproducable -when you start the thing, it automatically goes to the top node, -i.e. University of Michigan, if you expand the tree a bit, then -click on any one of the items available, it'll blow. That's because -it needs to remove the contents in the right side of the browser -window to be able to insert new things about the current node. And -I didn't want to be an idiot and do it by some other means, because, -as they've taught me in school, OO programming is meant to be used -in a black-box fashion. If all else fails, then we'll start thinking -about stupid solutions and their consenquences. No pun intended. +Priorities: + Make it useful! + Implement searches + Some sort of config-file parsing (not new files, but existing + slapd-config stuff) + port to autoconf (anyone? it should be easy) -All emails to -devel list, and plase make sure you put "GTK-TOOL" -in the subject line, so other people who are not interested don't -have to read our garbage. +Optional: + comments in the source code + figure out how to insert nice little icons infront of every + tree item on the left side. + port it to NT so we can use it with the NT port of OpenLDAP + (is there a NT port of Gtk+?) Pele pele@openldap.org diff --git a/contrib/gtk-tool/main.cc b/contrib/gtk-tool/main.cc index 40a9ef5029..224a8bcd20 100644 --- a/contrib/gtk-tool/main.cc +++ b/contrib/gtk-tool/main.cc @@ -13,18 +13,38 @@ int main(int argc, char **argv) { Gtk_LdapTreeItem *treeitem; LDAPMessage **thing; LDAP *ld; - char *base_dn; + char *host = NULL; + char *base_dn = NULL; + int c, port = 0; + + while ((c = getopt(argc, argv, "b:s:p:h")) != -1) { + switch (c) { + case 'b': + base_dn = optarg; break; + case 's': + host = strdup(optarg); break; + case 'p': + port = atoi(optarg); break; + case 'h': + default: + fprintf(stderr, "Usage: %s [-s server] [-p port] [-b base_dn]\n", argv[0]); + exit(-1); + } + } + + if (base_dn == NULL) base_dn = "o=University of Michigan, c=US"; + if (host == NULL) host = "localhost"; + if (port == 0) port = LDAP_PORT; Gtk_Main m(&argc, &argv); window = new My_Window(GTK_WINDOW_TOPLEVEL); - if ((ld = ldap_open("localhost", LDAP_PORT))==NULL) { + if ((ld = ldap_open(host, port)) == NULL) { perror("connection"); } tree = new Gtk_Tree(); - base_dn = "o=University of Michigan, c=US"; treeresult = window->make_tree(window, ld, base_dn); treeitem = new Gtk_LdapTreeItem(*treeresult->treeitem); tree->append(treeitem);