/*
* Copyright (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* tmplout.c: display template library output routines for LDAP clients
*
*/
#include "ldap-int.h"
#include "disptmpl.h"
#include <time.h> /* for struct tm and ctime */
#endif
/* This is totally lame, since it should be coming from time.h, but isn't. */
#if defined(SOLARIS)
#endif
int
char *buf, /* NULL for "use internal" */
struct ldap_disptmpl *tmpl,
char **defattrs,
char ***defvals,
void *writeparm,
char *eol,
int rdncount,
unsigned long opts
)
{
}
int
char *buf, /* NULL for "use internal" */
struct ldap_disptmpl *tmpl,
char **defattrs,
char ***defvals,
void *writeparm,
char *eol,
int rdncount,
unsigned long opts,
char *base,
char *urlprefix
)
{
}
}
static int
char *buf, /* NULL for use-internal */
char *base, /* used for search actions */
struct ldap_disptmpl *tmpl,
char **defattrs,
char ***defvals,
void *writeparm,
char *eol,
int rdncount,
unsigned long opts,
char *urlprefix /* if non-NULL, do HTML */
)
{
if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) {
return( LDAP_PARAM_ERROR );
}
return( err );
}
}
NSLDAPI_FREE( dn );
return( err );
}
freebuf = 1;
} else {
freebuf = 0;
}
if ( html ) {
/*
* add HTML intro. and title
*/
if (!(( opts & LDAP_DISP_OPT_HTMLBODYONLY ) != 0 )) {
}
if (( opts & LDAP_DISP_OPT_NONLEAF ) != 0 &&
char *untagged;
/*
* add "Move Up" link
*/
if ( i > 1 ) {
}
}
} else {
untagged = "=The World";
}
"%s\">Move Up To <EM>%s</EM></A>%s<BR>",
/*
* add "Browse" link
*/
ldap_value_free( vals );
}
} else {
}
} else {
}
err = LDAP_SUCCESS;
char *attr;
freevals = 0;
break;
}
}
}
}
} else {
freevals = 1;
}
}
if ( freevals ) {
ldap_value_free( vals );
}
}
}
/*
* XXX check for errors in ldap_first_attribute/ldap_next_attribute
* here (but what should we do if there was one?)
*/
} else {
freevals = 0;
if ( !LDAP_IS_TMPLITEM_OPTION_SET( colp,
== 0 ) {
break;
}
}
}
}
} else {
freevals = 1;
if ( LDAP_IS_TMPLITEM_OPTION_SET( colp,
}
}
/*
* don't bother even calling do_vals2text() if no values
* or boolean with value false and "hide if false" option set
*/
show = 0;
}
if (( opts & LDAP_DISP_OPT_DOSEARCHACTIONS ) != 0 ) {
}
}
show = 0;
}
if ( show ) {
}
if ( freevals ) {
ldap_value_free( vals );
}
}
}
}
}
NSLDAPI_FREE( dn );
if ( freebuf ) {
NSLDAPI_FREE( buf );
}
return( err );
}
int
char *dn, /* if NULL, use entry */
char *base, /* if NULL, no search actions */
char **defattrs,
char ***defvals,
void *writeparm,
char *eol,
int rdncount, /* if 0, display full DN */
unsigned long opts
)
{
}
int
char *dn, /* if NULL, use entry */
char *base, /* if NULL, no search actions */
char **defattrs,
char ***defvals,
void *writeparm,
char *eol,
int rdncount, /* if 0, display full DN */
unsigned long opts,
char *urlprefix
)
{
}
static int
char *dn, /* if NULL, use entry */
char *base, /* if NULL, no search actions */
char **defattrs,
char ***defvals,
void *writeparm,
char *eol,
int rdncount, /* if 0, display full DN */
unsigned long opts,
char *urlprefix
)
{
if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) {
return( LDAP_PARAM_ERROR );
}
return( err );
}
return( err );
}
freedn = 0;
NSLDAPI_FREE( buf );
}
freedn = 1;
}
ocattrs[0] = OCATTRNAME;
#ifdef CLDAP
if ( LDAP_IS_CLDAP( ld ))
else
#endif /* CLDAP */
if ( err == LDAP_SUCCESS ) {
}
}
ldap_value_free( vals );
}
}
ldap_msgfree( ldmp );
}
}
fetchattrs = NULL;
} else {
}
#ifdef CLDAP
if ( LDAP_IS_CLDAP( ld ))
else
#endif /* CLDAP */
if ( freedn ) {
NSLDAPI_FREE( dn );
}
if ( fetchattrs != NULL ) {
}
if ( err != LDAP_SUCCESS ||
NSLDAPI_FREE( buf );
}
NSLDAPI_FREE( buf );
ldap_msgfree( ldmp );
return( err );
}
int
char *buf, /* NULL for "use internal" */
char **vals,
char *label,
int labelwidth, /* 0 means use default */
unsigned long syntaxid,
void *writeparm,
char *eol,
int rdncount
)
{
}
int
char *buf, /* NULL for "use internal" */
char **vals,
char *label,
int labelwidth, /* 0 means use default */
unsigned long syntaxid,
void *writeparm,
char *eol,
int rdncount,
char *urlprefix
)
{
}
}
static int
char *buf, /* NULL for "use internal" */
char **vals,
char *label,
int labelwidth, /* 0 means use default */
unsigned long syntaxid,
void *writeparm,
char *eol,
int rdncount,
char *urlprefix
)
{
char *p, *s, *outval;
return( LDAP_PARAM_ERROR );
}
return( LDAP_SUCCESS );
}
switch( LDAP_GET_SYN_TYPE( syntaxid )) {
case LDAP_SYN_TYPE_TEXT:
case LDAP_SYN_TYPE_BOOLEAN:
break; /* we only bother with these two types... */
default:
return( LDAP_SUCCESS );
}
if ( labelwidth == 0 || labelwidth < 0 ) {
}
return( err );
}
freebuf = 1;
} else {
freebuf = 0;
}
for ( p = vals[ i ]; *p != '\0'; ++p ) {
if ( !isascii( *p )) {
break;
}
}
notascii = ( *p != '\0' );
"(unable to display non-ASCII text value)")
: vals[ i ];
writeoutval = 0; /* if non-zero, write outval after switch */
switch( syntaxid ) {
case LDAP_SYN_CASEIGNORESTR:
++writeoutval;
break;
case LDAP_SYN_RFC822ADDR:
if ( html ) {
} else {
++writeoutval;
}
break;
case LDAP_SYN_DN: /* for now */
break;
case LDAP_SYN_MULTILINESTR:
if ( i > 0 && !html ) {
}
p = s = outval;
*s++ = '\0';
while ( ldap_utf8isspace( s )) {
++s;
}
if ( html ) {
} else {
}
p = s;
}
outval = p;
++writeoutval;
break;
case LDAP_SYN_BOOLEAN:
++writeoutval;
break;
case LDAP_SYN_TIME:
case LDAP_SYN_DATE:
++writeoutval;
break;
case LDAP_SYN_LABELEDURL:
*p++ = '\0';
while ( ldap_utf8isspace( p )) {
++p;
}
s = outval;
*s++ = '\0';
while ( ldap_utf8isspace( s )) {
++s;
}
p = outval;
} else {
s = "URL";
p = outval;
}
/*
* at this point `s' points to the label & `p' to the URL
*/
if ( html ) {
} else {
}
break;
default:
" Can't display item type %ld%s"),
}
if ( writeoutval ) {
if ( html ) {
} else {
}
}
}
if ( freebuf ) {
NSLDAPI_FREE( buf );
}
return( LDAP_SUCCESS );
}
static int
{
maxlen = 0;
}
}
}
return( maxlen );
}
static int
{
char *p;
if ( html ) {
} else {
auto size_t w;
*p++ = ' ';
}
*p = '\0';
}
}
static int
{
char **dnrdns;
int i;
return( -1 );
}
} else if ( width > 0 ) {
} else {
*buf = '\0';
}
++i ) {
if ( i > 0 ) {
}
}
}
}
( c >= '@' && c <= 'Z' ) || \
( c == '_' ) || \
( c >= 'a' && c <= 'z' ))
static void
{
char *p, *q;
for ( q = s2; *q != '\0'; ++q ) {
if ( HREF_CHAR_ACCEPTABLE( *q )) {
*p++ = *q;
} else {
*p++ = '%';
*p++ = hexdig[ 0x0F & *q ];
}
}
*p = '\0';
}
static char *
{
int len;
struct tm t;
/* CTIME for this platform doesn't use this. */
#endif
return( fmterr );
}
len = 15;
} else if ( len == 14 ) {
}
if ( !isdigit( *p )) {
return( fmterr );
}
}
p = ldtimestr;
if ( len == 15 ) {
}
else {
/* 2 digit years...assumed to be in the range (19)70 through
(20)69 ...less than 70 (for now, 38) means 20xx */
if(t.tm_year < 70) {
t.tm_year += 100;
}
}
}
if ( dateonly ) {
}
return( timestr );
}
/* gtime.c - inverse gmtime */
#endif /* !macintosh */
/* gtime(): the inverse of localtime().
This routine was supplied by Mike Accetta at CMU many years ago.
*/
static int dmsize[] = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
#define dysize(y) \
(((y) % 4) ? 365 : (((y) % 100) ? 366 : (((y) % 400) ? 365 : 366)))
/*
#define YEAR(y) ((y) >= 100 ? (y) : (y) + 1900)
*/
/* */
{
register int i,
sec,
mins,
hour,
mday,
mon,
year;
register long result;
return ((long) -1);
if (hour == 24) {
hour = 0;
mday++;
}
result = 0L;
for (i = 1970; i < year; i++)
result++;
while (--mon)
return result;
}
static int
{
;
}
if ( i < 3 ) {
return( LDAP_PARAM_ERROR );
}
return( LDAP_PARAM_ERROR );
} else {
}
if ( html ) {
/*
* if we are generating HTML, we add an HREF link that embodies this
* search action as an LDAP URL, instead of actually doing the search
* now.
*/
}
return( LDAP_LOCAL_ERROR );
}
return( LDAP_SUCCESS );
}
#ifdef CLDAP
if ( LDAP_IS_CLDAP( ld ))
else
#endif /* CLDAP */
* sizeof(char *))) == NULL ) {
} else {
}
}
}
ldap_msgfree( ldmp );
}
ldap_value_free( vals );
}
}