/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
#include "portable.h"
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <ac/string.h>
#include <ac/time.h>
-#include "lber.h"
-#include "ldap.h"
+#include "ldap-int.h"
char *
-ldap_friendly_name( char *filename, char *uname, FriendlyMap **map )
+ldap_friendly_name(
+ LDAP_CONST char *filename,
+ /* LDAP_CONST */ char *uname,
+ LDAPFriendlyMap **map )
{
int i, entries;
FILE *fp;
char buf[BUFSIZ];
if ( map == NULL ) {
-#if !defined( MACOS ) && !defined( DOS )
errno = EINVAL;
-#endif
return( uname );
}
}
rewind( fp );
- if ( (*map = (FriendlyMap *) malloc( (entries + 1) *
- sizeof(FriendlyMap) )) == NULL ) {
+ if ( (*map = (LDAPFriendlyMap *) malloc( (entries + 1) *
+ sizeof(LDAPFriendlyMap) )) == NULL ) {
fclose( fp );
return( uname );
}
}
}
- (*map)[i].f_unfriendly = strdup( buf );
- (*map)[i].f_friendly = strdup( s );
+ (*map)[i].lf_unfriendly = strdup( buf );
+ (*map)[i].lf_friendly = strdup( s );
i++;
}
fclose( fp );
- (*map)[i].f_unfriendly = NULL;
+ (*map)[i].lf_unfriendly = NULL;
}
- for ( i = 0; (*map)[i].f_unfriendly != NULL; i++ ) {
- if ( strcasecmp( uname, (*map)[i].f_unfriendly ) == 0 )
- return( (*map)[i].f_friendly );
+ for ( i = 0; (*map)[i].lf_unfriendly != NULL; i++ ) {
+ if ( strcasecmp( uname, (*map)[i].lf_unfriendly ) == 0 )
+ return( (*map)[i].lf_friendly );
}
return( uname );
}
void
-ldap_free_friendlymap( FriendlyMap **map )
+ldap_free_friendlymap( LDAPFriendlyMap **map )
{
- struct friendly* pF = *map;
+ LDAPFriendlyMap* pF = *map;
if ( pF == NULL )
return;
- while ( pF->f_unfriendly )
+ while ( pF->lf_unfriendly )
{
- free( pF->f_unfriendly );
- free( pF->f_friendly );
+ free( pF->lf_unfriendly );
+ free( pF->lf_friendly );
pF++;
}
free( *map );