aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/ldap2csv.c
diff options
context:
space:
mode:
authorDavid M. Syzdek <syzdek@bindlebinaries.com>2015-12-28 10:26:28 -0900
committerDavid M. Syzdek <syzdek@bindlebinaries.com>2015-12-28 10:26:28 -0900
commit2493b8bc92176b2bc3864723611954d18a15f8a6 (patch)
tree213c285a608aa737a805631143227bd301249077 /src/ldap2csv.c
parent34e5737dad103cdebce45e7716a686d396497e3b (diff)
downloadldap-utils-2493b8bc92176b2bc3864723611954d18a15f8a6.tar.gz
ldap-utils-2493b8bc92176b2bc3864723611954d18a15f8a6.tar.bz2
ldap-utils-2493b8bc92176b2bc3864723611954d18a15f8a6.tar.xz
ldap-utils-2493b8bc92176b2bc3864723611954d18a15f8a6.zip
Refactoring LdapUtilsConfig to lutils_config
Diffstat (limited to 'src/ldap2csv.c')
-rw-r--r--src/ldap2csv.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ldap2csv.c b/src/ldap2csv.c
index 8328579..95dc9f3 100644
--- a/src/ldap2csv.c
+++ b/src/ldap2csv.c
@@ -102,7 +102,7 @@
102typedef struct my_config MyConfig; 102typedef struct my_config MyConfig;
103struct my_config 103struct my_config
104{ 104{
105 LdapUtilsConfig common; 105 lutils_config common;
106 char output[LDAPUTILS_OPT_LEN]; 106 char output[LDAPUTILS_OPT_LEN];
107}; 107};
108 108
@@ -159,15 +159,15 @@ int main(int argc, char * argv[])
159 159
160 if (!(ld = ldaputils_initialize(&cnf->common))) 160 if (!(ld = ldaputils_initialize(&cnf->common)))
161 { 161 {
162 ldaputils_config_free((LdapUtilsConfig *)cnf); 162 ldaputils_config_free((lutils_config *)cnf);
163 free(cnf); 163 free(cnf);
164 return(1); 164 return(1);
165 }; 165 };
166 166
167 if ((ldaputils_search(ld, (LdapUtilsConfig *)cnf, &res))) 167 if ((ldaputils_search(ld, (lutils_config *)cnf, &res)))
168 { 168 {
169 ldap_unbind_ext_s(ld, NULL, NULL); 169 ldap_unbind_ext_s(ld, NULL, NULL);
170 ldaputils_config_free((LdapUtilsConfig *)cnf); 170 ldaputils_config_free((lutils_config *)cnf);
171 free(cnf); 171 free(cnf);
172 return(1); 172 return(1);
173 }; 173 };
@@ -178,16 +178,16 @@ int main(int argc, char * argv[])
178 printf(",\"%s\"", cnf->common.attrs[x]); 178 printf(",\"%s\"", cnf->common.attrs[x]);
179 printf("\n"); 179 printf("\n");
180 180
181 if (!(entries = ldaputils_get_entries(ld, res, ((LdapUtilsConfig *)cnf)->sortattr))) 181 if (!(entries = ldaputils_get_entries(ld, res, ((lutils_config *)cnf)->sortattr)))
182 { 182 {
183 ldap_msgfree(res); 183 ldap_msgfree(res);
184 ldap_unbind_ext_s(ld, NULL, NULL); 184 ldap_unbind_ext_s(ld, NULL, NULL);
185 ldaputils_config_free((LdapUtilsConfig *)cnf); 185 ldaputils_config_free((lutils_config *)cnf);
186 free(cnf); 186 free(cnf);
187 return(1); 187 return(1);
188 }; 188 };
189 189
190 if ( ((LdapUtilsConfig *)cnf)->sortattr ) 190 if ( ((lutils_config *)cnf)->sortattr )
191 ldaputils_sort_entries(entries); 191 ldaputils_sort_entries(entries);
192 192
193 for(x = 0; entries[x]; x++) 193 for(x = 0; entries[x]; x++)
@@ -198,7 +198,7 @@ int main(int argc, char * argv[])
198 { 198 {
199 ldap_msgfree(res); 199 ldap_msgfree(res);
200 ldap_unbind_ext_s(ld, NULL, NULL); 200 ldap_unbind_ext_s(ld, NULL, NULL);
201 ldaputils_config_free((LdapUtilsConfig *)cnf); 201 ldaputils_config_free((lutils_config *)cnf);
202 free(cnf); 202 free(cnf);
203 return(1); 203 return(1);
204 }; 204 };
@@ -215,7 +215,7 @@ int main(int argc, char * argv[])
215 215
216 ldap_msgfree(res); 216 ldap_msgfree(res);
217 ldap_unbind_ext_s(ld, NULL, NULL); 217 ldap_unbind_ext_s(ld, NULL, NULL);
218 ldaputils_config_free((LdapUtilsConfig *)cnf); 218 ldaputils_config_free((lutils_config *)cnf);
219 free(cnf); 219 free(cnf);
220 220
221 return(0); 221 return(0);
@@ -252,12 +252,12 @@ int my_config(int argc, char * argv[], MyConfig ** cnfp)
252 }; 252 };
253 memset(cnf, 0, sizeof(MyConfig)); 253 memset(cnf, 0, sizeof(MyConfig));
254 254
255 ldaputils_config_init((LdapUtilsConfig *) cnf); 255 ldaputils_config_init((lutils_config *) cnf);
256 256
257 // loops through args 257 // loops through args
258 while((c = getopt_long(argc, argv, short_options, long_options, &option_index)) != -1) 258 while((c = getopt_long(argc, argv, short_options, long_options, &option_index)) != -1)
259 { 259 {
260 switch(ldaputils_cmdargs((LdapUtilsConfig *) cnf, c, optarg)) 260 switch(ldaputils_cmdargs((lutils_config *) cnf, c, optarg))
261 { 261 {
262 case -2: return(0); // shared option exit without error 262 case -2: return(0); // shared option exit without error
263 case -1: break; // no more arguments 263 case -1: break; // no more arguments