1N/A * Copyright (c) 2001 by Sun Microsystems, Inc. 1N/A * All rights reserved. 1N/A#
pragma ident "%Z%%M% %I% %E% SMI" 1N/A * The contents of this file are subject to the Netscape Public 1N/A * License Version 1.1 (the "License"); you may not use this file 1N/A * except in compliance with the License. You may obtain a copy of 1N/A * Software distributed under the License is distributed on an "AS 1N/A * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 1N/A * implied. See the License for the specific language governing 1N/A * rights and limitations under the License. 1N/A * The Original Code is Mozilla Communicator client code, released 1N/A * The Initial Developer of the Original Code is Netscape 1N/A * Communications Corporation. Portions created by Netscape are 1N/A * Copyright (C) 1998-1999 Netscape Communications Corporation. All 1N/A * tmplout.c: display template library output routines for LDAP clients 1N/A#
include <
time.h>
/* for struct tm and ctime */ 1N/A/* This is totally lame, since it should be coming from time.h, but isn't. */ 1N/A char *
buf,
/* NULL for "use internal" */ 1N/A char *
buf,
/* NULL for "use internal" */ 1N/A char *
buf,
/* NULL for use-internal */ 1N/A char *
base,
/* used for search actions */ 1N/A * add HTML intro. and title 1N/A * add "Move Up" link 1N/A "%s\">Move Up To <EM>%s</EM></A>%s<BR>",
1N/A * here (but what should we do if there was one?) 1N/A * don't bother even calling do_vals2text() if no values 1N/A * or boolean with value false and "hide if false" option set 1N/A char *
dn,
/* if NULL, use entry */ 1N/A char *
base,
/* if NULL, no search actions */ 1N/A char *
dn,
/* if NULL, use entry */ 1N/A char *
base,
/* if NULL, no search actions */ 1N/A char *
dn,
/* if NULL, use entry */ 1N/A char *
base,
/* if NULL, no search actions */ 1N/A char *
buf,
/* NULL for "use internal" */ 1N/A char *
buf,
/* NULL for "use internal" */ 1N/A char *
buf,
/* NULL for "use internal" */ 1N/A break;
/* we only bother with these two types... */ 1N/A for ( p =
vals[ i ]; *p !=
'\0'; ++p ) {
1N/A "(unable to display non-ASCII text value)")
1N/A * at this point `s' points to the label & `p' to the URL 1N/A " Can't display item type %ld%s"),
1N/A ( c >=
'@' && c <=
'Z' ) || \
1N/A ( c >=
'a' && c <=
'z' ))
1N/A for ( q =
s2; *q !=
'\0'; ++q ) {
1N/A *p++ =
hexdig[
0x0F & ((*(
unsigned char*)q) >>
4) ];
1N/A/* CTIME for this platform doesn't use this. */ 1N/A if (
len >
15 ) {
/* throw away excess from 4-digit year time string */ 1N/A len =
13;
/* assume we have a time w/2-digit year (len=13) */ 1N/A /* 2 digit years...assumed to be in the range (19)70 through 1N/A (20)69 ...less than 70 (for now, 38) means 20xx */ 1N/A if ((
zone = *p ) ==
'Z' ) {
/* GMT */ 1N/A zone =
'\0';
/* no need to indicate on screen, so we make it null */ 1N/A#
endif /* !macintosh */ 1N/A/* gtime(): the inverse of localtime(). 1N/A This routine was supplied by Mike Accetta at CMU many years ago. 1N/A 31,
28,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31 1N/A (((y) %
4) ?
365 : (((y) %
100) ?
366 : (((y) %
400) ?
365 :
366)))
1N/A#define YEAR(y) ((y) >= 100 ? (y) : (y) + 1900) 1N/A#
define YEAR(y) (((y) <
1900) ? ((y) +
1900) : (y))
1N/A * if we are generating HTML, we add an HREF link that embodies this 1N/A * search action as an LDAP URL, instead of actually doing the search