]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/tmplout.c
LDAP C-API changes
[openldap] / libraries / libldap / tmplout.c
index 308745ec84bc3d90e92edb64743bbfc38047a8bf..94cc00c1393068c4e0d53eaa4651f06986a28b8c 100644 (file)
@@ -8,9 +8,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include <ac/socket.h>
-#include <ac/string.h>
 #include <ac/ctype.h>
+#include <ac/string.h>
 #include <ac/time.h>
 
 #ifdef HAVE_SYS_FILE_H
 
 #include "lber.h"
 #include "ldap.h"
+
+#include "ldap_log.h"
 #include "disptmpl.h"
 
+#include "ldap-int.h"
 #include "ldapconfig.h"
 
+/* local functions */
 static int do_entry2text LDAP_P((
        LDAP *ld, char *buf, char *base, LDAPMessage *entry,
        struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
@@ -193,7 +196,7 @@ do_entry2text(
            sprintf( buf + strlen( buf ),
                    "%s\">Move Up To <EM>%s</EM></A>%s<BR>",
                    ( vals[ 1 ] == NULL ) ? "??one" : "",
-                   ( untagged != NULL ) ? untagged + 1 : vals[ 1 ], eol, eol );
+                   ( untagged != NULL ) ? untagged + 1 : vals[ 1 ], eol );
            (*writeproc)( writeparm, buf, strlen( buf ));
 
            /*
@@ -249,9 +252,7 @@ do_entry2text(
                freevals = 1;
            }
 
-           if ( islower( *attr )) {    /* cosmetic -- upcase attr. name */
-               *attr = toupper( *attr );
-           }
+               *attr = TOUPPER( *attr );
 
            err = do_vals2text( ld, buf, vals, attr, labelwidth,
                    LDAP_SYN_CASEIGNORESTR, writeproc, writeparm, eol, 
@@ -300,14 +301,14 @@ do_entry2text(
                if ( show && LDAP_GET_SYN_TYPE( colp->ti_syntaxid )
                        == LDAP_SYN_TYPE_BOOLEAN && LDAP_IS_TMPLITEM_OPTION_SET(
                        colp, LDAP_DITEM_OPT_HIDEIFFALSE ) &&
-                       toupper( vals[ 0 ][ 0 ] ) != 'T' ) {
+                       TOUPPER( vals[ 0 ][ 0 ] ) != 'T' ) {
                    show = 0;
                }
 
                if ( colp->ti_syntaxid == LDAP_SYN_SEARCHACTION ) {
                    if (( opts & LDAP_DISP_OPT_DOSEARCHACTIONS ) != 0 ) {
                        if ( colp->ti_attrname == NULL || ( show &&
-                               toupper( vals[ 0 ][ 0 ] ) == 'T' )) {
+                               TOUPPER( vals[ 0 ][ 0 ] ) == 'T' )) {
                            err = searchaction( ld, buf, base, entry, dn, colp,
                                    labelwidth, rdncount, writeproc,
                                    writeparm, eol, urlprefix );
@@ -687,7 +688,7 @@ do_vals2text(
            break;
 
        case LDAP_SYN_BOOLEAN:
-           outval = toupper( outval[ 0 ] ) == 'T' ? "TRUE" : "FALSE";
+           outval = TOUPPER( outval[ 0 ] ) == 'T' ? "TRUE" : "FALSE";
            ++writeoutval;
            break;
 
@@ -873,6 +874,7 @@ time2text( char *ldtimestr, int dateonly )
     struct tm          t;
     char               *p, *timestr, zone, *fmterr = "badly formatted time";
     time_t             gmttime;
+    char               timebuf[32];
 
     memset( (char *)&t, 0, sizeof( struct tm ));
     if ( (int) strlen( ldtimestr ) < 13 ) {
@@ -898,8 +900,9 @@ time2text( char *ldtimestr, int dateonly )
     }
 
     gmttime = gtime( &t );
-    timestr = ctime( &gmttime );
 
+    timestr = ldap_int_ctime( &gmttime, timebuf );
+   
     timestr[ strlen( timestr ) - 1 ] = zone;   /* replace trailing newline */
     if ( dateonly ) {
        strcpy( timestr + 11, timestr + 20 );
@@ -911,11 +914,6 @@ time2text( char *ldtimestr, int dateonly )
 
 
 /* gtime.c - inverse gmtime */
-
-#if !defined( MACOS ) && !defined( _WIN32 ) && !defined( DOS )
-#include <sys/time.h>
-#endif /* !MACOS */
-
 /* gtime(): the inverse of localtime().
        This routine was supplied by Mike Accetta at CMU many years ago.
  */