]> git.sur5r.net Git - openldap/blobdiff - contrib/saucer/main.c
Use ldap_<set/get>_option instead of poking into the LDAP structure
[openldap] / contrib / saucer / main.c
index b664c5a10fb9316467b632ca38b0c313d73c0602..4028904dfd06ceda2f5d5820041f739549027d99 100644 (file)
@@ -322,20 +322,22 @@ int cmd_set(char **cmdargv, int cmdargc)
                        case 0:
                                if ((++i < cmdargc)  &&
                                        (j = table_lookup(cmdargv[i], alias_opts, sizeof(alias_opts) / sizeof(alias_opts[0]))) >= 0)
-                                       ld->ld_deref = j;
+                                       ldap_set_option(ld, LDAP_OPT_DEREF, &j);
                                else
                                        errflag = 1;
                                break;
                        case 1:
-                               if (++i < cmdargc)
-                                       ld->ld_sizelimit = atoi(cmdargv[i]);
-                               else
+                               if (++i < cmdargc) {
+                                       j = atoi(cmdargv[i]);
+                                       ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &j);
+                               } else
                                        errflag = 1;
                                break;
                        case 2:
-                               if (++i < cmdargc)
-                                       ld->ld_timelimit = atoi(cmdargv[i]);
-                               else
+                               if (++i < cmdargc) {
+                                       j = atoi(cmdargv[i]);
+                                       ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &j);
+                               } else
                                        errflag = 1;
                                break;
                        default:
@@ -347,11 +349,16 @@ int cmd_set(char **cmdargv, int cmdargc)
 
        if (errflag)
                show_syntax(CMD_SET);
-       else
+       else {
+               int opt_a, opt_s, opt_t;
+               ldap_get_option(ld, LDAP_OPT_DEREF, &opt_a);
+               ldap_get_option(ld, LDAP_OPT_SIZELIMIT, &opt_s);
+               ldap_get_option(ld, LDAP_OPT_TIMELIMIT, &opt_t);
                printf("Alias dereferencing is %s, Sizelimit is %d entr%s, Timelimit is %d second%s.\n",
-                          alias_opts[ld->ld_deref],
-                          ld->ld_sizelimit, ld->ld_sizelimit == 1 ? "y" : "ies",
-                          ld->ld_timelimit, ld->ld_timelimit == 1 ? ""  : "s");
+                      alias_opts[opt_a],
+                      opt_s, opt_s == 1 ? "y" : "ies",
+                      opt_t, opt_t == 1 ? ""  : "s");
+       }
 
        return 0;
 }
@@ -532,7 +539,7 @@ int is_whitespace(register char *s)
        if (!s)
                return 1;
 
-       while (*s  &&  isspace(*s))
+       while (*s  &&  isspace((unsigned char) *s))
                ++s;
 
        return !*s;
@@ -634,7 +641,7 @@ char *skip_to_whitespace(register char *s)
        if (!s)
                return s;
 
-       while (*s  &&  !isspace(*s))
+       while (*s  &&  !isspace((unsigned char) *s))
                ++s;
 
        return s;
@@ -645,7 +652,7 @@ char *skip_whitespace(register char *s)
        if (!s)
                return s;
 
-       while (*s  &&  isspace(*s))
+       while (*s  &&  isspace((unsigned char) *s))
                ++s;
 
        return s;