diff nick2ldif.cpp @ 10:a818f3c2e589

fix tree walk, we now use the item counts in the node blocks
author carl
date Fri, 17 Feb 2006 15:48:38 -0800
parents 8dd68d722fa8
children
line wrap: on
line diff
--- a/nick2ldif.cpp	Sun Jul 31 18:41:06 2005 -0700
+++ b/nick2ldif.cpp	Fri Feb 17 15:48:38 2006 -0800
@@ -12,61 +12,60 @@
 #include <unistd.h>
 
 char *ldap_base  = NULL;
-char *ldap_org   = NULL;
+char *ldap_org	 = NULL;
 char *ldap_class = NULL;
 
 using namespace std;
 
 int main(int argc, char** argv) {
-    char c;
-    char *temp;
-    while ((c = getopt(argc, argv, "b:c:"))!= -1) {
-        switch (c) {
-        case 'b':
-            ldap_base = optarg;
-            temp = strchr(ldap_base, ',');
-            if (temp) {
-                *temp = '\0';
-                ldap_org = strdup(ldap_base);
-                *temp = ',';
-            }
-            break;
-        case 'c':
-            ldap_class = optarg;
-            break;
-        default:
-            break;
-        }
-    }
+	char c;
+	char *temp;
+	while ((c = getopt(argc, argv, "b:c:"))!= -1) {
+		switch (c) {
+		case 'b':
+			ldap_base = optarg;
+			temp = strchr(ldap_base, ',');
+			if (temp) {
+				*temp = '\0';
+				ldap_org = strdup(ldap_base);
+				*temp = ',';
+			}
+			break;
+		case 'c':
+			ldap_class = optarg;
+			break;
+		default:
+			break;
+		}
+	}
 
-    char *delim = " \t";
-    const int LINE_SIZE = 2000;
-    char line[LINE_SIZE];
-    while (!cin.eof()) {
-        cin.getline(line, LINE_SIZE);
-        int n = strlen(line);
-        if (!n) continue;
-        char *f = line + 6;     // skip alias keyword
-        char *e;
-        if (*f == '"') {
-            f++;
-            e = strchr(f, '"');
-        }
-        else {
-            e = strchr(f, ' ');
-        }
-        if (!e) continue;
-        *e = '\0';
-        char *m = e+1;
-        while (*m == ' ') m++;
-        if (*m != '\0') {
-            char cn[1000];
-            snprintf(cn, sizeof(cn), "email %s", f);
-            printf("dn: cn=%s, %s\n", cn, ldap_base);
-            printf("cn: %s\n", cn);
-            printf("sn: %s\n", f);
-            printf("mail: %s\n", m);
-            printf("objectClass: %s\n\n", ldap_class);
-        }
-    }
+	const int LINE_SIZE = 2000;
+	char line[LINE_SIZE];
+	while (!cin.eof()) {
+		cin.getline(line, LINE_SIZE);
+		int n = strlen(line);
+		if (!n) continue;
+		char *f = line + 6; 	// skip alias keyword
+		char *e;
+		if (*f == '"') {
+			f++;
+			e = strchr(f, '"');
+		}
+		else {
+			e = strchr(f, ' ');
+		}
+		if (!e) continue;
+		*e = '\0';
+		char *m = e+1;
+		while (*m == ' ') m++;
+		if (*m != '\0') {
+			char cn[1000];
+			snprintf(cn, sizeof(cn), "email %s", f);
+			printf("dn: cn=%s, %s\n", cn, ldap_base);
+			printf("cn: %s\n", cn);
+			printf("sn: %s\n", f);
+			printf("mail: %s\n", m);
+			printf("objectClass: %s\n\n", ldap_class);
+		}
+	}
 }