webcit-dfsg.orig/ 0000755 0001750 0001750 00000000000 13223654433 014006 5 ustar michael michael webcit-dfsg.orig/serv_func.c 0000644 0001750 0001750 00000040115 13223341037 016136 0 ustar michael michael
#include "webcit.h"
#include "webserver.h"
int is_uds = 0;
char serv_sock_name[PATH_MAX] = "";
HashList *EmbeddableMimes = NULL;
StrBuf *EmbeddableMimeStrs = NULL;
void SetInlinMimeRenderers(void)
{
StrBuf *Buf;
Buf = NewStrBuf();
/* Tell the server what kind of richtext we prefer */
serv_putbuf(EmbeddableMimeStrs);
StrBuf_ServGetln(Buf);
FreeStrBuf(&Buf);
}
void DeleteServInfo(ServInfo **FreeMe)
{
if (*FreeMe == NULL)
return;
FreeStrBuf(&(*FreeMe)->serv_nodename);
FreeStrBuf(&(*FreeMe)->serv_humannode);
FreeStrBuf(&(*FreeMe)->serv_fqdn);
FreeStrBuf(&(*FreeMe)->serv_software);
FreeStrBuf(&(*FreeMe)->serv_bbs_city);
FreeStrBuf(&(*FreeMe)->serv_sysadm);
FreeStrBuf(&(*FreeMe)->serv_default_cal_zone);
FreeStrBuf(&(*FreeMe)->serv_svn_revision);
free(*FreeMe);
*FreeMe = NULL;
}
/*
* get info about the server we've connected to
*
* browser_host the citadel we want to connect to
* user_agent which browser uses our client?
*/
ServInfo *get_serv_info(StrBuf *browser_host, StrBuf *user_agent)
{
ServInfo *info;
StrBuf *Buf;
int a;
int rc;
Buf = NewStrBuf();
/* Tell the server what kind of client is connecting */
serv_printf("IDEN %d|%d|%d|%s|%s",
DEVELOPER_ID,
CLIENT_ID,
CLIENT_VERSION,
ChrPtr(user_agent),
ChrPtr(browser_host)
);
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, NULL) != 2) {
syslog(LOG_WARNING, "get_serv_info(IDEN): unexpected answer [%s]\n",
ChrPtr(Buf));
FreeStrBuf(&Buf);
return NULL;
}
/*
* Tell the server that when we save a calendar event, we
* want invitations to be generated by the Citadel server
* instead of by the client.
*/
serv_puts("ICAL sgi|1");
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, NULL) != 2) {
syslog(LOG_WARNING, "get_serv_info(ICAL sgi|1): unexpected answer [%s]\n",
ChrPtr(Buf));
FreeStrBuf(&Buf);
return NULL;
}
/* Now ask the server to tell us a little bit about itself... */
serv_puts("INFO");
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, NULL) != 1) {
syslog(LOG_WARNING, "get_serv_info(INFO sgi|1): unexpected answer [%s]\n",
ChrPtr(Buf));
FreeStrBuf(&Buf);
return NULL;
}
info = (ServInfo*)malloc(sizeof(ServInfo));
memset(info, 0, sizeof(ServInfo));
a = 0;
while (rc = StrBuf_ServGetln(Buf),
(rc >= 0) &&
((rc != 3) ||
strcmp(ChrPtr(Buf), "000")))
{
switch (a) {
case 0:
info->serv_pid = StrToi(Buf);
WC->ctdl_pid = info->serv_pid;
break;
case 1:
info->serv_nodename = NewStrBufDup(Buf);
break;
case 2:
info->serv_humannode = NewStrBufDup(Buf);
break;
case 3:
info->serv_fqdn = NewStrBufDup(Buf);
break;
case 4:
info->serv_software = NewStrBufDup(Buf);
break;
case 5:
info->serv_rev_level = StrToi(Buf);
break;
case 6:
info->serv_bbs_city = NewStrBufDup(Buf);
break;
case 7:
info->serv_sysadm = NewStrBufDup(Buf);
break;
case 14:
info->serv_supports_ldap = StrToi(Buf);
break;
case 15:
info->serv_newuser_disabled = StrToi(Buf);
break;
case 16:
info->serv_default_cal_zone = NewStrBufDup(Buf);
break;
case 20:
info->serv_supports_sieve = StrToi(Buf);
break;
case 21:
info->serv_fulltext_enabled = StrToi(Buf);
break;
case 22:
info->serv_svn_revision = NewStrBufDup(Buf);
break;
case 23:
info->serv_supports_openid = StrToi(Buf);
break;
case 24:
info->serv_supports_guest = StrToi(Buf);
break;
}
++a;
}
FreeStrBuf(&Buf);
return info;
}
int GetConnected (void)
{
StrBuf *Buf;
wcsession *WCC = WC;
if (WCC->ReadBuf == NULL)
WCC->ReadBuf = NewStrBufPlain(NULL, SIZ * 4);
if (is_uds) /* unix domain socket */
WCC->serv_sock = uds_connectsock(serv_sock_name);
else /* tcp socket */
WCC->serv_sock = tcp_connectsock(ctdlhost, ctdlport);
if (WCC->serv_sock < 0) {
WCC->connected = 0;
FreeStrBuf(&WCC->ReadBuf);
return 1;
}
else {
long Status;
int short_status;
Buf = NewStrBuf();
WCC->connected = 1;
StrBuf_ServGetln(Buf); /* get the server greeting */
short_status = GetServerStatus(Buf, &Status);
FreeStrBuf(&Buf);
/* Server isn't ready for us? */
if (short_status != 2) {
if (Status == 551) {
hprintf("HTTP/1.1 503 Service Unavailable\r\n");
hprintf("Content-type: text/plain; charset=utf-8\r\n");
wc_printf(_("This server is already serving its maximum number of users and cannot accept any additional logins at this time. Please try again later or contact your system administrator."));
}
else {
wc_printf("%ld %s\n",
Status,
_("Received unexpected answer from Citadel server; bailing out.")
);
hprintf("HTTP/1.1 502 Bad Gateway\r\n");
hprintf("Content-type: text/plain; charset=utf-8\r\n");
}
end_burst();
end_webcit_session();
return 1;
}
/*
* From what host is our user connecting? Go with
* the host at the other end of the HTTP socket,
* unless we are following X-Forwarded-For: headers
* and such a header has already turned up something.
*/
if ( (!follow_xff) || (StrLength(WCC->Hdr->HR.browser_host) == 0) ) {
if (WCC->Hdr->HR.browser_host == NULL) {
WCC->Hdr->HR.browser_host = NewStrBuf();
Put(WCC->Hdr->HTTPHeaders, HKEY("FreeMeWithTheOtherHeaders"),
WCC->Hdr->HR.browser_host, HFreeStrBuf);
}
locate_host(WCC->Hdr->HR.browser_host, WCC->Hdr->http_sock);
}
if (WCC->serv_info == NULL) {
WCC->serv_info = get_serv_info(WCC->Hdr->HR.browser_host, WCC->Hdr->HR.user_agent);
}
if (WCC->serv_info == NULL){
begin_burst();
wc_printf(_("Received unexpected answer from Citadel server; bailing out."));
hprintf("HTTP/1.1 502 Bad Gateway\r\n");
hprintf("Content-type: text/plain; charset=utf-8\r\n");
end_burst();
end_webcit_session();
return 1;
}
if (WCC->serv_info->serv_rev_level < MINIMUM_CIT_VERSION) {
begin_burst();
wc_printf(_("You are connected to a Citadel "
"server running Citadel %d.%02d. \n"
"In order to run this version of WebCit "
"you must also have Citadel %d.%02d or"
" newer.\n\n\n"),
WCC->serv_info->serv_rev_level / 100,
WCC->serv_info->serv_rev_level % 100,
MINIMUM_CIT_VERSION / 100,
MINIMUM_CIT_VERSION % 100
);
hprintf("HTTP/1.1 200 OK\r\n");
hprintf("Content-type: text/plain; charset=utf-8\r\n");
end_burst();
end_webcit_session();
return 1;
}
SetInlinMimeRenderers();
}
return 0;
}
void FmOut(StrBuf *Target, const char *align, const StrBuf *Source)
{
const char *ptr, *pte;
const char *BufPtr = NULL;
StrBuf *Line = NewStrBufPlain(NULL, SIZ);
StrBuf *Line1 = NewStrBufPlain(NULL, SIZ);
StrBuf *Line2 = NewStrBufPlain(NULL, SIZ);
int bn = 0;
int bq = 0;
int i;
long len;
int intext = 0;
StrBufAppendPrintf(Target, "
\n", align);
if (StrLength(Source) > 0)
do
{
StrBufSipLine(Line, Source, &BufPtr);
bq = 0;
i = 0;
ptr = ChrPtr(Line);
len = StrLength(Line);
pte = ptr + len;
if ((intext == 1) && (isspace(*ptr))) {
StrBufAppendBufPlain(Target, HKEY(" "), 0);
}
intext = 1;
if (isspace(*ptr)) while ((ptr < pte) &&
((*ptr == '>') ||
isspace(*ptr)))
{
if (*ptr == '>')
bq++;
ptr ++;
i++;
}
/*
* Quoted text should be displayed in italics and in a
* different colour. This code understands Citadel-style
* " >" quotes and will convert to
tags.
*/
if (i > 0) StrBufCutLeft(Line, i);
for (i = bn; i < bq; i++)
StrBufAppendBufPlain(Target, HKEY("
"), 0);
for (i = bq; i < bn; i++)
StrBufAppendBufPlain(Target, HKEY("
"), 0);
bn = bq;
if (StrLength(Line) == 0)
continue;
/* Activate embedded URL's */
UrlizeText(Line1, Line, Line2);
StrEscAppend(Target, Line1, NULL, 0, 0);
StrBufAppendBufPlain(Target, HKEY("\n"), 0);
}
while ((BufPtr != StrBufNOTNULL) &&
(BufPtr != NULL));
for (i = 0; i < bn; i++) {
StrBufAppendBufPlain(Target, HKEY("
"), 0);
}
StrBufAppendBufPlain(Target, HKEY("
\n"), 0);
FreeStrBuf(&Line);
FreeStrBuf(&Line1);
FreeStrBuf(&Line2);
}
/*
* Transmit message text (in memory) to the server.
*/
void text_to_server(char *ptr)
{
char buf[256];
int ch, a, pos, len;
pos = 0;
buf[0] = 0;
while (ptr[pos] != 0) {
ch = ptr[pos++];
if (ch == 10) {
len = strlen(buf);
while ( (isspace(buf[len - 1]))
&& (buf[0] != '\0')
&& (buf[1] != '\0') )
buf[--len] = 0;
serv_puts(buf);
buf[0] = 0;
if (ptr[pos] != 0) strcat(buf, " ");
} else {
a = strlen(buf);
buf[a + 1] = 0;
buf[a] = ch;
if ((ch == 32) && (strlen(buf) > 200)) {
buf[a] = 0;
serv_puts(buf);
buf[0] = 0;
}
if (strlen(buf) > 250) {
serv_puts(buf);
buf[0] = 0;
}
}
}
serv_puts(buf);
}
/*
* Transmit message text (in memory) to the server, converting to Quoted-Printable encoding as we go.
*/
void text_to_server_qp(const StrBuf *SendMeEncoded)
{
StrBuf *ServBuf;
ServBuf = StrBufRFC2047encodeMessage(SendMeEncoded);
serv_putbuf(ServBuf);
FreeStrBuf(&ServBuf);
}
/*
* translate server message output to text (used for editing room info files and such)
*/
void server_to_text()
{
char buf[SIZ];
int count = 0;
while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
if ((buf[0] == 32) && (count > 0)) {
wc_printf("\n");
}
wc_printf("%s", buf);
++count;
}
}
/*
* Read text from server, appending to a string buffer until the
* usual 000 terminator is found. Caller is responsible for freeing
* the returned pointer.
*/
int read_server_text(StrBuf *Buf, long *nLines)
{
wcsession *WCC = WC;
StrBuf *ReadBuf;
long nRead;
long nTotal = 0;
long nlines;
nlines = 0;
ReadBuf = NewStrBuf();
while ((WCC->serv_sock!=-1) &&
(nRead = StrBuf_ServGetln(ReadBuf), (nRead >= 0) &&
((nRead != 3)||(strcmp(ChrPtr(ReadBuf), "000") != 0))))
{
StrBufAppendBuf(Buf, ReadBuf, 0);
StrBufAppendBufPlain(Buf, HKEY("\n"), 0);
nTotal += nRead;
nlines ++;
}
FreeStrBuf(&ReadBuf);
*nLines = nlines;
return nTotal;
}
int GetServerStatusMsg(StrBuf *Line, long* FullState, int PutImportantMessage, int MajorOK)
{
int rc;
if (FullState != NULL)
*FullState = StrTol(Line);
rc = ChrPtr(Line)[0] - 48;
if ((!PutImportantMessage) ||
(MajorOK == rc)||
(StrLength(Line) <= 4))
return rc;
AppendImportantMessage(ChrPtr(Line) + 4, StrLength(Line) - 4);
return rc;
}
void tmplput_serv_ip(StrBuf *Target, WCTemplputParams *TP)
{
StrBufAppendPrintf(Target, "%d", WC->ctdl_pid);
}
void tmplput_serv_admin(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC->serv_info == NULL)
return;
StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_sysadm, 0);
}
void tmplput_serv_nodename(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC->serv_info == NULL)
return;
StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_nodename, 0);
}
void tmplput_serv_humannode(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC->serv_info == NULL)
return;
StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_humannode, 0);
}
void tmplput_serv_fqdn(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC->serv_info == NULL)
return;
StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_fqdn, 0);
}
void tmplput_serv_software(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC->serv_info == NULL)
return;
StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_software, 0);
}
void tmplput_serv_rev_level(StrBuf *Target, WCTemplputParams *TP)
{
if (WC->serv_info == NULL) return;
StrBufAppendPrintf(Target, "%d", WC->serv_info->serv_rev_level);
}
int conditional_serv_newuser_disabled(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC->serv_info == NULL)
return 0;
return WCC->serv_info->serv_newuser_disabled != 0;
}
int conditional_serv_supports_guest(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC->serv_info == NULL)
return 0;
return WCC->serv_info->serv_supports_guest != 0;
}
int conditional_serv_supports_openid(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC->serv_info == NULL)
return 0;
return WCC->serv_info->serv_supports_openid != 0;
}
int conditional_serv_fulltext_enabled(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC->serv_info == NULL)
return 0;
return WCC->serv_info->serv_fulltext_enabled != 0;
}
int conditional_serv_ldap_enabled(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC->serv_info == NULL)
return 0;
return WCC->serv_info->serv_supports_ldap != 0;
}
void tmplput_serv_bbs_city(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC->serv_info == NULL)
return;
StrBufAppendTemplate(Target, TP, WC->serv_info->serv_bbs_city, 0);
}
void tmplput_mesg(StrBuf *Target, WCTemplputParams *TP)
{
int n = 0;
int Done = 0;
StrBuf *Line;
StrBuf *Buf;
Buf = NewStrBuf();
Line = NewStrBuf();
serv_printf("MESG %s", TP->Tokens->Params[0]->Start);
StrBuf_ServGetln(Line);
if (GetServerStatus(Line, NULL) == 1) {
while (!Done && (StrBuf_ServGetln(Line)>=0)) {
if ( (StrLength(Line)==3) &&
!strcmp(ChrPtr(Line), "000"))
Done = 1;
else
{
if (n > 0)
StrBufAppendBufPlain(Buf, "\n", 1, 0);
StrBufAppendBuf(Buf, Line, 0);
}
n++;
}
FlushStrBuf(Line);
FmOut(Line, "center", Buf);
StrBufAppendTemplate(Target, TP, Line, 1);
}
FreeStrBuf(&Buf);
FreeStrBuf(&Line);
}
void tmplput_site_prefix(StrBuf *Target, WCTemplputParams *TP) {
wcsession *WCC = WC;
if ((WCC != NULL) && (WCC->Hdr->HostHeader != NULL)) {
StrBufAppendTemplate(Target, TP, WCC->Hdr->HostHeader, 0);
}
}
void RegisterEmbeddableMimeType(const char *MimeType, long MTLen, int Priority)
{
StrBuf *MT;
MT = NewStrBufPlain(MimeType, MTLen);
Put(EmbeddableMimes, IKEY(Priority), MT, HFreeStrBuf);
}
void CreateMimeStr(void)
{
HashPos *it;
void *vMime;
long len = 0;
const char *Key;
it = GetNewHashPos(EmbeddableMimes, 0);
while (GetNextHashPos(EmbeddableMimes, it, &len, &Key, &vMime) &&
(vMime != NULL)) {
if (StrLength(EmbeddableMimeStrs) > 0)
StrBufAppendBufPlain(EmbeddableMimeStrs, HKEY("|"), 0);
else
StrBufAppendBufPlain(EmbeddableMimeStrs, HKEY("MSGP "), 0);
StrBufAppendBuf(EmbeddableMimeStrs, (StrBuf*) vMime, 0);
}
DeleteHashPos(&it);
}
void
ServerStartModule_SERV_FUNC
(void)
{
EmbeddableMimes = NewHash(1, Flathash);
EmbeddableMimeStrs = NewStrBuf();
}
void
ServerShutdownModule_SERV_FUNC
(void)
{
FreeStrBuf(&EmbeddableMimeStrs);
DeleteHash(&EmbeddableMimes);
}
void
InitModule_SERVFUNC
(void)
{
is_uds = strcasecmp(ctdlhost, "uds") == 0;
if (is_uds)
snprintf(serv_sock_name, PATH_MAX, "%s/citadel.socket", ctdlport);
RegisterConditional("COND:SERV:OPENID", 2, conditional_serv_supports_openid, CTX_NONE);
RegisterConditional("COND:SERV:NEWU", 2, conditional_serv_newuser_disabled, CTX_NONE);
RegisterConditional("COND:SERV:FULLTEXT_ENABLED", 2, conditional_serv_fulltext_enabled, CTX_NONE);
RegisterConditional("COND:SERV:LDAP_ENABLED", 2, conditional_serv_ldap_enabled, CTX_NONE);
RegisterConditional("COND:SERV:SUPPORTS_GUEST", 2, conditional_serv_supports_guest, CTX_NONE);
RegisterNamespace("SERV:PID", 0, 0, tmplput_serv_ip, NULL, CTX_NONE);
RegisterNamespace("SERV:NODENAME", 0, 1, tmplput_serv_nodename, NULL, CTX_NONE);
RegisterNamespace("SERV:HUMANNODE", 0, 1, tmplput_serv_humannode, NULL, CTX_NONE);
RegisterNamespace("SERV:FQDN", 0, 1, tmplput_serv_fqdn, NULL, CTX_NONE);
RegisterNamespace("SERV:SOFTWARE", 0, 1, tmplput_serv_software, NULL, CTX_NONE);
RegisterNamespace("SERV:REV_LEVEL", 0, 0, tmplput_serv_rev_level, NULL, CTX_NONE);
RegisterNamespace("SERV:BBS_CITY", 0, 1, tmplput_serv_bbs_city, NULL, CTX_NONE);
RegisterNamespace("SERV:MESG", 1, 2, tmplput_mesg, NULL, CTX_NONE);
RegisterNamespace("SERV:ADMIN", 0, 1, tmplput_serv_admin, NULL, CTX_NONE);
RegisterNamespace("SERV:SITE:PREFIX", 0, 1, tmplput_site_prefix, NULL, CTX_NONE);
}
void
SessionDestroyModule_SERVFUNC
(wcsession *sess)
{
DeleteServInfo(&sess->serv_info);
}
webcit-dfsg.orig/utils.c 0000644 0001750 0001750 00000010124 13223341037 015301 0 ustar michael michael /*
* de/encoding stuff. hopefully mostly to be depricated in favour of subst.c + strbuf
*/
#define SHOW_ME_VAPPEND_PRINTF
#include
#include
#include "webcit.h"
/*
* remove escaped strings from i.e. the url string (like %20 for blanks)
*/
long unescape_input(char *buf)
{
unsigned int a, b;
char hex[3];
long buflen;
long len;
buflen = strlen(buf);
while ((buflen > 0) && (isspace(buf[buflen - 1]))){
buf[buflen - 1] = 0;
buflen --;
}
a = 0;
while (a < buflen) {
if (buf[a] == '+')
buf[a] = ' ';
if (buf[a] == '%') {
/* don't let % chars through, rather truncate the input. */
if (a + 2 > buflen) {
buf[a] = '\0';
buflen = a;
}
else {
hex[0] = buf[a + 1];
hex[1] = buf[a + 2];
hex[2] = 0;
b = 0;
b = decode_hex(hex);
buf[a] = (char) b;
len = buflen - a - 2;
if (len > 0)
memmove(&buf[a + 1], &buf[a + 3], len);
buflen -=2;
}
}
a++;
}
return a;
}
/*
* Copy a string, escaping characters which have meaning in HTML.
*
* target target buffer
* strbuf source buffer
* nbsp If nonzero, spaces are converted to non-breaking spaces.
* nolinebreaks if set, linebreaks are removed from the string.
*/
long stresc(char *target, long tSize, char *strbuf, int nbsp, int nolinebreaks)
{
char *aptr, *bptr, *eptr;
*target = '\0';
aptr = strbuf;
bptr = target;
eptr = target + tSize - 6; /* our biggest unit to put in... */
while ((bptr < eptr) && !IsEmptyStr(aptr) ){
if (*aptr == '<') {
memcpy(bptr, "<", 4);
bptr += 4;
}
else if (*aptr == '>') {
memcpy(bptr, ">", 4);
bptr += 4;
}
else if (*aptr == '&') {
memcpy(bptr, "&", 5);
bptr += 5;
}
else if (*aptr == '\"') {
memcpy(bptr, """, 6);
bptr += 6;
}
else if (*aptr == '\'') {
memcpy(bptr, "'", 5);
bptr += 5;
}
else if (*aptr == LB) {
*bptr = '<';
bptr ++;
}
else if (*aptr == RB) {
*bptr = '>';
bptr ++;
}
else if (*aptr == QU) {
*bptr ='"';
bptr ++;
}
else if ((*aptr == 32) && (nbsp == 1)) {
memcpy(bptr, " ", 6);
bptr += 6;
}
else if ((*aptr == '\n') && (nolinebreaks)) {
*bptr='\0'; /* nothing */
}
else if ((*aptr == '\r') && (nolinebreaks)) {
*bptr='\0'; /* nothing */
}
else{
*bptr = *aptr;
bptr++;
}
aptr ++;
}
*bptr = '\0';
if ((bptr = eptr - 1 ) && !IsEmptyStr(aptr) )
return -1;
return (bptr - target);
}
/*
* static wrapper for ecsputs1
*/
void escputs(const char *strbuf)
{
StrEscAppend(WC->WBuf, NULL, strbuf, 0, 0);
}
/*
* urlescape buffer and print it to the client
*/
void urlescputs(const char *strbuf)
{
StrBufUrlescAppend(WC->WBuf, NULL, strbuf);
}
/**
* urlescape buffer and print it as header
*/
void hurlescputs(const char *strbuf)
{
StrBufUrlescAppend(WC->HBuf, NULL, strbuf);
}
/*
* Output a string to the client as a CDATA block
*/
void cdataout(char *rawdata)
{
char *ptr = rawdata;
wc_printf("", 3)) {
wc_printf("]]]]>");
++ptr; ++ptr; ++ptr;
}
else {
wc_printf("%c", ptr[0]);
++ptr;
}
}
wc_printf("]]>");
}
webcit-dfsg.orig/smtpqueue.c 0000644 0001750 0001750 00000030222 13223341037 016172 0 ustar michael michael /*
* Display the outbound SMTP queue
*/
#include "webcit.h"
CtxType CTX_MAILQITEM = CTX_NONE;
CtxType CTX_MAILQ_RCPT = CTX_NONE;
HashList *QItemHandlers = NULL;
typedef struct _mailq_entry {
StrBuf *Recipient;
StrBuf *StatusMessage;
int Status;
/**<
* 0 = No delivery has yet been attempted
* 2 = Delivery was successful
* 3 = Transient error like connection problem. Try next remote if available.
* 4 = A transient error was experienced ... try again later
* 5 = Delivery to this address failed permanently. The error message
* should be placed in the fourth field so that a bounce message may
* be generated.
*/
int n;
int Active;
}MailQEntry;
typedef struct queueitem {
long MessageID;
long QueMsgID;
long Submitted;
int FailNow;
HashList *MailQEntries;
/* copy of the currently parsed item in the MailQEntries list;
* if null add a new one.
*/
MailQEntry *Current;
time_t ReattemptWhen;
time_t Retry;
long ActiveDeliveries;
StrBuf *EnvelopeFrom;
StrBuf *BounceTo;
StrBuf *SenderRoom;
ParsedURL *URL;
ParsedURL *FallBackHost;
} OneQueItem;
typedef void (*QItemHandler)(OneQueItem *Item, StrBuf *Line, const char **Pos);
typedef struct __QItemHandlerStruct {
QItemHandler H;
} QItemHandlerStruct;
void RegisterQItemHandler(const char *Key, long Len, QItemHandler H)
{
QItemHandlerStruct *HS = (QItemHandlerStruct*)malloc(sizeof(QItemHandlerStruct));
HS->H = H;
Put(QItemHandlers, Key, Len, HS, NULL);
}
void FreeMailQEntry(void *qv)
{
MailQEntry *Q = qv;
FreeStrBuf(&Q->Recipient);
FreeStrBuf(&Q->StatusMessage);
free(Q);
}
void FreeQueItem(OneQueItem **Item)
{
DeleteHash(&(*Item)->MailQEntries);
FreeStrBuf(&(*Item)->EnvelopeFrom);
FreeStrBuf(&(*Item)->BounceTo);
FreeStrBuf(&(*Item)->SenderRoom);
FreeURL(&(*Item)->URL);
free(*Item);
Item = NULL;
}
void HFreeQueItem(void *Item)
{
FreeQueItem((OneQueItem**)&Item);
}
OneQueItem *DeserializeQueueItem(StrBuf *RawQItem, long QueMsgID)
{
OneQueItem *Item;
const char *pLine = NULL;
StrBuf *Line;
StrBuf *Token;
Item = (OneQueItem*)malloc(sizeof(OneQueItem));
memset(Item, 0, sizeof(OneQueItem));
Item->Retry = 0;
Item->MessageID = -1;
Item->QueMsgID = QueMsgID;
Token = NewStrBuf();
Line = NewStrBufPlain(NULL, 128);
while (pLine != StrBufNOTNULL) {
const char *pItemPart = NULL;
void *vHandler;
StrBufExtract_NextToken(Line, RawQItem, &pLine, '\n');
if (StrLength(Line) == 0) continue;
StrBufExtract_NextToken(Token, Line, &pItemPart, '|');
if (GetHash(QItemHandlers, SKEY(Token), &vHandler))
{
QItemHandlerStruct *HS;
HS = (QItemHandlerStruct*) vHandler;
HS->H(Item, Line, &pItemPart);
}
}
FreeStrBuf(&Line);
FreeStrBuf(&Token);
/*
Put(ActiveQItems,
LKEY(Item->MessageID),
Item,
HFreeQueItem);
*/
return Item;
}
void tmplput_MailQID(StrBuf *Target, WCTemplputParams *TP)
{
OneQueItem *Item = (OneQueItem*) CTX(CTX_MAILQITEM);
StrBufAppendPrintf(Target, "%ld", Item->QueMsgID);;
}
void tmplput_MailQPayloadID(StrBuf *Target, WCTemplputParams *TP)
{
OneQueItem *Item = (OneQueItem*) CTX(CTX_MAILQITEM);
StrBufAppendPrintf(Target, "%ld", Item->MessageID);
}
void tmplput_MailQBounceTo(StrBuf *Target, WCTemplputParams *TP)
{
OneQueItem *Item = (OneQueItem*) CTX(CTX_MAILQITEM);
StrBufAppendTemplate(Target, TP, Item->BounceTo, 0);
}
void tmplput_MailQAttempted(StrBuf *Target, WCTemplputParams *TP)
{
char datebuf[64];
OneQueItem *Item = (OneQueItem*) CTX(CTX_MAILQITEM);
webcit_fmt_date(datebuf, 64, Item->ReattemptWhen, DATEFMT_BRIEF);
StrBufAppendBufPlain(Target, datebuf, -1, 0);
}
void tmplput_MailQSubmitted(StrBuf *Target, WCTemplputParams *TP)
{
char datebuf[64];
OneQueItem *Item = (OneQueItem*) CTX(CTX_MAILQITEM);
webcit_fmt_date(datebuf, 64, Item->Submitted, DATEFMT_BRIEF);
StrBufAppendBufPlain(Target, datebuf, -1, 0);
}
void tmplput_MailQEnvelopeFrom(StrBuf *Target, WCTemplputParams *TP)
{
OneQueItem *Item = (OneQueItem*) CTX(CTX_MAILQITEM);
StrBufAppendTemplate(Target, TP, Item->EnvelopeFrom, 0);
}
void tmplput_MailQSourceRoom(StrBuf *Target, WCTemplputParams *TP)
{
OneQueItem *Item = (OneQueItem*) CTX(CTX_MAILQITEM);
StrBufAppendTemplate(Target, TP, Item->SenderRoom, 0);
}
int Conditional_MailQ_HaveSourceRoom(StrBuf *Target, WCTemplputParams *TP)
{
OneQueItem *Item = (OneQueItem*) CTX(CTX_MAILQITEM);
return StrLength(Item->SenderRoom) > 0;
}
void tmplput_MailQRetry(StrBuf *Target, WCTemplputParams *TP)
{
char datebuf[64];
OneQueItem *Item = (OneQueItem*) CTX(CTX_MAILQITEM);
if (Item->Retry == 0) {
StrBufAppendBufPlain(Target, _("First Attempt pending"), -1, 0);
}
else {
webcit_fmt_date(datebuf, sizeof(datebuf), Item->Retry, DATEFMT_BRIEF);
StrBufAppendBufPlain(Target, datebuf, -1, 0);
}
}
void tmplput_MailQRCPT(StrBuf *Target, WCTemplputParams *TP)
{
MailQEntry *Entry = (MailQEntry*) CTX(CTX_MAILQ_RCPT);
StrBufAppendTemplate(Target, TP, Entry->Recipient, 0);
}
void tmplput_MailQRCPTStatus(StrBuf *Target, WCTemplputParams *TP)
{
MailQEntry *Entry = (MailQEntry*) CTX(CTX_MAILQ_RCPT);
StrBufAppendPrintf(Target, "%ld", Entry->Status);
}
void tmplput_MailQStatusMsg(StrBuf *Target, WCTemplputParams *TP)
{
MailQEntry *Entry = (MailQEntry*) CTX(CTX_MAILQ_RCPT);
StrBufAppendTemplate(Target, TP, Entry->StatusMessage, 0);
}
HashList *iterate_get_Recipients(StrBuf *Target, WCTemplputParams *TP)
{
OneQueItem *Item = (OneQueItem*) CTX(CTX_MAILQITEM);
return Item->MailQEntries;
}
void NewMailQEntry(OneQueItem *Item)
{
Item->Current = (MailQEntry*) malloc(sizeof(MailQEntry));
memset(Item->Current, 0, sizeof(MailQEntry));
if (Item->MailQEntries == NULL)
Item->MailQEntries = NewHash(1, Flathash);
Item->Current->StatusMessage = NewStrBuf();
Item->Current->n = GetCount(Item->MailQEntries);
Put(Item->MailQEntries,
IKEY(Item->Current->n),
Item->Current,
FreeMailQEntry);
}
void QItem_Handle_MsgID(OneQueItem *Item, StrBuf *Line, const char **Pos)
{
Item->MessageID = StrBufExtractNext_long(Line, Pos, '|');
}
void QItem_Handle_EnvelopeFrom(OneQueItem *Item, StrBuf *Line, const char **Pos)
{
if (Item->EnvelopeFrom == NULL)
Item->EnvelopeFrom = NewStrBufPlain(NULL, StrLength(Line));
StrBufExtract_NextToken(Item->EnvelopeFrom, Line, Pos, '|');
}
void QItem_Handle_BounceTo(OneQueItem *Item, StrBuf *Line, const char **Pos)
{
if (Item->BounceTo == NULL)
Item->BounceTo = NewStrBufPlain(NULL, StrLength(Line));
StrBufExtract_NextToken(Item->BounceTo, Line, Pos, '|');
}
void QItem_Handle_SenderRoom(OneQueItem *Item, StrBuf *Line, const char **Pos)
{
if (Item->SenderRoom == NULL)
Item->SenderRoom = NewStrBufPlain(NULL, StrLength(Line));
StrBufExtract_NextToken(Item->SenderRoom, Line, Pos, '|');
}
void QItem_Handle_Recipient(OneQueItem *Item, StrBuf *Line, const char **Pos)
{
const char *pch;
if (Item->Current == NULL)
NewMailQEntry(Item);
if (Item->Current->Recipient == NULL)
Item->Current->Recipient=NewStrBufPlain(NULL, StrLength(Line));
StrBufExtract_NextToken(Item->Current->Recipient, Line, Pos, '|');
Item->Current->Status = StrBufExtractNext_int(Line, Pos, '|');
StrBufExtract_NextToken(Item->Current->StatusMessage, Line, Pos, '|');
pch = ChrPtr(Item->Current->StatusMessage);
while ((pch != NULL) && (*pch != '\0')) {
pch = strchr(pch, ';');
if (pch != NULL) {
pch ++;
if (*pch == ' ') {
StrBufPeek(Item->Current->StatusMessage,
pch, -1, '\n');
}
}
}
Item->Current = NULL; // TODO: is this always right?
}
void QItem_Handle_retry(OneQueItem *Item, StrBuf *Line, const char **Pos)
{
Item->Retry = StrBufExtractNext_int(Line, Pos, '|');
}
void QItem_Handle_Submitted(OneQueItem *Item, StrBuf *Line, const char **Pos)
{
Item->Submitted = atol(*Pos);
}
void QItem_Handle_Attempted(OneQueItem *Item, StrBuf *Line, const char **Pos)
{
Item->ReattemptWhen = StrBufExtractNext_int(Line, Pos, '|');
}
void render_QUEUE(StrBuf *Target, WCTemplputParams *TP, StrBuf *FoundCharset)
{
wc_mime_attachment *Mime = CTX(CTX_MIME_ATACH);
WCTemplputParams SubTP;
OneQueItem* Context;
Context = DeserializeQueueItem(Mime->Data, Mime->msgnum);
StackContext(TP, &SubTP, Context, CTX_MAILQITEM, 0, TP->Tokens);
{
DoTemplate(HKEY("view_mailq_message"), NULL, &SubTP);
}
UnStackContext(&SubTP);
FreeQueItem (&Context);
}
void
ServerShutdownModule_SMTP_QUEUE
(void)
{
DeleteHash(&QItemHandlers);
}
void
ServerStartModule_SMTP_QUEUE
(void)
{
QItemHandlers = NewHash(0, NULL);
}
int qview_PrintPageHeader(SharedMessageStatus *Stat, void **ViewSpecific)
{
if (yesbstr("ListOnly"))
output_headers(1, 0, 0, 0, 0, 0);
else
output_headers(1, 1, 1, 0, 0, 0);
return 0;
}
int qview_GetParamsGetServerCall(SharedMessageStatus *Stat,
void **ViewSpecific,
long oper,
char *cmd,
long len,
char *filter,
long flen)
{
if (!WC->is_aide)
{
DoTemplate(HKEY("aide_required"), NULL, NULL);
end_burst();
return 300;
}
else {
snprintf(cmd, len, "MSGS ALL|0|1");
snprintf(filter, flen, "SUBJ|QMSG");
if (yesbstr("ListOnly"))
DoTemplate(HKEY("view_mailq_table"), NULL, NULL);
else
DoTemplate(HKEY("view_mailq_header"), NULL, NULL);
return 200;
}
}
/*
* Display task view
*/
int qview_LoadMsgFromServer(SharedMessageStatus *Stat,
void **ViewSpecific,
message_summary* Msg,
int is_new,
int i)
{
wcsession *WCC = WC;
const StrBuf *Mime;
/* Not (yet?) needed here? calview *c = (calview *) *ViewSpecific; */
read_message(WCC->WBuf, HKEY("view_mailq_message_bearer"), Msg->msgnum, NULL, &Mime, NULL);
return 0;
}
int qview_RenderView_or_Tail(SharedMessageStatus *Stat,
void **ViewSpecific,
long oper)
{
wcsession *WCC = WC;
WCTemplputParams SubTP;
memset(&SubTP, 0, sizeof(WCTemplputParams));
if (yesbstr("ListOnly"))
DoTemplate(HKEY("view_mailq_footer_listonly"),NULL, &SubTP);
else
{
if (GetCount(WCC->summ) == 0)
DoTemplate(HKEY("view_mailq_footer_empty"),NULL, &SubTP);
else
DoTemplate(HKEY("view_mailq_footer"),NULL, &SubTP);
}
return 0;
}
int qview_Cleanup(void **ViewSpecific)
{
wDumpContent(yesbstr("ListOnly")?0:1);
return 0;
}
void
InitModule_SMTP_QUEUE
(void)
{
RegisterCTX(CTX_MAILQITEM);
RegisterCTX(CTX_MAILQ_RCPT);
RegisterQItemHandler(HKEY("msgid"), QItem_Handle_MsgID);
RegisterQItemHandler(HKEY("envelope_from"), QItem_Handle_EnvelopeFrom);
RegisterQItemHandler(HKEY("retry"), QItem_Handle_retry);
RegisterQItemHandler(HKEY("attempted"), QItem_Handle_Attempted);
RegisterQItemHandler(HKEY("remote"), QItem_Handle_Recipient);
RegisterQItemHandler(HKEY("bounceto"), QItem_Handle_BounceTo);
RegisterQItemHandler(HKEY("source_room"), QItem_Handle_SenderRoom);
RegisterQItemHandler(HKEY("submitted"), QItem_Handle_Submitted);
RegisterMimeRenderer(HKEY("application/x-citadel-delivery-list"), render_QUEUE, 1, 9000);
RegisterNamespace("MAILQ:ID", 0, 0, tmplput_MailQID, NULL, CTX_MAILQITEM);
RegisterNamespace("MAILQ:PAYLOAD:ID", 0, 0, tmplput_MailQPayloadID, NULL, CTX_MAILQITEM);
RegisterNamespace("MAILQ:BOUNCETO", 0, 1, tmplput_MailQBounceTo, NULL, CTX_MAILQITEM);
RegisterNamespace("MAILQ:ATTEMPTED", 0, 0, tmplput_MailQAttempted, NULL, CTX_MAILQITEM);
RegisterNamespace("MAILQ:SUBMITTED", 0, 0, tmplput_MailQSubmitted, NULL, CTX_MAILQITEM);
RegisterNamespace("MAILQ:ENVELOPEFROM", 0, 1, tmplput_MailQEnvelopeFrom, NULL, CTX_MAILQITEM);
RegisterNamespace("MAILQ:SRCROOM", 0, 1, tmplput_MailQSourceRoom, NULL, CTX_MAILQITEM);
RegisterConditional("COND:MAILQ:HAVESRCROOM", 0, Conditional_MailQ_HaveSourceRoom, CTX_MAILQITEM);
RegisterNamespace("MAILQ:RETRY", 0, 0, tmplput_MailQRetry, NULL, CTX_MAILQITEM);
RegisterNamespace("MAILQ:RCPT:ADDR", 0, 1, tmplput_MailQRCPT, NULL, CTX_MAILQ_RCPT);
RegisterNamespace("MAILQ:RCPT:STATUS", 0, 0, tmplput_MailQRCPTStatus, NULL, CTX_MAILQ_RCPT);
RegisterNamespace("MAILQ:RCPT:STATUSMSG", 0, 1, tmplput_MailQStatusMsg, NULL, CTX_MAILQ_RCPT);
RegisterIterator("MAILQ:RCPT", 0, NULL, iterate_get_Recipients,
NULL, NULL, CTX_MAILQ_RCPT, CTX_MAILQITEM, IT_NOFLAG);
RegisterReadLoopHandlerset(
VIEW_QUEUE,
qview_GetParamsGetServerCall,
qview_PrintPageHeader,
NULL, /* TODO: is this right? */
NULL,
qview_LoadMsgFromServer,
qview_RenderView_or_Tail,
qview_Cleanup,
NULL);
}
webcit-dfsg.orig/ical_subst.c 0000644 0001750 0001750 00000037744 13223341037 016312 0 ustar michael michael /*
* Copyright (c) 1996-2012 by the citadel.org team
*
* This program is open source software. You can redistribute it and/or
* modify it under the terms of the GNU General Public License, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "webcit.h"
extern IcalKindEnumMap icalproperty_kind_map[];
extern IcalMethodEnumMap icalproperty_method_map[];
HashList *IcalComponentMap = NULL;
CtxType CTX_ICAL = CTX_NONE;
CtxType CTX_ICALPROPERTY = CTX_NONE;
CtxType CTX_ICALMETHOD = CTX_NONE;
CtxType CTX_ICALTIME = CTX_NONE;
CtxType CTX_ICALATTENDEE = CTX_NONE;
CtxType CTX_ICALCONFLICT = CTX_NONE;
#if 0
void SortPregetMatter(HashList *Cals)
{
disp_cal *Cal;
void *vCal;
const char *Key;
long KLen;
IcalEnumMap *SortMap[10];
IcalEnumMap *Map;
void *vSort;
const char *Next = NULL;
const StrBuf *SortVector;
StrBuf *SortBy;
int i = 0;
HashPos *It;
SortVector = SBSTR("ICALSortVec");
if (SortVector == NULL)
return;
for (i = 0; i < 10; i++) SortMap[i] = NULL;
SortBy = NewStrBuf();
while (StrBufExtract_NextToken(SortBy, SortVector, &Next, ':') > 0) {
GetHash(IcalComponentMap, SKEY(SortBy), &vSort);
Map = (IcalEnumMap*) vSort;
SortMap[i] = Map;
i++;
if (i > 9)
break;
}
if (i == 0)
return;
switch (SortMap[i - 1]->map) {
/* case */
default:
break;
}
It = GetNewHashPos(Cals, 0);
while (GetNextHashPos(Cals, It, &KLen, &Key, &vCal)) {
i = 0;
Cal = (disp_cal*) vCal;
Cal->Status = icalcomponent_get_status(Cal->cal);
Cal->SortBy = Cal->cal;
while ((SortMap[i] != NULL) &&
(Cal->SortBy != NULL))
{
/****Cal->SortBy = icalcomponent_get_first_property(Cal->SortBy, SortMap[i++]->map); */
}
}
}
#endif
void tmplput_ICalItem(StrBuf *Target, WCTemplputParams *TP)
{
icalcomponent *cal = (icalcomponent *) CTX(CTX_ICAL);
icalproperty *p;
icalproperty_kind Kind;
const char *str;
Kind = (icalproperty_kind) GetTemplateTokenNumber(Target, TP, 0, ICAL_ANY_PROPERTY);
p = icalcomponent_get_first_property(cal, Kind);
if (p != NULL) {
str = icalproperty_get_comment (p);
StrBufAppendTemplateStr(Target, TP, str, 1);
}
}
void tmplput_CtxICalProperty(StrBuf *Target, WCTemplputParams *TP)
{
icalproperty *p = (icalproperty *) CTX(CTX_ICALPROPERTY);
const char *str;
str = icalproperty_get_comment (p);
StrBufAppendTemplateStr(Target, TP, str, 0);
}
int ReleaseIcalSubCtx(StrBuf *Target, WCTemplputParams *TP)
{
WCTemplputParams *TPP = TP;
UnStackContext(TP);
free(TPP);
return 0;
}
int cond_ICalIsA(StrBuf *Target, WCTemplputParams *TP)
{
icalcomponent *cal = (icalcomponent *) CTX(CTX_ICAL);
icalcomponent_kind c = GetTemplateTokenNumber(Target, TP, 2, ICAL_NO_COMPONENT);
return icalcomponent_isa(cal) == c;
}
int cond_ICalHaveItem(StrBuf *Target, WCTemplputParams *TP)
{
icalcomponent *cal = (icalcomponent *) CTX(CTX_ICAL);
icalproperty *p;
icalproperty_kind Kind;
Kind = (icalproperty_kind) GetTemplateTokenNumber(Target, TP, 2, ICAL_ANY_PROPERTY);
p = icalcomponent_get_first_property(cal, Kind);
if (p != NULL) {
WCTemplputParams *DynamicTP;
DynamicTP = (WCTemplputParams*) malloc(sizeof(WCTemplputParams));
StackDynamicContext (TP,
DynamicTP,
p,
CTX_ICALPROPERTY,
0,
TP->Tokens,
ReleaseIcalSubCtx,
TP->Tokens->Params[1]->lvalue);
return 1;
}
return 0;
}
int ReleaseIcalTimeCtx(StrBuf *Target, WCTemplputParams *TP)
{
WCTemplputParams *TPP = TP;
UnStackContext(TP);
free(TPP);
return 0;
}
int cond_ICalHaveTimeItem(StrBuf *Target, WCTemplputParams *TP)
{
icalcomponent *cal = (icalcomponent *) CTX(CTX_ICAL);
icalproperty *p;
icalproperty_kind Kind;
Kind = (icalproperty_kind) GetTemplateTokenNumber(Target, TP, 2, ICAL_ANY_PROPERTY);
p = icalcomponent_get_first_property(cal, Kind);
if (p != NULL) {
struct icaltimetype *t;
struct icaltimetype tt;
WCTemplputParams *DynamicTP;
DynamicTP = (WCTemplputParams*) malloc(sizeof(WCTemplputParams) +
sizeof(struct icaltimetype));
t = (struct icaltimetype *) &DynamicTP[1];
memset(&tt, 0, sizeof(struct icaltimetype));
switch (Kind)
{
case ICAL_DTSTART_PROPERTY:
tt = icalproperty_get_dtstart(p);
break;
case ICAL_DTEND_PROPERTY:
tt = icalproperty_get_dtend(p);
break;
default:
break;
}
memcpy(t, &tt, sizeof(struct icaltimetype));
StackDynamicContext (TP,
DynamicTP,
t,
CTX_ICALTIME,
0,
TP->Tokens,
ReleaseIcalTimeCtx,
TP->Tokens->Params[1]->lvalue);
return 1;
}
return 0;
}
int cond_ICalTimeIsDate(StrBuf *Target, WCTemplputParams *TP)
{
struct icaltimetype *t = (struct icaltimetype *) CTX(CTX_ICALTIME);
return t->is_date;
}
void tmplput_ICalTime_Date(StrBuf *Target, WCTemplputParams *TP)
{
struct tm d_tm;
long len;
char buf[256];
struct icaltimetype *t = (struct icaltimetype *) CTX(CTX_ICALTIME);
memset(&d_tm, 0, sizeof d_tm);
d_tm.tm_year = t->year - 1900;
d_tm.tm_mon = t->month - 1;
d_tm.tm_mday = t->day;
len = wc_strftime(buf, sizeof(buf), "%x", &d_tm);
StrBufAppendBufPlain(Target, buf, len, 0);
}
void tmplput_ICalTime_Time(StrBuf *Target, WCTemplputParams *TP)
{
long len;
char buf[256];
struct icaltimetype *t = (struct icaltimetype *) CTX(CTX_ICALTIME);
time_t tt;
tt = icaltime_as_timet(*t);
len = webcit_fmt_date(buf, sizeof(buf), tt, DATEFMT_FULL);
StrBufAppendBufPlain(Target, buf, len, 0);
}
void tmplput_ICalDate(StrBuf *Target, WCTemplputParams *TP)
{
icalcomponent *cal = (icalcomponent *) CTX(CTX_ICAL);
icalproperty *p;
icalproperty_kind Kind;
struct icaltimetype t;
time_t tt;
char buf[256];
Kind = (icalproperty_kind) GetTemplateTokenNumber(Target, TP, 0, ICAL_ANY_PROPERTY);
p = icalcomponent_get_first_property(cal, Kind);
if (p != NULL) {
long len;
t = icalproperty_get_dtend(p);
tt = icaltime_as_timet(t);
len = webcit_fmt_date(buf, 256, tt, DATEFMT_FULL);
StrBufAppendBufPlain(Target, buf, len, 0);
}
}
void tmplput_CtxICalPropertyDate(StrBuf *Target, WCTemplputParams *TP)
{
icalproperty *p = (icalproperty *) CTX(CTX_ICALPROPERTY);
struct icaltimetype t;
time_t tt;
char buf[256];
long len;
t = icalproperty_get_dtend(p);
tt = icaltime_as_timet(t);
len = webcit_fmt_date(buf, sizeof(buf), tt, DATEFMT_FULL);
StrBufAppendBufPlain(Target, buf, len, 0);
}
void render_MIME_ICS_TPL(StrBuf *Target, WCTemplputParams *TP, StrBuf *FoundCharset)
{
wc_mime_attachment *Mime = CTX(CTX_MIME_ATACH);
icalproperty_method the_method = ICAL_METHOD_NONE;
icalproperty *method = NULL;
icalcomponent *cal = NULL;
icalcomponent *c = NULL;
WCTemplputParams SubTP;
WCTemplputParams SuperTP;
static int divcount = 0;
if (StrLength(Mime->Data) == 0) {
MimeLoadData(Mime);
}
if (StrLength(Mime->Data) > 0) {
cal = icalcomponent_new_from_string(ChrPtr(Mime->Data));
}
if (cal == NULL) {
StrBufAppendPrintf(Mime->Data, _("There was an error parsing this calendar item."));
StrBufAppendPrintf(Mime->Data, " \n");
return;
}
putlbstr("divname", ++divcount);
putbstr("cal_partnum", NewStrBufDup(Mime->PartNum));
putlbstr("msgnum", Mime->msgnum);
memset(&SubTP, 0, sizeof(WCTemplputParams));
memset(&SuperTP, 0, sizeof(WCTemplputParams));
/*//ical_dezonify(cal); */
/* If the component has subcomponents, recurse through them. */
c = icalcomponent_get_first_component(cal, ICAL_ANY_COMPONENT);
c = (c != NULL) ? c : cal;
method = icalcomponent_get_first_property(cal, ICAL_METHOD_PROPERTY);
if (method != NULL) {
the_method = icalproperty_get_method(method);
}
StackContext (TP,
&SuperTP,
&the_method,
CTX_ICALMETHOD,
0,
TP->Tokens);
StackContext (&SuperTP,
&SubTP,
c,
CTX_ICAL,
0,
SuperTP.Tokens);
FlushStrBuf(Mime->Data);
/// DoTemplate(HKEY("ical_attachment_display"), Mime->Data, &SubTP);
DoTemplate(HKEY("ical_edit"), Mime->Data, &SubTP);
/*/ cal_process_object(Mime->Data, cal, 0, Mime->msgnum, ChrPtr(Mime->PartNum)); */
/* Free the memory we obtained from libical's constructor */
StrBufPlain(Mime->ContentType, HKEY("text/html"));
StrBufAppendPrintf(WC->trailing_javascript,
"eventEditAllDay(); \n"
"RecurrenceShowHide(); \n"
"EnableOrDisableCheckButton(); \n"
);
UnStackContext(&SuperTP);
UnStackContext(&SubTP);
icalcomponent_free(cal);
}
void CreateIcalComponendKindLookup(void)
{
int i = 0;
IcalComponentMap = NewHash (1, NULL);
while (icalproperty_kind_map[i].NameLen != 0) {
RegisterNS(icalproperty_kind_map[i].Name,
icalproperty_kind_map[i].NameLen,
0,
10,
tmplput_ICalItem,
NULL,
CTX_ICAL);
Put(IcalComponentMap,
icalproperty_kind_map[i].Name,
icalproperty_kind_map[i].NameLen,
&icalproperty_kind_map[i],
reference_free_handler);
i++;
}
}
int cond_ICalIsMethod(StrBuf *Target, WCTemplputParams *TP)
{
icalproperty_method *the_method = (icalproperty_method *) CTX(CTX_ICALMETHOD);
icalproperty_method which_method;
which_method = GetTemplateTokenNumber(Target, TP, 2, ICAL_METHOD_X);
return *the_method == which_method;
}
typedef struct CalendarConflict
{
long is_update;
long existing_msgnum;
StrBuf *conflict_event_uid;
StrBuf *conflict_event_summary;
}CalendarConflict;
void DeleteConflict(void *vConflict)
{
CalendarConflict *c = (CalendarConflict *) vConflict;
FreeStrBuf(&c->conflict_event_uid);
FreeStrBuf(&c->conflict_event_summary);
free(c);
}
HashList *iterate_FindConflict(StrBuf *Target, WCTemplputParams *TP)
{
StrBuf *Line;
HashList *Conflicts = NULL;
CalendarConflict *Conflict;
wc_mime_attachment *Mime = (wc_mime_attachment *) CTX(CTX_MIME_ATACH);
serv_printf("ICAL conflicts|%ld|%s|", Mime->msgnum, ChrPtr(Mime->PartNum));
Line = NewStrBuf();
StrBuf_ServGetln(Line);
if (GetServerStatus(Line, NULL) == 1)
{
const char *Pos = NULL;
int Done = 0;
int n = 0;
Conflicts = NewHash(1, Flathash);
while(!Done && (StrBuf_ServGetln(Line) >= 0) )
if ( (StrLength(Line)==3) &&
!strcmp(ChrPtr(Line), "000"))
{
Done = 1;
}
else {
Conflict = (CalendarConflict *) malloc(sizeof(CalendarConflict));
Conflict->conflict_event_uid = NewStrBufPlain(NULL, StrLength(Line));
Conflict->conflict_event_summary = NewStrBufPlain(NULL, StrLength(Line));
Conflict->existing_msgnum = StrBufExtractNext_long(Line, &Pos, '|');
StrBufSkip_NTokenS(Line, &Pos, '|', 1);
StrBufExtract_NextToken(Conflict->conflict_event_uid, Line, &Pos, '|');
StrBufExtract_NextToken(Conflict->conflict_event_summary, Line, &Pos, '|');
Conflict->is_update = StrBufExtractNext_long(Line, &Pos, '|');
Put(Conflicts, IKEY(n), Conflict, DeleteConflict);
n++;
Pos = NULL;
}
}
FreeStrBuf(&Line);
syslog(LOG_DEBUG, "...done.\n");
return Conflicts;
}
void tmplput_ConflictEventMsgID(StrBuf *Target, WCTemplputParams *TP)
{
CalendarConflict *C = (CalendarConflict *) CTX(CTX_ICALCONFLICT);
char buf[sizeof(long) * 16];
snprintf(buf, sizeof(buf), "%ld", C->existing_msgnum);
StrBufAppendTemplateStr(Target, TP, buf, 0);
}
void tmplput_ConflictEUID(StrBuf *Target, WCTemplputParams *TP)
{
CalendarConflict *C = (CalendarConflict *) CTX(CTX_ICALCONFLICT);
StrBufAppendTemplate(Target, TP, C->conflict_event_uid, 0);
}
void tmplput_ConflictSummary(StrBuf *Target, WCTemplputParams *TP)
{
CalendarConflict *C = (CalendarConflict *) CTX(CTX_ICALCONFLICT);
StrBufAppendTemplate(Target, TP, C->conflict_event_summary, 0);
}
int cond_ConflictIsUpdate(StrBuf *Target, WCTemplputParams *TP)
{
CalendarConflict *C = (CalendarConflict *) CTX(CTX_ICALCONFLICT);
return C->is_update;
}
typedef struct CalAttendee
{
StrBuf *AttendeeStr;
icalparameter_partstat partstat;
} CalAttendee;
void DeleteAtt(void *vAtt)
{
CalAttendee *att = (CalAttendee*) vAtt;
FreeStrBuf(&att->AttendeeStr);
free(vAtt);
}
HashList *iterate_get_ical_attendees(StrBuf *Target, WCTemplputParams *TP)
{
icalcomponent *cal = (icalcomponent *) CTX(CTX_ICAL);
icalparameter *partstat_param;
icalproperty *p;
CalAttendee *Att;
HashList *Attendees = NULL;
const char *ch;
int n = 0;
/* If the component has attendees, iterate through them. */
for (p = icalcomponent_get_first_property(cal, ICAL_ATTENDEE_PROPERTY);
(p != NULL);
p = icalcomponent_get_next_property(cal, ICAL_ATTENDEE_PROPERTY)) {
ch = icalproperty_get_attendee(p);
if ((ch != NULL) && !strncasecmp(ch, "MAILTO:", 7)) {
Att = (CalAttendee*) malloc(sizeof(CalAttendee));
/** screen name or email address */
Att->AttendeeStr = NewStrBufPlain(ch + 7, -1);
StrBufTrim(Att->AttendeeStr);
/** participant status */
partstat_param = icalproperty_get_first_parameter(
p,
ICAL_PARTSTAT_PARAMETER
);
if (partstat_param == NULL) {
Att->partstat = ICAL_PARTSTAT_X;
}
else {
Att->partstat = icalparameter_get_partstat(partstat_param);
}
if (Attendees == NULL)
Attendees = NewHash(1, Flathash);
Put(Attendees, IKEY(n), Att, DeleteAtt);
n++;
}
}
return Attendees;
}
void tmplput_ICalAttendee(StrBuf *Target, WCTemplputParams *TP)
{
CalAttendee *Att = (CalAttendee*) CTX(CTX_ICALATTENDEE);
StrBufAppendTemplate(Target, TP, Att->AttendeeStr, 0);
}
int cond_ICalAttendeeState(StrBuf *Target, WCTemplputParams *TP)
{
CalAttendee *Att = (CalAttendee*) CTX(CTX_ICALATTENDEE);
icalparameter_partstat which_partstat;
which_partstat = GetTemplateTokenNumber(Target, TP, 2, ICAL_PARTSTAT_X);
return Att->partstat == which_partstat;
}
/* If the component has subcomponents, recurse through them. * /
for (c = icalcomponent_get_first_component(cal, ICAL_ANY_COMPONENT);
(c != 0);
c = icalcomponent_get_next_component(cal, ICAL_ANY_COMPONENT)) {
// Recursively process subcomponent
cal_process_object(Target, c, recursion_level+1, msgnum, cal_partnum);
}
*/
void
InitModule_ICAL_SUBST
(void)
{
RegisterCTX(CTX_ICAL);
/*
RegisterMimeRenderer(HKEY("text/calendar"), render_MIME_ICS_TPL, 1, 501);
RegisterMimeRenderer(HKEY("application/ics"), render_MIME_ICS_TPL, 1, 500);
*/
CreateIcalComponendKindLookup ();
RegisterConditional("COND:ICAL:PROPERTY", 1, cond_ICalHaveItem, CTX_ICAL);
RegisterConditional("COND:ICAL:IS:A", 1, cond_ICalIsA, CTX_ICAL);
RegisterIterator("ICAL:CONFLICT", 0, NULL, iterate_FindConflict,
NULL, DeleteHash, CTX_MIME_ATACH, CTX_ICALCONFLICT, IT_NOFLAG);
RegisterNamespace("ICAL:CONFLICT:MSGID", 0, 1, tmplput_ConflictEventMsgID, NULL, CTX_ICALCONFLICT);
RegisterNamespace("ICAL:CONFLICT:EUID", 0, 1, tmplput_ConflictEUID, NULL, CTX_ICALCONFLICT);
RegisterNamespace("ICAL:CONFLICT:SUMMARY", 0, 1, tmplput_ConflictSummary, NULL, CTX_ICALCONFLICT);
RegisterConditional("ICAL:CONFLICT:IS:UPDATE", 0, cond_ConflictIsUpdate, CTX_ICALCONFLICT);
RegisterCTX(CTX_ICALATTENDEE);
RegisterIterator("ICAL:ATTENDEES", 0, NULL, iterate_get_ical_attendees,
NULL, DeleteHash, CTX_ICALATTENDEE, CTX_ICAL, IT_NOFLAG);
RegisterNamespace("ICAL:ATTENDEE", 1, 2, tmplput_ICalAttendee, NULL, CTX_ICALATTENDEE);
RegisterConditional("COND:ICAL:ATTENDEE", 1, cond_ICalAttendeeState, CTX_ICALATTENDEE);
RegisterCTX(CTX_ICALPROPERTY);
RegisterNamespace("ICAL:ITEM", 1, 2, tmplput_ICalItem, NULL, CTX_ICAL);
RegisterNamespace("ICAL:PROPERTY:STR", 0, 1, tmplput_CtxICalProperty, NULL, CTX_ICALPROPERTY);
RegisterNamespace("ICAL:PROPERTY:DATE", 0, 1, tmplput_CtxICalPropertyDate, NULL, CTX_ICALPROPERTY);
RegisterCTX(CTX_ICALMETHOD);
RegisterConditional("COND:ICAL:METHOD", 1, cond_ICalIsMethod, CTX_ICALMETHOD);
RegisterCTX(CTX_ICALTIME);
RegisterConditional("COND:ICAL:DT:PROPERTY", 1, cond_ICalHaveTimeItem, CTX_ICAL);
RegisterConditional("COND:ICAL:DT:ISDATE", 0, cond_ICalTimeIsDate, CTX_ICALTIME);
RegisterNamespace("ICAL:DT:DATE", 0, 1, tmplput_ICalTime_Date, NULL, CTX_ICALTIME);
RegisterNamespace("ICAL:DT:DATETIME", 0, 1, tmplput_ICalTime_Time, NULL, CTX_ICALTIME);
}
void
ServerShutdownModule_ICAL
(void)
{
DeleteHash(&IcalComponentMap);
}
webcit-dfsg.orig/downloads.c 0000644 0001750 0001750 00000032746 13223341037 016151 0 ustar michael michael /*
* Copyright (c) 1996-2012 by the citadel.org team
*
* This program is open source software. You can redistribute it and/or
* modify it under the terms of the GNU General Public License, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "webcit.h"
#include "webserver.h"
CtxType CTX_FILELIST = CTX_NONE;
extern void output_static(const char* What);
extern char* static_dirs[];
typedef struct _FileListStruct {
StrBuf *Filename;
long FileSize;
StrBuf *MimeType;
StrBuf *Comment;
int IsPic;
int Sequence;
} FileListStruct;
void FreeFiles(void *vFile)
{
FileListStruct *F = (FileListStruct*) vFile;
FreeStrBuf(&F->Filename);
FreeStrBuf(&F->MimeType);
FreeStrBuf(&F->Comment);
free(F);
}
/* -------------------------------------------------------------------------------- */
void tmplput_FILE_NAME(StrBuf *Target, WCTemplputParams *TP)
{
FileListStruct *F = (FileListStruct*) CTX(CTX_FILELIST);
StrBufAppendTemplate(Target, TP, F->Filename, 0);
}
void tmplput_FILE_SIZE(StrBuf *Target, WCTemplputParams *TP)
{
FileListStruct *F = (FileListStruct*) CTX(CTX_FILELIST);
StrBufAppendPrintf(Target, "%ld", F->FileSize);
}
void tmplput_FILEMIMETYPE(StrBuf *Target, WCTemplputParams *TP)
{
FileListStruct *F = (FileListStruct*) CTX(CTX_FILELIST);
StrBufAppendTemplate(Target, TP, F->MimeType, 0);
}
void tmplput_FILE_COMMENT(StrBuf *Target, WCTemplputParams *TP)
{
FileListStruct *F = (FileListStruct*) CTX(CTX_FILELIST);
StrBufAppendTemplate(Target, TP, F->Comment, 0);
}
/* -------------------------------------------------------------------------------- */
int Conditional_FILE_ISPIC(StrBuf *Target, WCTemplputParams *TP)
{
FileListStruct *F = (FileListStruct*) CTX(CTX_FILELIST);
return F->IsPic;
}
/* -------------------------------------------------------------------------------- */
int CompareFilelistByMime(const void *vFile1, const void *vFile2)
{
FileListStruct *File1 = (FileListStruct*) GetSearchPayload(vFile1);
FileListStruct *File2 = (FileListStruct*) GetSearchPayload(vFile2);
if (File1->IsPic != File2->IsPic)
return File1->IsPic > File2->IsPic;
return strcasecmp(ChrPtr(File1->MimeType), ChrPtr(File2->MimeType));
}
int CompareFilelistByMimeRev(const void *vFile1, const void *vFile2)
{
FileListStruct *File1 = (FileListStruct*) GetSearchPayload(vFile1);
FileListStruct *File2 = (FileListStruct*) GetSearchPayload(vFile2);
if (File1->IsPic != File2->IsPic)
return File1->IsPic < File2->IsPic;
return strcasecmp(ChrPtr(File2->MimeType), ChrPtr(File1->MimeType));
}
int GroupchangeFilelistByMime(const void *vFile1, const void *vFile2)
{
FileListStruct *File1 = (FileListStruct*) vFile1;
FileListStruct *File2 = (FileListStruct*) vFile2;
if (File1->IsPic != File2->IsPic)
return File1->IsPic > File2->IsPic;
return strcasecmp(ChrPtr(File1->MimeType), ChrPtr(File2->MimeType)) != 0;
}
int CompareFilelistByName(const void *vFile1, const void *vFile2)
{
FileListStruct *File1 = (FileListStruct*) GetSearchPayload(vFile1);
FileListStruct *File2 = (FileListStruct*) GetSearchPayload(vFile2);
if (File1->IsPic != File2->IsPic)
return File1->IsPic > File2->IsPic;
return strcasecmp(ChrPtr(File1->Filename), ChrPtr(File2->Filename));
}
int CompareFilelistByNameRev(const void *vFile1, const void *vFile2)
{
FileListStruct *File1 = (FileListStruct*) GetSearchPayload(vFile1);
FileListStruct *File2 = (FileListStruct*) GetSearchPayload(vFile2);
if (File1->IsPic != File2->IsPic)
return File1->IsPic < File2->IsPic;
return strcasecmp(ChrPtr(File2->Filename), ChrPtr(File1->Filename));
}
int GroupchangeFilelistByName(const void *vFile1, const void *vFile2)
{
FileListStruct *File1 = (FileListStruct*) vFile1;
FileListStruct *File2 = (FileListStruct*) vFile2;
return ChrPtr(File1->Filename)[0] != ChrPtr(File2->Filename)[0];
}
int CompareFilelistBySize(const void *vFile1, const void *vFile2)
{
FileListStruct *File1 = (FileListStruct*) GetSearchPayload(vFile1);
FileListStruct *File2 = (FileListStruct*) GetSearchPayload(vFile2);
if (File1->FileSize == File2->FileSize)
return 0;
return (File1->FileSize > File2->FileSize);
}
int CompareFilelistBySizeRev(const void *vFile1, const void *vFile2)
{
FileListStruct *File1 = (FileListStruct*) GetSearchPayload(vFile1);
FileListStruct *File2 = (FileListStruct*) GetSearchPayload(vFile2);
if (File1->FileSize == File2->FileSize)
return 0;
return (File1->FileSize < File2->FileSize);
}
int GroupchangeFilelistBySize(const void *vFile1, const void *vFile2)
{
return 0;
}
int CompareFilelistByComment(const void *vFile1, const void *vFile2)
{
FileListStruct *File1 = (FileListStruct*) GetSearchPayload(vFile1);
FileListStruct *File2 = (FileListStruct*) GetSearchPayload(vFile2);
return strcasecmp(ChrPtr(File1->Comment), ChrPtr(File2->Comment));
}
int CompareFilelistByCommentRev(const void *vFile1, const void *vFile2)
{
FileListStruct *File1 = (FileListStruct*) GetSearchPayload(vFile1);
FileListStruct *File2 = (FileListStruct*) GetSearchPayload(vFile2);
return strcasecmp(ChrPtr(File2->Comment), ChrPtr(File1->Comment));
}
int GroupchangeFilelistByComment(const void *vFile1, const void *vFile2)
{
FileListStruct *File1 = (FileListStruct*) vFile1;
FileListStruct *File2 = (FileListStruct*) vFile2;
return ChrPtr(File1->Comment)[9] != ChrPtr(File2->Comment)[0];
}
int CompareFilelistBySequence(const void *vFile1, const void *vFile2)
{
FileListStruct *File1 = (FileListStruct*) GetSearchPayload(vFile1);
FileListStruct *File2 = (FileListStruct*) GetSearchPayload(vFile2);
return (File2->Sequence > File1->Sequence);
}
int GroupchangeFilelistBySequence(const void *vFile1, const void *vFile2)
{
return 0;
}
/* -------------------------------------------------------------------------------- */
HashList* LoadFileList(StrBuf *Target, WCTemplputParams *TP)
{
FileListStruct *Entry;
StrBuf *Buf;
HashList *Files;
int Done = 0;
int sequence = 0;
char buf[1024];
CompareFunc SortIt;
int HavePic = 0;
WCTemplputParams SubTP;
memset(&SubTP, 0, sizeof(WCTemplputParams));
serv_puts("RDIR");
serv_getln(buf, sizeof buf);
if (buf[0] != '1') return NULL;
Buf = NewStrBuf();
Files = NewHash(1, NULL);
while (!Done && (StrBuf_ServGetln(Buf)>=0)) {
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000"))
{
Done = 1;
continue;
}
Entry = (FileListStruct*) malloc(sizeof (FileListStruct));
Entry->Filename = NewStrBufPlain(NULL, StrLength(Buf));
Entry->MimeType = NewStrBufPlain(NULL, StrLength(Buf));
Entry->Comment = NewStrBufPlain(NULL, StrLength(Buf));
Entry->Sequence = sequence++;
StrBufExtract_token(Entry->Filename, Buf, 0, '|');
Entry->FileSize = StrBufExtract_long(Buf, 1, '|');
StrBufExtract_token(Entry->MimeType, Buf, 2, '|');
StrBufExtract_token(Entry->Comment, Buf, 3, '|');
Entry->IsPic = (strstr(ChrPtr(Entry->MimeType), "image") != NULL);
if (Entry->IsPic) {
HavePic = 1;
}
Put(Files, SKEY(Entry->Filename), Entry, FreeFiles);
}
if (HavePic)
putbstr("__HAVE_PIC", NewStrBufPlain(HKEY("1")));
SubTP.Filter.ContextType = CTX_FILELIST;
SortIt = RetrieveSort(&SubTP, NULL, 0, HKEY("fileunsorted"), 0);
if (SortIt != NULL)
SortByPayload(Files, SortIt);
else
SortByPayload(Files, CompareFilelistBySequence);
FreeStrBuf(&Buf);
return Files;
}
void display_mime_icon(void)
{
char FileBuf[SIZ];
const char *FileName;
char *MimeType;
size_t tlen;
MimeType = xbstr("type", &tlen);
FileName = GetIconFilename(MimeType, tlen);
if (FileName == NULL)
snprintf (FileBuf, SIZ, "%s%s", static_dirs[0], "/webcit_icons/essen/16x16/file.png");
else
snprintf (FileBuf, SIZ, "%s%s", static_dirs[3], FileName);
output_static(FileBuf);
}
void download_file(void)
{
wcsession *WCC = WC;
StrBuf *Buf;
off_t bytes;
StrBuf *ContentType = NewStrBufPlain(HKEY("application/octet-stream"));
/* Setting to nonzero forces a MIME type of application/octet-stream */
int force_download = 1;
Buf = NewStrBuf();
StrBufExtract_token(Buf, WCC->Hdr->HR.ReqLine, 0, '/');
StrBufUnescape(Buf, 1);
serv_printf("OPEN %s", ChrPtr(Buf));
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, NULL) == 2) {
StrBufCutLeft(Buf, 4);
bytes = StrBufExtract_long(Buf, 0, '|');
StrBufExtract_token(ContentType, Buf, 3, '|');
CheckGZipCompressionAllowed (SKEY(ContentType));
if (force_download)
FlushStrBuf(ContentType);
serv_read_binary_to_http(ContentType, bytes, 0, 0);
serv_puts("CLOS");
StrBuf_ServGetln(Buf);
// http_transmit_thing(ChrPtr(ContentType), 0);
} else {
StrBufCutLeft(Buf, 4);
hprintf("HTTP/1.1 404 %s\n", ChrPtr(Buf));
output_headers(0, 0, 0, 0, 0, 0);
hprintf("Content-Type: text/plain\r\n");
wc_printf(_("An error occurred while retrieving this file: %s\n"),
ChrPtr(Buf));
end_burst();
}
FreeStrBuf(&ContentType);
FreeStrBuf(&Buf);
}
void delete_file(void)
{
const StrBuf *MimeType;
StrBuf *Line;
char buf[256];
safestrncpy(buf, bstr("file"), sizeof buf);
unescape_input(buf);
serv_printf("DELF %s", buf);
StrBuf_ServGetln(Line);
GetServerStatusMsg(Line, NULL, 1, 0);
MimeType = DoTemplate(HKEY("files"), NULL, &NoCtx);
http_transmit_thing(ChrPtr(MimeType), 0);
FreeStrBuf(&Line);
}
void upload_file(void)
{
const StrBuf *RetMimeType;
const char *MimeType;
StrBuf *Line;
long bytes_transmitted = 0;
long blocksize;
const StrBuf *Desc;
wcsession *WCC = WC; /* stack this for faster access (WC is a function) */
MimeType = GuessMimeType(ChrPtr(WCC->upload), WCC->upload_length);
Desc = sbstr("description");
serv_printf("UOPN %s|%s|%s",
ChrPtr(WCC->upload_filename),
MimeType,
ChrPtr(Desc));
Line = NewStrBuf();
StrBuf_ServGetln(Line);
if (GetServerStatusMsg(Line, NULL, 1, 2) != 2) {
RetMimeType = DoTemplate(HKEY("files"), NULL, &NoCtx);
http_transmit_thing(ChrPtr(RetMimeType), 0);
FreeStrBuf(&Line);
return;
}
while (bytes_transmitted < WCC->upload_length)
{
blocksize = 4096;
if (blocksize > (WCC->upload_length - bytes_transmitted))
{
blocksize = (WCC->upload_length - bytes_transmitted);
}
serv_printf("WRIT %ld", blocksize);
StrBuf_ServGetln(Line);
if (GetServerStatusMsg(Line, NULL, 0, 0) == 7) {
blocksize = atoi(ChrPtr(Line) + 4);
serv_write(&ChrPtr(WCC->upload)[bytes_transmitted], blocksize);
bytes_transmitted += blocksize;
}
else
break;
}
serv_puts("UCLS 1");
StrBuf_ServGetln(Line);
GetServerStatusMsg(Line, NULL, 1, 0);
RetMimeType = DoTemplate(HKEY("files"), NULL, &NoCtx);
http_transmit_thing(ChrPtr(RetMimeType), 0);
FreeStrBuf(&Line);
}
/*
* When the browser requests an image file from the Citadel server,
* this function is called to transmit it.
*/
void output_image(void)
{
StrBuf *Buf;
wcsession *WCC = WC;
off_t bytes;
const char *MimeType;
Buf = NewStrBuf();
serv_printf("OIMG %s|%s", bstr("name"), bstr("parm"));
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, NULL) == 2) {
int rc;
StrBufCutLeft(Buf, 4);
bytes = StrBufExtract_long(Buf, 0, '|');
/** Read it from the server */
rc = serv_read_binary(WCC->WBuf, bytes, Buf);
serv_puts("CLOS");
StrBuf_ServGetln(Buf);
if (rc > 0) {
MimeType = GuessMimeType (ChrPtr(WCC->WBuf), StrLength(WCC->WBuf));
/** Write it to the browser */
if (!IsEmptyStr(MimeType))
{
CheckGZipCompressionAllowed (MimeType, strlen(MimeType));
http_transmit_thing(MimeType, 0);
FreeStrBuf(&Buf);
return;
}
}
/* hm... unknown mimetype? fallback to blank gif */
}
else {
syslog(LOG_DEBUG, "OIMG failed: %s", ChrPtr(Buf));
}
/*
* Instead of an ugly 404, send a 1x1 transparent GIF
* when there's no such image on the server.
*/
StrBufPrintf (Buf, "%s%s", static_dirs[0], "/webcit_icons/blank.gif");
output_static(ChrPtr(Buf));
FreeStrBuf(&Buf);
}
void
InitModule_DOWNLOAD
(void)
{
RegisterCTX(CTX_FILELIST);
RegisterIterator("ROOM:FILES", 0, NULL, LoadFileList,
NULL, DeleteHash, CTX_FILELIST, CTX_NONE,
IT_FLAG_DETECT_GROUPCHANGE);
RegisterSortFunc(HKEY("filemime"),
NULL, 0,
CompareFilelistByMime,
CompareFilelistByMimeRev,
GroupchangeFilelistByMime,
CTX_FILELIST);
RegisterSortFunc(HKEY("filename"),
NULL, 0,
CompareFilelistByName,
CompareFilelistByNameRev,
GroupchangeFilelistByName,
CTX_FILELIST);
RegisterSortFunc(HKEY("filesize"),
NULL, 0,
CompareFilelistBySize,
CompareFilelistBySizeRev,
GroupchangeFilelistBySize,
CTX_FILELIST);
RegisterSortFunc(HKEY("filesubject"),
NULL, 0,
CompareFilelistByComment,
CompareFilelistByCommentRev,
GroupchangeFilelistByComment,
CTX_FILELIST);
RegisterSortFunc(HKEY("fileunsorted"),
NULL, 0,
CompareFilelistBySequence,
CompareFilelistBySequence,
GroupchangeFilelistBySequence,
CTX_FILELIST);
RegisterNamespace("FILE:NAME", 0, 2, tmplput_FILE_NAME, NULL, CTX_FILELIST);
RegisterNamespace("FILE:SIZE", 0, 1, tmplput_FILE_SIZE, NULL, CTX_FILELIST);
RegisterNamespace("FILE:MIMETYPE", 0, 2, tmplput_FILEMIMETYPE, NULL, CTX_FILELIST);
RegisterNamespace("FILE:COMMENT", 0, 2, tmplput_FILE_COMMENT, NULL, CTX_FILELIST);
RegisterConditional("COND:FILE:ISPIC", 0, Conditional_FILE_ISPIC, CTX_FILELIST);
WebcitAddUrlHandler(HKEY("image"), "", 0, output_image, ANONYMOUS);
WebcitAddUrlHandler(HKEY("display_mime_icon"), "", 0, display_mime_icon , ANONYMOUS);
WebcitAddUrlHandler(HKEY("download_file"), "", 0, download_file, NEED_URL);
WebcitAddUrlHandler(HKEY("delete_file"), "", 0, delete_file, NEED_URL);
WebcitAddUrlHandler(HKEY("upload_file"), "", 0, upload_file, 0);
}
webcit-dfsg.orig/crypto.c 0000644 0001750 0001750 00000035314 13223341037 015471 0 ustar michael michael /*
* Copyright (c) 1996-2017 by the citadel.org team
*
* This program is open source software. You can redistribute it and/or
* modify it under the terms of the GNU General Public License, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "sysdep.h"
#ifdef HAVE_OPENSSL
#include "webcit.h"
#include "webserver.h"
/* where to find the keys */
#define CTDL_CRYPTO_DIR ctdl_key_dir
#define CTDL_KEY_PATH file_crpt_file_key
#define CTDL_CSR_PATH file_crpt_file_csr
#define CTDL_CER_PATH file_crpt_file_cer
#define SIGN_DAYS 3650 /* how long our certificate should live */
SSL_CTX *ssl_ctx; /* SSL context */
pthread_mutex_t **SSLCritters; /* Things needing locking */
char *ssl_cipher_list = DEFAULT_SSL_CIPHER_LIST;
pthread_key_t ThreadSSL; /* Per-thread SSL context */
void ssl_lock(int mode, int n, const char *file, int line);
static unsigned long id_callback(void)
{
return (unsigned long) pthread_self();
}
void shutdown_ssl(void)
{
ERR_free_strings();
/* Openssl requires these while shutdown.
* Didn't find a way to get out of this clean.
* int i, n = CRYPTO_num_locks();
* for (i = 0; i < n; i++)
* free(SSLCritters[i]);
* free(SSLCritters);
*/
}
void generate_key(char *keyfilename)
{
int ret = 0;
RSA *rsa = NULL;
BIGNUM *bne = NULL;
int bits = 2048;
unsigned long e = RSA_F4;
FILE *fp;
if (access(keyfilename, R_OK) == 0) {
return;
}
syslog(LOG_INFO, "crypto: generating RSA key pair");
// generate rsa key
bne = BN_new();
ret = BN_set_word(bne,e);
if (ret != 1) {
goto free_all;
}
rsa = RSA_new();
ret = RSA_generate_key_ex(rsa, bits, bne, NULL);
if (ret != 1) {
goto free_all;
}
// write the key file
fp = fopen(keyfilename, "w");
if (fp != NULL) {
chmod(file_crpt_file_key, 0600);
if (PEM_write_RSAPrivateKey(fp, /* the file */
rsa, /* the key */
NULL, /* no enc */
NULL, /* no passphr */
0, /* no passphr */
NULL, /* no callbk */
NULL /* no callbk */
) != 1) {
syslog(LOG_ERR, "crypto: cannot write key: %s", ERR_reason_error_string(ERR_get_error()));
unlink(keyfilename);
}
fclose(fp);
}
// 4. free
free_all:
RSA_free(rsa);
BN_free(bne);
}
/*
* initialize ssl engine, load certs and initialize openssl internals
*/
void init_ssl(void)
{
const SSL_METHOD *ssl_method;
RSA *rsa=NULL;
X509_REQ *req = NULL;
X509 *cer = NULL;
EVP_PKEY *pk = NULL;
EVP_PKEY *req_pkey = NULL;
X509_NAME *name = NULL;
FILE *fp;
char buf[SIZ];
int rv = 0;
#ifndef OPENSSL_NO_EGD
if (!access("/var/run/egd-pool", F_OK)) {
RAND_egd("/var/run/egd-pool");
}
#endif
if (!RAND_status()) {
syslog(LOG_WARNING, "PRNG not adequately seeded, won't do SSL/TLS\n");
return;
}
SSLCritters = malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t *));
if (!SSLCritters) {
syslog(LOG_ERR, "citserver: can't allocate memory!!\n");
/* Nothing's been initialized, just die */
ShutDownWebcit();
exit(WC_EXIT_SSL);
} else {
int a;
for (a = 0; a < CRYPTO_num_locks(); a++) {
SSLCritters[a] = malloc(sizeof(pthread_mutex_t));
if (!SSLCritters[a]) {
syslog(LOG_ERR,
"citserver: can't allocate memory!!\n");
/** Nothing's been initialized, just die */
ShutDownWebcit();
exit(WC_EXIT_SSL);
}
pthread_mutex_init(SSLCritters[a], NULL);
}
}
/*
* Initialize SSL transport layer
*/
SSL_library_init();
SSL_load_error_strings();
ssl_method = SSLv23_server_method();
if (!(ssl_ctx = SSL_CTX_new(ssl_method))) {
syslog(LOG_WARNING, "SSL_CTX_new failed: %s\n", ERR_reason_error_string(ERR_get_error()));
return;
}
syslog(LOG_INFO, "Requesting cipher list: %s\n", ssl_cipher_list);
if (!(SSL_CTX_set_cipher_list(ssl_ctx, ssl_cipher_list))) {
syslog(LOG_WARNING, "SSL_CTX_set_cipher_list failed: %s\n", ERR_reason_error_string(ERR_get_error()));
return;
}
CRYPTO_set_locking_callback(ssl_lock);
CRYPTO_set_id_callback(id_callback);
/*
* Get our certificates in order. (FIXME: dirify. this is a setup job.)
* First, create the key/cert directory if it's not there already...
*/
mkdir(CTDL_CRYPTO_DIR, 0700);
/*
* Before attempting to generate keys/certificates, first try
* link to them from the Citadel server if it's on the same host.
* We ignore any error return because it either meant that there
* was nothing in Citadel to link from (in which case we just
* generate new files) or the target files already exist (which
* is not fatal either).
*/
if (!strcasecmp(ctdlhost, "uds")) {
sprintf(buf, "%s/keys/citadel.key", ctdlport);
rv = symlink(buf, CTDL_KEY_PATH);
if (!rv) syslog(LOG_DEBUG, "%s\n", strerror(errno));
sprintf(buf, "%s/keys/citadel.csr", ctdlport);
rv = symlink(buf, CTDL_CSR_PATH);
if (!rv) syslog(LOG_DEBUG, "%s\n", strerror(errno));
sprintf(buf, "%s/keys/citadel.cer", ctdlport);
rv = symlink(buf, CTDL_CER_PATH);
if (!rv) syslog(LOG_DEBUG, "%s\n", strerror(errno));
}
/*
* If we still don't have a private key, generate one.
*/
generate_key(CTDL_KEY_PATH);
/*
* If there is no certificate file on disk, we will be generating a self-signed certificate
* in the next step. Therefore, if we have neither a CSR nor a certificate, generate
* the CSR in this step so that the next step may commence.
*/
if ( (access(CTDL_CER_PATH, R_OK) != 0) && (access(CTDL_CSR_PATH, R_OK) != 0) ) {
syslog(LOG_INFO, "Generating a certificate signing request.\n");
/*
* Read our key from the file. No, we don't just keep this
* in memory from the above key-generation function, because
* there is the possibility that the key was already on disk
* and we didn't just generate it now.
*/
fp = fopen(CTDL_KEY_PATH, "r");
if (fp) {
rsa = PEM_read_RSAPrivateKey(fp, NULL, NULL, NULL);
fclose(fp);
}
if (rsa) {
/** Create a public key from the private key */
if (pk=EVP_PKEY_new(), pk != NULL) {
EVP_PKEY_assign_RSA(pk, rsa);
if (req = X509_REQ_new(), req != NULL) {
const char *env;
/* Set the public key */
X509_REQ_set_pubkey(req, pk);
X509_REQ_set_version(req, 0L);
name = X509_REQ_get_subject_name(req);
/* Tell it who we are */
/*
* We used to add these fields to the subject, but
* now we don't. Someone doing this for real isn't
* going to use the webcit-generated CSR anyway.
*
X509_NAME_add_entry_by_txt(name, "C",
MBSTRING_ASC, "US", -1, -1, 0);
*
X509_NAME_add_entry_by_txt(name, "ST",
MBSTRING_ASC, "New York", -1, -1, 0);
*
X509_NAME_add_entry_by_txt(name, "L",
MBSTRING_ASC, "Mount Kisco", -1, -1, 0);
*/
env = getenv("O");
if (env == NULL)
env = "Organization name",
X509_NAME_add_entry_by_txt(
name, "O",
MBSTRING_ASC,
(unsigned char*)env,
-1, -1, 0
);
env = getenv("OU");
if (env == NULL)
env = "Citadel server";
X509_NAME_add_entry_by_txt(
name, "OU",
MBSTRING_ASC,
(unsigned char*)env,
-1, -1, 0
);
env = getenv("CN");
if (env == NULL)
env = "*";
X509_NAME_add_entry_by_txt(
name, "CN",
MBSTRING_ASC,
(unsigned char*)env,
-1, -1, 0
);
X509_REQ_set_subject_name(req, name);
/* Sign the CSR */
if (!X509_REQ_sign(req, pk, EVP_md5())) {
syslog(LOG_WARNING, "X509_REQ_sign(): error\n");
}
else {
/* Write it to disk. */
fp = fopen(CTDL_CSR_PATH, "w");
if (fp != NULL) {
chmod(CTDL_CSR_PATH, 0600);
PEM_write_X509_REQ(fp, req);
fclose(fp);
}
else {
syslog(LOG_WARNING, "Cannot write key: %s\n", CTDL_CSR_PATH);
ShutDownWebcit();
exit(0);
}
}
X509_REQ_free(req);
}
}
RSA_free(rsa);
}
else {
syslog(LOG_WARNING, "Unable to read private key.\n");
}
}
/*
* Generate a self-signed certificate if we don't have one.
*/
if (access(CTDL_CER_PATH, R_OK) != 0) {
syslog(LOG_INFO, "Generating a self-signed certificate.\n");
/* Same deal as before: always read the key from disk because
* it may or may not have just been generated.
*/
fp = fopen(CTDL_KEY_PATH, "r");
if (fp) {
rsa = PEM_read_RSAPrivateKey(fp, NULL, NULL, NULL);
fclose(fp);
}
/* This also holds true for the CSR. */
req = NULL;
cer = NULL;
pk = NULL;
if (rsa) {
if (pk=EVP_PKEY_new(), pk != NULL) {
EVP_PKEY_assign_RSA(pk, rsa);
}
fp = fopen(CTDL_CSR_PATH, "r");
if (fp) {
req = PEM_read_X509_REQ(fp, NULL, NULL, NULL);
fclose(fp);
}
if (req) {
if (cer = X509_new(), cer != NULL) {
ASN1_INTEGER_set(X509_get_serialNumber(cer), 0);
X509_set_issuer_name(cer, X509_REQ_get_subject_name(req));
X509_set_subject_name(cer, X509_REQ_get_subject_name(req));
X509_gmtime_adj(X509_get_notBefore(cer), 0);
X509_gmtime_adj(X509_get_notAfter(cer),(long)60*60*24*SIGN_DAYS);
req_pkey = X509_REQ_get_pubkey(req);
X509_set_pubkey(cer, req_pkey);
EVP_PKEY_free(req_pkey);
/* Sign the cert */
if (!X509_sign(cer, pk, EVP_md5())) {
syslog(LOG_WARNING, "X509_sign(): error\n");
}
else {
/* Write it to disk. */
fp = fopen(CTDL_CER_PATH, "w");
if (fp != NULL) {
chmod(CTDL_CER_PATH, 0600);
PEM_write_X509(fp, cer);
fclose(fp);
}
else {
syslog(LOG_WARNING, "Cannot write key: %s\n", CTDL_CER_PATH);
ShutDownWebcit();
exit(0);
}
}
X509_free(cer);
}
}
RSA_free(rsa);
}
}
/*
* Now try to bind to the key and certificate.
* Note that we use SSL_CTX_use_certificate_chain_file() which allows
* the certificate file to contain intermediate certificates.
*/
SSL_CTX_use_certificate_chain_file(ssl_ctx, CTDL_CER_PATH);
SSL_CTX_use_PrivateKey_file(ssl_ctx, CTDL_KEY_PATH, SSL_FILETYPE_PEM);
if ( !SSL_CTX_check_private_key(ssl_ctx) ) {
syslog(LOG_WARNING, "Cannot install certificate: %s\n",
ERR_reason_error_string(ERR_get_error()));
}
}
/*
* starts SSL/TLS encryption for the current session.
*/
int starttls(int sock) {
int retval, bits, alg_bits;/*r; */
SSL *newssl;
pthread_setspecific(ThreadSSL, NULL);
if (!ssl_ctx) {
return(1);
}
if (!(newssl = SSL_new(ssl_ctx))) {
syslog(LOG_WARNING, "SSL_new failed: %s\n", ERR_reason_error_string(ERR_get_error()));
return(2);
}
if (!(SSL_set_fd(newssl, sock))) {
syslog(LOG_WARNING, "SSL_set_fd failed: %s\n", ERR_reason_error_string(ERR_get_error()));
SSL_free(newssl);
return(3);
}
retval = SSL_accept(newssl);
if (retval < 1) {
/*
* Can't notify the client of an error here; they will
* discover the problem at the SSL layer and should
* revert to unencrypted communications.
*/
long errval;
const char *ssl_error_reason = NULL;
errval = SSL_get_error(newssl, retval);
ssl_error_reason = ERR_reason_error_string(ERR_get_error());
if (ssl_error_reason == NULL) {
syslog(LOG_WARNING, "SSL_accept failed: errval=%ld, retval=%d %s\n", errval, retval, strerror(errval));
}
else {
syslog(LOG_WARNING, "SSL_accept failed: %s\n", ssl_error_reason);
}
sleeeeeeeeeep(1);
retval = SSL_accept(newssl);
}
if (retval < 1) {
long errval;
const char *ssl_error_reason = NULL;
errval = SSL_get_error(newssl, retval);
ssl_error_reason = ERR_reason_error_string(ERR_get_error());
if (ssl_error_reason == NULL) {
syslog(LOG_WARNING, "SSL_accept failed: errval=%ld, retval=%d (%s)\n", errval, retval, strerror(errval));
}
else {
syslog(LOG_WARNING, "SSL_accept failed: %s\n", ssl_error_reason);
}
SSL_free(newssl);
newssl = NULL;
return(4);
}
else {
syslog(LOG_INFO, "SSL_accept success\n");
}
/*r = */BIO_set_close(SSL_get_rbio(newssl), BIO_NOCLOSE);
bits = SSL_CIPHER_get_bits(SSL_get_current_cipher(newssl), &alg_bits);
syslog(LOG_INFO, "SSL/TLS using %s on %s (%d of %d bits)\n",
SSL_CIPHER_get_name(SSL_get_current_cipher(newssl)),
SSL_CIPHER_get_version(SSL_get_current_cipher(newssl)),
bits, alg_bits);
pthread_setspecific(ThreadSSL, newssl);
syslog(LOG_INFO, "SSL started\n");
return(0);
}
/*
* shuts down the TLS connection
*
* WARNING: This may make your session vulnerable to a known plaintext
* attack in the current implmentation.
*/
void endtls(void)
{
/*SSL_CTX *ctx;*/
if (THREADSSL == NULL) return;
syslog(LOG_INFO, "Ending SSL/TLS\n");
SSL_shutdown(THREADSSL);
/*ctx = */SSL_get_SSL_CTX(THREADSSL);
/* I don't think this is needed, and it crashes the server anyway
*
* if (ctx != NULL) {
* syslog(LOG_DEBUG, "Freeing CTX at %x\n", (int)ctx );
* SSL_CTX_free(ctx);
* }
*/
SSL_free(THREADSSL);
pthread_setspecific(ThreadSSL, NULL);
}
/*
* callback for OpenSSL mutex locks
*/
void ssl_lock(int mode, int n, const char *file, int line)
{
if (mode & CRYPTO_LOCK) {
pthread_mutex_lock(SSLCritters[n]);
}
else {
pthread_mutex_unlock(SSLCritters[n]);
}
}
/*
* Send binary data to the client encrypted.
*/
int client_write_ssl(const StrBuf *Buf)
{
const char *buf;
int retval;
int nremain;
long nbytes;
char junk[1];
if (THREADSSL == NULL) return -1;
nbytes = nremain = StrLength(Buf);
buf = ChrPtr(Buf);
while (nremain > 0) {
if (SSL_want_write(THREADSSL)) {
if ((SSL_read(THREADSSL, junk, 0)) < 1) {
syslog(LOG_WARNING, "SSL_read in client_write: %s\n",
ERR_reason_error_string(ERR_get_error()));
}
}
retval = SSL_write(THREADSSL, &buf[nbytes - nremain], nremain);
if (retval < 1) {
long errval;
errval = SSL_get_error(THREADSSL, retval);
if (errval == SSL_ERROR_WANT_READ || errval == SSL_ERROR_WANT_WRITE) {
sleeeeeeeeeep(1);
continue;
}
syslog(LOG_WARNING, "SSL_write got error %ld, ret %d\n", errval, retval);
if (retval == -1) {
syslog(LOG_WARNING, "errno is %d\n", errno);
}
endtls();
return -1;
}
nremain -= retval;
}
return 0;
}
/*
* read data from the encrypted layer.
*/
int client_read_sslbuffer(StrBuf *buf, int timeout)
{
char sbuf[16384]; /* OpenSSL communicates in 16k blocks, so let's speak its native tongue. */
int rlen;
char junk[1];
SSL *pssl = THREADSSL;
if (pssl == NULL) return(-1);
while (1) {
if (SSL_want_read(pssl)) {
if ((SSL_write(pssl, junk, 0)) < 1) {
syslog(LOG_WARNING, "SSL_write in client_read\n");
}
}
rlen = SSL_read(pssl, sbuf, sizeof(sbuf));
if (rlen < 1) {
long errval;
errval = SSL_get_error(pssl, rlen);
if (errval == SSL_ERROR_WANT_READ || errval == SSL_ERROR_WANT_WRITE) {
sleeeeeeeeeep(1);
continue;
}
syslog(LOG_WARNING, "SSL_read got error %ld\n", errval);
endtls();
return (-1);
}
StrBufAppendBufPlain(buf, sbuf, rlen, 0);
return rlen;
}
return (0);
}
#endif /* HAVE_OPENSSL */
webcit-dfsg.orig/roomtokens.c 0000644 0001750 0001750 00000044110 13223341037 016343 0 ustar michael michael /*
* Lots of different room-related operations.
*
* Copyright (c) 1996-2012 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "webcit.h"
#include "webserver.h"
CtxType CTX_ROOMS = CTX_NONE;
CtxType CTX_FLOORS = CTX_NONE;
/*
* Embed the room banner
*
* got The information returned from a GOTO server command
* navbar_style Determines which navigation buttons to display
*/
void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
/* Refresh current room states. Doesn't work? gotoroom(NULL); */
wc_printf("
\n");
/* The browser needs some information for its own use */
wc_printf("\n",
((WC->CurRoom.RAFlags & UA_ISTRASH) != 0)
);
/*
* If the user happens to select the "make this my start page" link,
* we want it to remember the URL as a "/dotskip" one instead of
* a "skip" or "gotonext" or something like that.
*/
if (WCC->Hdr->this_page == NULL) {
WCC->Hdr->this_page = NewStrBuf();
}
StrBufPrintf(WCC->Hdr->this_page, "dotskip?room=%s", ChrPtr(WC->CurRoom.name));
do_template("roombanner");
do_template("navbar");
wc_printf("
\n");
}
/*******************************************************************************
********************** FLOOR Tokens *******************************************
*******************************************************************************/
void tmplput_FLOOR_ID(StrBuf *Target, WCTemplputParams *TP)
{
Floor *myFloor = (Floor *)CTX(CTX_FLOORS);
StrBufAppendPrintf(Target, "%d", myFloor->ID);
}
void tmplput_ROOM_FLOORID(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)CTX(CTX_ROOMS);
StrBufAppendPrintf(Target, "%d", Folder->floorid);
}
void tmplput_ROOM_FLOOR_ID(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)CTX(CTX_ROOMS);
const Floor *pFloor = Folder->Floor;
if (pFloor == NULL)
return;
StrBufAppendPrintf(Target, "%d", pFloor->ID);
}
void tmplput_ROOM_FLOOR_NAME(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)CTX(CTX_ROOMS);
const Floor *pFloor = Folder->Floor;
if (pFloor == NULL)
return;
StrBufAppendTemplate(Target, TP, pFloor->Name, 0);
}
void tmplput_ThisRoomFloorName(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
folder *Folder = &WCC->CurRoom;
const Floor *pFloor;
if (Folder == NULL)
return;
pFloor = Folder->Floor;
if (pFloor == NULL)
return;
StrBufAppendTemplate(Target, TP, pFloor->Name, 0);
}
void tmplput_FLOOR_NAME(StrBuf *Target, WCTemplputParams *TP)
{
Floor *myFloor = (Floor *)CTX(CTX_FLOORS);
StrBufAppendTemplate(Target, TP, myFloor->Name, 0);
}
void tmplput_FLOOR_NROOMS(StrBuf *Target, WCTemplputParams *TP)
{
Floor *myFloor = (Floor *)CTX(CTX_FLOORS);
StrBufAppendPrintf(Target, "%d", myFloor->NRooms);
}
void tmplput_ROOM_FLOOR_NROOMS(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)CTX(CTX_ROOMS);
const Floor *pFloor = Folder->Floor;
if (pFloor == NULL)
return;
StrBufAppendPrintf(Target, "%d", pFloor->NRooms);
}
int ConditionalFloorHaveNRooms(StrBuf *Target, WCTemplputParams *TP)
{
Floor *MyFloor = (Floor *)CTX(CTX_FLOORS);
int HaveN;
HaveN = GetTemplateTokenNumber(Target, TP, 0, 0);
return HaveN == MyFloor->NRooms;
}
int ConditionalFloorIsRESTSubFloor(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
Floor *MyFloor = (Floor *)CTX(CTX_FLOORS);
/** if we have dav_depth the client just wants the subfloors */
if ((WCC->Hdr->HR.dav_depth == 1) &&
(GetCount(WCC->Directory) == 0))
return 1;
return WCC->CurrentFloor == MyFloor;
}
int ConditionalFloorIsSUBROOM(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
Floor *MyFloor = (Floor *)CTX(CTX_FLOORS);
return WCC->CurRoom.floorid == MyFloor->ID;
}
int ConditionalFloorIsVirtual(StrBuf *Target, WCTemplputParams *TP)
{
Floor *MyFloor = (Floor *)CTX(CTX_FLOORS);
return MyFloor->ID == VIRTUAL_MY_FLOOR;
}
/*******************************************************************************
********************** ROOM Tokens ********************************************
*******************************************************************************/
/**** Name ******/
void tmplput_ThisRoom(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC != NULL) {
StrBufAppendTemplate(Target, TP,
WCC->CurRoom.name,
0
);
}
}
void tmplput_ROOM_NAME(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)CTX(CTX_ROOMS);
StrBufAppendTemplate(Target, TP, Folder->name, 0);
}
void tmplput_ROOM_BASENAME(StrBuf *Target, WCTemplputParams *TP)
{
folder *room = (folder *)CTX(CTX_ROOMS);
if (room->nRoomNameParts > 1)
StrBufAppendTemplate(Target, TP,
room->RoomNameParts[room->nRoomNameParts - 1], 0);
else
StrBufAppendTemplate(Target, TP, room->name, 0);
}
void tmplput_ROOM_LEVEL_N_TIMES(StrBuf *Target, WCTemplputParams *TP)
{
folder *room = (folder *)CTX(CTX_ROOMS);
int i;
const char *AppendMe;
long AppendMeLen;
if (room->nRoomNameParts > 1)
{
GetTemplateTokenString(Target, TP, 0, &AppendMe, &AppendMeLen);
for (i = 0; i < room->nRoomNameParts; i++)
StrBufAppendBufPlain(Target, AppendMe, AppendMeLen, 0);
}
}
int ConditionalRoomIsInbox(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)CTX(CTX_ROOMS);
return Folder->is_inbox;
}
int ConditionalRoomIsType(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)CTX(CTX_ROOMS);
if (Folder == NULL)
return 0;
if ((TP->Tokens->nParameters < 3))
{
return ((Folder->view < VIEW_BBS) ||
(Folder->view > VIEW_MAX));
}
return Folder->view == GetTemplateTokenNumber(Target, TP, 2, VIEW_BBS);
}
/****** Properties ******/
int ConditionalRoom_MayEdit(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
LoadRoomXA ();
return WCC->CurRoom.XALoaded == 1;
}
int ConditionalThisRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
{
long QR_CheckFlag;
wcsession *WCC = WC;
QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
if (QR_CheckFlag == 0)
LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
"requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
if (WCC == NULL)
return 0;
if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
(TP->Tokens->Params[2]->MaskBy == eNO))
return (WCC->CurRoom.QRFlags & QR_CheckFlag) != 0;
else
return (WCC->CurRoom.QRFlags & QR_CheckFlag) == QR_CheckFlag;
}
int ConditionalRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
{
long QR_CheckFlag;
folder *Folder = (folder *)(TP->Context);
QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
if (QR_CheckFlag == 0)
LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
"requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
(TP->Tokens->Params[2]->MaskBy == eNO))
return (Folder->QRFlags & QR_CheckFlag) != 0;
else
return (Folder->QRFlags & QR_CheckFlag) == QR_CheckFlag;
}
void tmplput_ROOM_QRFLAGS(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)CTX(CTX_ROOMS);
StrBufAppendPrintf(Target, "%d", Folder->QRFlags);
}
int ConditionalThisRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
{
long QR2_CheckFlag;
wcsession *WCC = WC;
QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
if (QR2_CheckFlag == 0)
LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
"requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
if (WCC == NULL)
return 0;
if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
(TP->Tokens->Params[2]->MaskBy == eNO))
return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) != 0;
else
return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) == QR2_CheckFlag;
}
int ConditionalRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
{
long QR2_CheckFlag;
folder *Folder = (folder *)(TP->Context);
QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
if (QR2_CheckFlag == 0)
LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
"requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
return ((Folder->QRFlags2 & QR2_CheckFlag) != 0);
}
int ConditionalRoomHas_UAFlag(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)(TP->Context);
long UA_CheckFlag;
UA_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
if (UA_CheckFlag == 0)
LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
"requires one of the #\"UA_*\"- defines or an integer flag 0 is invalid!");
return ((Folder->RAFlags & UA_CheckFlag) != 0);
}
void tmplput_ROOM_ACL(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)CTX(CTX_ROOMS);
StrBufAppendPrintf(Target, "%ld", Folder->RAFlags, 0);
}
void tmplput_ROOM_RAFLAGS(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)(TP->Context);
StrBufAppendPrintf(Target, "%d", Folder->RAFlags);
}
void tmplput_ThisRoomAide(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
LoadRoomAide();
StrBufAppendTemplate(Target, TP, WCC->CurRoom.RoomAide, 0);
}
int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
return (WCC != NULL)?
((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) : 0;
}
int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
return (WCC == NULL)? 0 :
( ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
(WCC->CurRoom.is_inbox) ||
(WCC->CurRoom.QRFlags2 & QR2_COLLABDEL) );
}
int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
return ( (WCC != NULL)
&& (WCC->logged_in)
&& (
(WCC->axlevel >= 6)
|| ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0)
|| (WCC->CurRoom.is_inbox)
)
);
}
void tmplput_ThisRoomPass(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
LoadRoomXA();
StrBufAppendTemplate(Target, TP, WCC->CurRoom.XAPass, 0);
}
void tmplput_ThisRoom_nNewMessages(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nNewMessages);
}
void tmplput_ThisRoom_nTotalMessages(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nTotalMessages);
}
void tmplput_ThisRoomOrder(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
LoadRoomXA();
StrBufAppendPrintf(Target, "%d", WCC->CurRoom.Order);
}
int ConditionalThisRoomOrder(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
long CheckThis;
if (WCC == NULL)
return 0;
LoadRoomXA();
CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
return CheckThis == WCC->CurRoom.Order;
}
void tmplput_ROOM_LISTORDER(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)CTX(CTX_ROOMS);
StrBufAppendPrintf(Target, "%d", Folder->Order);
}
int ConditionalThisRoomXHavePic(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC == NULL)
return 0;
LoadXRoomPic();
return WCC->CurRoom.XHaveRoomPic == 1;
}
int ConditionalThisRoomIsEdit(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC == NULL)
return 0;
return ((WCC->CurRoom.nRoomNameParts > 1) &&
(strcmp(ChrPtr(WCC->CurRoom.RoomNameParts[WCC->CurRoom.nRoomNameParts]), "edit") == 0));
}
int ConditionalThisRoomXHaveInfoText(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC == NULL)
return 0;
LoadXRoomInfoText();
return (StrLength(WCC->CurRoom.XInfoText)>0);
}
void tmplput_ThisRoomInfoText(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
long nchars = 0;
LoadXRoomInfoText();
nchars = GetTemplateTokenNumber(Target, TP, 0, 0);
if (!nchars) {
/* the whole thing */
StrBufAppendTemplate(Target, TP, WCC->CurRoom.XInfoText, 1);
}
else {
/* only a certain number of characters */
StrBuf *SubBuf;
SubBuf = NewStrBufDup(WCC->CurRoom.XInfoText);
if (StrLength(SubBuf) > nchars) {
StrBuf_Utf8StrCut(SubBuf, nchars);
StrBufAppendBufPlain(SubBuf, HKEY("..."), 0);
}
StrBufAppendTemplate(Target, TP, SubBuf, 1);
FreeStrBuf(&SubBuf);
}
}
void tmplput_ROOM_LASTCHANGE(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)CTX(CTX_ROOMS);
StrBufAppendPrintf(Target, "%d", Folder->lastchange);
}
void tmplput_ThisRoomDirectory(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
LoadRoomXA();
StrBufAppendTemplate(Target, TP, WCC->CurRoom.Directory, 0);
}
void tmplput_ThisRoomXNFiles(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
LoadXRoomXCountFiles();
StrBufAppendPrintf(Target, "%d", WCC->CurRoom.XDownloadCount);
}
void tmplput_ThisRoomX_FileString(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
LoadXRoomXCountFiles();
if (WCC->CurRoom.XDownloadCount == 1)
StrBufAppendBufPlain(Target, _("file"), -1, 0);
else
StrBufAppendBufPlain(Target, _("files"), -1, 0);
}
int ConditionalIsThisThatRoom(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)CTX(CTX_ROOMS);
wcsession *WCC = WC;
if (WCC == NULL)
return 0;
return Folder == WCC->ThisRoom;
}
int ConditionalRoomIsName(StrBuf *Target, WCTemplputParams *TP)
{
folder *Folder = (folder *)CTX(CTX_ROOMS);
const char *CheckRoomName = NULL;
long CheckRoomNameLen;
GetTemplateTokenString(Target, TP, 3, &CheckRoomName, &CheckRoomNameLen);
if (CheckRoomName == NULL)
return 0;
return strcmp(ChrPtr(Folder->name), CheckRoomName) == 0;
}
void
InitModule_ROOMTOKENS
(void)
{
/* we duplicate this, just to be shure its already done. */
RegisterCTX(CTX_ROOMS);
RegisterCTX(CTX_FLOORS);
RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, NULL, CTX_NONE);
RegisterNamespace("FLOOR:ID", 0, 0, tmplput_FLOOR_ID, NULL, CTX_FLOORS);
RegisterNamespace("ROOM:INFO:FLOORID", 0, 1, tmplput_ROOM_FLOORID, NULL, CTX_ROOMS);
RegisterNamespace("ROOM:INFO:FLOOR:ID", 0, 0, tmplput_ROOM_FLOOR_ID, NULL, CTX_ROOMS);
RegisterNamespace("FLOOR:NAME", 0, 1, tmplput_FLOOR_NAME, NULL, CTX_FLOORS);
RegisterNamespace("ROOM:INFO:FLOOR:NAME", 0, 1, tmplput_ROOM_FLOOR_NAME, NULL, CTX_ROOMS);
RegisterNamespace("THISROOM:FLOOR:NAME", 0, 1, tmplput_ThisRoomFloorName, NULL, CTX_NONE);
RegisterNamespace("FLOOR:NROOMS", 0, 0, tmplput_FLOOR_NROOMS, NULL, CTX_FLOORS);
RegisterNamespace("ROOM:INFO:FLOOR:NROOMS", 0, 0, tmplput_ROOM_FLOOR_NROOMS, NULL, CTX_ROOMS);
RegisterConditional("COND:FLOOR:ISSUBROOM", 0, ConditionalFloorIsSUBROOM, CTX_FLOORS);
RegisterConditional("COND:FLOOR:NROOMS", 1, ConditionalFloorHaveNRooms, CTX_FLOORS);
RegisterConditional("COND:ROOM:REST:ISSUBFLOOR", 0, ConditionalFloorIsRESTSubFloor, CTX_FLOORS);
RegisterConditional("COND:FLOOR:ISVIRTUAL", 0, ConditionalFloorIsVirtual, CTX_FLOORS);
/**** Room... ******/
/**** Name ******/
RegisterNamespace("THISROOM:NAME", 0, 1, tmplput_ThisRoom, NULL, CTX_NONE);
RegisterNamespace("ROOM:INFO:NAME", 0, 1, tmplput_ROOM_NAME, NULL, CTX_ROOMS);
RegisterNamespace("ROOM:INFO:BASENAME", 0, 1, tmplput_ROOM_BASENAME, NULL, CTX_ROOMS);
RegisterNamespace("ROOM:INFO:LEVELNTIMES", 1, 2, tmplput_ROOM_LEVEL_N_TIMES, NULL, CTX_ROOMS);
RegisterConditional("COND:ROOM:INFO:IS_INBOX", 0, ConditionalRoomIsInbox, CTX_ROOMS);
RegisterConditional("COND:ROOM:INFO:TYPE_IS", 0, ConditionalRoomIsType, CTX_ROOMS);
RegisterConditional("COND:ROOM:INFO:NAME_IS", 1, ConditionalRoomIsName, CTX_ROOMS);
/****** Properties ******/
RegisterNamespace("ROOM:INFO:QRFLAGS", 0, 1, tmplput_ROOM_QRFLAGS, NULL, CTX_ROOMS);
RegisterConditional("COND:THISROOM:FLAG:QR", 0, ConditionalThisRoomHas_QRFlag, CTX_NONE);
RegisterConditional("COND:THISROOM:EDIT", 0, ConditionalRoom_MayEdit, CTX_NONE);
RegisterConditional("COND:ROOM:FLAG:QR", 0, ConditionalRoomHas_QRFlag, CTX_ROOMS);
RegisterConditional("COND:THISROOM:FLAG:QR2", 0, ConditionalThisRoomHas_QRFlag2, CTX_NONE);
RegisterConditional("COND:ROOM:FLAG:QR2", 0, ConditionalRoomHas_QRFlag2, CTX_ROOMS);
RegisterConditional("COND:ROOM:FLAG:UA", 0, ConditionalRoomHas_UAFlag, CTX_ROOMS);
RegisterNamespace("ROOM:INFO:RAFLAGS", 0, 1, tmplput_ROOM_RAFLAGS, NULL, CTX_ROOMS);
RegisterNamespace("ROOM:INFO:LISTORDER", 0, 1, tmplput_ROOM_LISTORDER, NULL, CTX_ROOMS);
RegisterNamespace("THISROOM:ORDER", 0, 0, tmplput_ThisRoomOrder, NULL, CTX_NONE);
RegisterConditional("COND:THISROOM:ORDER", 0, ConditionalThisRoomOrder, CTX_NONE);
RegisterNamespace("ROOM:INFO:LASTCHANGE", 0, 1, tmplput_ROOM_LASTCHANGE, NULL, CTX_ROOMS);
RegisterNamespace("THISROOM:MSGS:NEW", 0, 0, tmplput_ThisRoom_nNewMessages, NULL, CTX_NONE);
RegisterNamespace("THISROOM:MSGS:TOTAL", 0, 0, tmplput_ThisRoom_nTotalMessages, NULL, CTX_NONE);
RegisterNamespace("THISROOM:PASS", 0, 1, tmplput_ThisRoomPass, NULL, CTX_NONE);
RegisterNamespace("THISROOM:AIDE", 0, 1, tmplput_ThisRoomAide, NULL, CTX_NONE);
RegisterConditional("COND:ROOMAIDE", 2, ConditionalRoomAide, CTX_NONE);
RegisterConditional("COND:ACCESS:DELETE", 2, ConditionalRoomAcessDelete, CTX_NONE);
RegisterConditional("COND:ROOM:EDITACCESS", 0, ConditionalHaveRoomeditRights, CTX_NONE);
RegisterConditional("COND:THISROOM:HAVE_PIC", 0, ConditionalThisRoomXHavePic, CTX_NONE);
RegisterConditional("COND:THISROOM:IS_EDIT", 0, ConditionalThisRoomIsEdit, CTX_NONE);
RegisterNamespace("THISROOM:INFOTEXT", 1, 2, tmplput_ThisRoomInfoText, NULL, CTX_NONE);
RegisterConditional("COND:THISROOM:HAVE_INFOTEXT", 0, ConditionalThisRoomXHaveInfoText, CTX_NONE);
RegisterNamespace("THISROOM:FILES:N", 0, 1, tmplput_ThisRoomXNFiles, NULL, CTX_NONE);
RegisterNamespace("THISROOM:FILES:STR", 0, 1, tmplput_ThisRoomX_FileString, NULL, CTX_NONE);
RegisterNamespace("THISROOM:DIRECTORY", 0, 1, tmplput_ThisRoomDirectory, NULL, CTX_NONE);
RegisterNamespace("ROOM:INFO:ACL", 0, 1, tmplput_ROOM_ACL, NULL, CTX_ROOMS);
RegisterConditional("COND:THIS:THAT:ROOM", 0, ConditionalIsThisThatRoom, CTX_ROOMS);
}
webcit-dfsg.orig/webcit.c 0000644 0001750 0001750 00000062003 13223341037 015421 0 ustar michael michael /*
* This is the main transaction loop of the web service. It maintains a
* persistent session to the Citadel server, handling HTTP WebCit requests as
* they arrive and presenting a user interface.
*
* Copyright (c) 1996-2013 by the citadel.org team
*
* This program is open source software. You can redistribute it and/or
* modify it under the terms of the GNU General Public License, version 3.
*/
#define SHOW_ME_VAPPEND_PRINTF
#include
#include
#include "webcit.h"
#include "dav.h"
#include "webserver.h"
StrBuf *csslocal = NULL;
HashList *HandlerHash = NULL;
void stuff_to_cookie(int unset_cookie);
extern int GetConnected(void);
extern int verbose;
void PutRequestLocalMem(void *Data, DeleteHashDataFunc DeleteIt)
{
wcsession *WCC = WC;
int n;
n = GetCount(WCC->Hdr->HTTPHeaders);
Put(WCC->Hdr->HTTPHeaders, IKEY(n), Data, DeleteIt);
}
void DeleteWebcitHandler(void *vHandler)
{
WebcitHandler *Handler = (WebcitHandler*) vHandler;
FreeStrBuf(&Handler->Name);
FreeStrBuf(&Handler->DisplayName);
free (Handler);
}
void WebcitAddUrlHandler(const char * UrlString, long UrlSLen,
const char *DisplayName, long dslen,
WebcitHandlerFunc F,
long Flags)
{
WebcitHandler *NewHandler;
NewHandler = (WebcitHandler*) malloc(sizeof(WebcitHandler));
NewHandler->F = F;
NewHandler->Flags = Flags;
NewHandler->Name = NewStrBufPlain(UrlString, UrlSLen);
StrBufShrinkToFit(NewHandler->Name, 1);
NewHandler->DisplayName = NewStrBufPlain(DisplayName, dslen);
StrBufShrinkToFit(NewHandler->DisplayName, 1);
Put(HandlerHash, UrlString, UrlSLen, NewHandler, DeleteWebcitHandler);
}
void tmplput_HANDLER_DISPLAYNAME(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC->Hdr->HR.Handler != NULL)
StrBufAppendTemplate(Target, TP, WCC->Hdr->HR.Handler->DisplayName, 0);
}
/*
* web-printing funcion. uses our vsnprintf wrapper
*/
#ifdef UBER_VERBOSE_DEBUGGING
void wcc_printf(const char *FILE, const char *FUNCTION, long LINE, const char *format,...)
#else
void wc_printf(const char *format,...)
#endif
{
wcsession *WCC = WC;
va_list arg_ptr;
if (WCC->WBuf == NULL)
WCC->WBuf = NewStrBuf();
#ifdef UBER_VERBOSE_DEBUGGING
StrBufAppendPrintf(WCC->WBuf, "\n%s:%s:%d[", FILE, FUNCTION, LINE);
#endif
va_start(arg_ptr, format);
StrBufVAppendPrintf(WCC->WBuf, format, arg_ptr);
va_end(arg_ptr);
#ifdef UBER_VERBOSE_DEBUGGING
StrBufAppendPrintf(WCC->WBuf, "]\n");
#endif
}
/*
* http-header-printing funcion. uses our vsnprintf wrapper
*/
void hprintf(const char *format,...)
{
wcsession *WCC = WC;
va_list arg_ptr;
va_start(arg_ptr, format);
StrBufVAppendPrintf(WCC->HBuf, format, arg_ptr);
va_end(arg_ptr);
}
/*
* wrap up an HTTP session, closes tags, etc.
*
* print_standard_html_footer should be set to:
* 0 - to transmit only,
* nonzero - to append the closing tags
*/
void wDumpContent(int print_standard_html_footer)
{
if (print_standard_html_footer) {
wc_printf(" \n");
do_template("trailing");
}
/* If we've been saving it all up for one big output burst,
* go ahead and do that now.
*/
end_burst();
}
/*
* Output HTTP headers and leading HTML for a page
*/
void output_headers( int do_httpheaders, /* 1 = output HTTP headers */
int do_htmlhead, /* 1 = output HTML section and opener */
int do_room_banner, /* 1 = include the room banner and */
int unset_cookies, /* 1 = session is terminating, so unset the cookies */
int suppress_check, /* 1 = suppress check for instant messages */
int cache /* 1 = allow browser to cache this page */
) {
wcsession *WCC = WC;
char httpnow[128];
if (WCC->isFailure)
hprintf("HTTP/2.2 500 Internal Server Error");
else if (WCC->Hdr->HaveRange > 1)
hprintf("HTTP/1.1 206 Partial Content\r\n");
else
hprintf("HTTP/1.1 200 OK\r\n");
http_datestring(httpnow, sizeof httpnow, time(NULL));
if (do_httpheaders) {
if (WCC->serv_info != NULL)
hprintf("Content-type: text/html; charset=utf-8\r\n"
"Server: %s / %s\n"
"Connection: close\r\n",
PACKAGE_STRING,
ChrPtr(WCC->serv_info->serv_software));
else
hprintf("Content-type: text/html; charset=utf-8\r\n"
"Server: %s / [n/a]\n"
"Connection: close\r\n",
PACKAGE_STRING);
}
if (cache > 0) {
char httpTomorow[128];
http_datestring(httpTomorow, sizeof httpTomorow,
time(NULL) + 60 * 60 * 24 * 2);
hprintf("Pragma: public\r\n"
"Cache-Control: max-age=3600, must-revalidate\r\n"
"Last-modified: %s\r\n"
"Expires: %s\r\n",
httpnow,
httpTomorow
);
}
else {
hprintf("Pragma: no-cache\r\n"
"Cache-Control: no-store\r\n"
"Expires: -1\r\n"
);
}
if (cache < 2) stuff_to_cookie(unset_cookies);
if (do_htmlhead) {
begin_burst();
do_template("head");
if ( (WCC->logged_in) && (!unset_cookies) ) {
DoTemplate(HKEY("paging"), NULL, &NoCtx);
}
if (do_room_banner) {
tmplput_roombanner(NULL, NULL);
}
}
if (do_room_banner) {
wc_printf("
\n");
}
}
void output_custom_content_header(const char *ctype) {
hprintf("HTTP/1.1 200 OK\r\n");
hprintf("Content-type: %s; charset=utf-8\r\n",ctype);
hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
hprintf("Connection: close\r\n");
}
/*
* Generic function to do an HTTP redirect. Easy and fun.
*/
void http_redirect(const char *whichpage) {
hprintf("HTTP/1.1 302 Moved Temporarily\n");
hprintf("Location: %s\r\n", whichpage);
hprintf("URI: %s\r\n", whichpage);
hprintf("Content-type: text/html; charset=utf-8\r\n");
stuff_to_cookie(0);
begin_burst();
wc_printf("");
wc_printf("Go here.", whichpage);
wc_printf("\n");
end_burst();
}
/*
* Output a piece of content to the web browser using conformant HTTP and MIME semantics.
*
* If this function is called, it is expected that begin_burst() has already been called
* and some sort of content has been fed into the buffer. This function will transmit a
* bunch of headers to the client. end_burst() will add some headers of its own, and then
* transmit the buffered content to the client.
*/
void http_transmit_thing(const char *content_type, int is_static)
{
if (verbose)
syslog(LOG_DEBUG, "http_transmit_thing(%s)%s", content_type, ((is_static > 0) ? " (static)" : ""));
output_headers(0, 0, 0, 0, 0, is_static);
hprintf("Content-type: %s\r\n"
"Server: %s\r\n"
"Connection: close\r\n",
content_type,
PACKAGE_STRING);
end_burst();
}
void http_transmit_headers(const char *content_type, int is_static, long is_chunked, int is_gzip)
{
wcsession *WCC = WC;
if (verbose)
syslog(LOG_DEBUG, "http_transmit_thing(%s)%s", content_type, ((is_static > 0) ? " (static)" : ""));
output_headers(0, 0, 0, 0, 0, is_static);
if (is_gzip)
hprintf("Content-encoding: gzip\r\n");
if (WCC->Hdr->HaveRange)
hprintf("Accept-Ranges: bytes\r\n"
"Content-Range: bytes %ld-%ld/%ld\r\n",
WCC->Hdr->RangeStart,
WCC->Hdr->RangeTil,
WCC->Hdr->TotalBytes);
hprintf("Content-type: %s\r\n"
"Server: "PACKAGE_STRING"\r\n"
"%s"
"Connection: close\r\n\r\n",
content_type,
(is_chunked)?"Transfer-Encoding: chunked\r\n":"");
}
/*
* Convenience functions to display a page containing only a string
*
* titlebarcolor color of the titlebar of the frame
* titlebarmsg text to display in the title bar
* messagetext body of the box
*/
void convenience_page(const char *titlebarcolor, const char *titlebarmsg, const char *messagetext)
{
hprintf("HTTP/1.1 200 OK\n");
output_headers(1, 1, 1, 0, 0, 0);
wc_printf("
\r\n");
if (WCC->ImportantMsg != NULL) {
message = ChrPtr(WCC->ImportantMsg);
}
wc_printf(
_("The resource you requested requires a valid username and password. "
"You could not be logged in: %s\n"),
message
);
wDumpContent(0);
}
/*
* Convenience functions to wrap around asynchronous ajax responses
*/
void begin_ajax_response(void) {
wcsession *WCC = WC;
FlushStrBuf(WCC->HBuf);
output_headers(0, 0, 0, 0, 0, 0);
hprintf("Content-type: text/html; charset=UTF-8\r\n"
"Server: %s\r\n"
"Connection: close\r\n"
,
PACKAGE_STRING);
begin_burst();
}
/*
* print ajax response footer
*/
void end_ajax_response(void) {
wDumpContent(0);
}
/*
* Wraps a Citadel server command in an AJAX transaction.
*/
void ajax_servcmd(void)
{
wcsession *WCC = WC;
int Done = 0;
StrBuf *Buf;
char *junk;
size_t len;
if (verbose)
syslog(LOG_DEBUG, "ajax_servcmd() g_cmd=\"%s\"", bstr("g_cmd") );
begin_ajax_response();
Buf = NewStrBuf();
serv_puts(bstr("g_cmd"));
StrBuf_ServGetln(Buf);
StrBufAppendBuf(WCC->WBuf, Buf, 0);
StrBufAppendBufPlain(WCC->WBuf, HKEY("\n"), 0);
switch (GetServerStatus(Buf, NULL)) {
case 8:
serv_puts("\n\n000");
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000")) {
StrBufAppendBufPlain(WCC->WBuf, HKEY("\000"), 0);
break;
}
case 1:
while (!Done) {
if (StrBuf_ServGetln(Buf) < 0)
break;
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000")) {
Done = 1;
}
StrBufAppendBuf(WCC->WBuf, Buf, 0);
StrBufAppendBufPlain(WCC->WBuf, HKEY("\n"), 0);
}
break;
case 4:
text_to_server(bstr("g_input"));
serv_puts("000");
break;
case 6:
len = atol(&ChrPtr(Buf)[4]);
StrBuf_ServGetBLOBBuffered(Buf, len);
break;
case 7:
len = atol(&ChrPtr(Buf)[4]);
junk = malloc(len);
memset(junk, 0, len);
serv_write(junk, len);
free(junk);
}
end_ajax_response();
/*
* This is kind of an ugly hack, but this is the only place it can go.
* If the command was GEXP, then the instant messenger window must be
* running, so reset the "last_pager_check" watchdog timer so
* that page_popup() doesn't try to open it a second time. TODO: page_popup isn't with us anymore.
*/
if (!strncasecmp(bstr("g_cmd"), "GEXP", 4)) {
WCC->last_pager_check = time(NULL);
}
FreeStrBuf(&Buf);
}
/*
* Helper function for the asynchronous check to see if we need
* to open the instant messenger window.
*/
void seconds_since_last_gexp(void)
{
char buf[256];
if ( (time(NULL) - WC->last_pager_check) < 30) {
wc_printf("NO\n");
}
else {
memset(buf, 0, 5);
serv_puts("NOOP");
serv_getln(buf, sizeof buf);
if (buf[3] == '*') {
wc_printf("YES");
}
else {
wc_printf("NO");
}
}
}
/*
* Save a URL destination so we can go to it later
*/
void push_destination(void) {
wcsession *WCC = WC;
if (!WCC) {
wc_printf("no session");
return;
}
FreeStrBuf(&WCC->PushedDestination);
WCC->PushedDestination = NewStrBufDup(sbstr("url"));
if (verbose)
syslog(LOG_DEBUG, "Push: %s", ChrPtr(WCC->PushedDestination));
wc_printf("OK");
}
/*
* Go to the URL saved by push_destination()
*/
void pop_destination(void) {
wcsession *WCC = WC;
/*
* If we are in the middle of a new user signup, the server may request that
* we first pass through a registration screen.
*/
if ((WCC) && (WCC->need_regi)) {
if ((WCC->PushedDestination != NULL) && (StrLength(WCC->PushedDestination) > 0)) {
/* Registering will take us to the My Citadel Config room, so save our place */
StrBufAppendBufPlain(WCC->PushedDestination, HKEY("?go="), 0);
StrBufUrlescAppend(WCC->PushedDestination, WCC->CurRoom.name, NULL);
}
WCC->need_regi = 0;
display_reg(1);
return;
}
/*
* Do something reasonable if we somehow ended up requesting a pop without
* having first done a push.
*/
if ( (!WCC) || (WCC->PushedDestination == NULL) || (StrLength(WCC->PushedDestination) == 0) ) {
do_welcome();
return;
}
/*
* All righty then! We have a destination saved, so go there now.
*/
if (verbose)
syslog(LOG_DEBUG, "Pop: %s", ChrPtr(WCC->PushedDestination));
http_redirect(ChrPtr(WCC->PushedDestination));
}
int ReadPostData(void)
{
int rc;
int urlencoded_post = 0;
wcsession *WCC = WC;
StrBuf *content = NULL;
urlencoded_post = (strncasecmp(ChrPtr(WCC->Hdr->HR.ContentType), "application/x-www-form-urlencoded", 33) == 0) ;
content = NewStrBufPlain(NULL, WCC->Hdr->HR.ContentLength + 256);
if (!urlencoded_post)
{
StrBufPrintf(content,
"Content-type: %s\n"
"Content-length: %ld\n\n",
ChrPtr(WCC->Hdr->HR.ContentType),
WCC->Hdr->HR.ContentLength);
}
/** Read the entire input data at once. */
rc = client_read_to(WCC->Hdr, content,
WCC->Hdr->HR.ContentLength,
SLEEPING);
if (rc < 0)
return rc;
if (urlencoded_post) {
ParseURLParams(content);
} else if (!strncasecmp(ChrPtr(WCC->Hdr->HR.ContentType), "multipart", 9)) {
char *Buf;
char *BufEnd;
long len;
len = StrLength(content);
Buf = SmashStrBuf(&content);
BufEnd = Buf + len;
mime_parser(Buf, BufEnd, *upload_handler, NULL, NULL, NULL, 0);
free(Buf);
} else if (WCC->Hdr->HR.ContentLength > 0) {
WCC->upload = content;
WCC->upload_length = StrLength(WCC->upload);
content = NULL;
}
FreeStrBuf(&content);
return 1;
}
int Conditional_REST_DEPTH(StrBuf *Target, WCTemplputParams *TP)
{
long Depth, IsDepth;
long offset = 0;
wcsession *WCC = WC;
if (WCC->Hdr->HR.Handler != NULL)
offset ++;
Depth = GetTemplateTokenNumber(Target, TP, 2, 0);
IsDepth = GetCount(WCC->Directory) + offset;
// LogTemplateError(Target, "bla", 1, TP, "REST_DEPTH: %ld : %ld\n", Depth, IsDepth);
if (Depth < 0) {
Depth = -Depth;
return IsDepth > Depth;
}
else
return Depth == IsDepth;
}
/*
* Entry point for WebCit transaction
*/
void session_loop(void)
{
int xhttp;
StrBuf *Buf;
/*
* We stuff these with the values coming from the client cookies,
* so we can use them to reconnect a timed out session if we have to.
*/
wcsession *WCC;
WCC= WC;
WCC->upload_length = 0;
WCC->upload = NULL;
WCC->Hdr->nWildfireHeaders = 0;
if (WCC->Hdr->HR.ContentLength > 0) {
if (ReadPostData() < 0) {
return;
}
}
Buf = NewStrBuf();
WCC->trailing_javascript = NewStrBuf();
/* Convert base64-encoded URL's back to plain text */
if (!strncmp(ChrPtr(WCC->Hdr->this_page), "/B64", 4)) {
StrBufCutLeft(WCC->Hdr->this_page, 4);
StrBufDecodeBase64(WCC->Hdr->this_page);
http_redirect(ChrPtr(WCC->Hdr->this_page));
goto SKIP_ALL_THIS_CRAP;
}
/* If there are variables in the URL, we must grab them now */
if (WCC->Hdr->PlainArgs != NULL)
ParseURLParams(WCC->Hdr->PlainArgs);
/* If the client sent a nonce that is incorrect, kill the request. */
if (havebstr("nonce")) {
if (verbose)
syslog(LOG_DEBUG, "Comparing supplied nonce %s to session nonce %d",
bstr("nonce"), WCC->nonce
);
if (ibstr("nonce") != WCC->nonce) {
syslog(LOG_INFO, "Ignoring request with mismatched nonce.");
hprintf("HTTP/1.1 404 Security check failed\r\n");
hprintf("Content-Type: text/plain\r\n");
begin_burst();
wc_printf("Security check failed.\r\n");
end_burst();
goto SKIP_ALL_THIS_CRAP;
}
}
/*
* If we're not connected to a Citadel server, try to hook up the connection now.
*/
if (!WCC->connected) {
if (GetConnected()) {
hprintf("HTTP/1.1 503 Service Unavailable\r\n");
hprintf("Content-Type: text/html\r\n");
begin_burst();
wc_printf("503 Service Unavailable\n");
wc_printf(_("This program was unable to connect or stay "
"connected to the Citadel server. Please report "
"this problem to your system administrator.")
);
wc_printf(" ");
wc_printf("%s",
_("Read More...")
);
wc_printf("\n");
end_burst();
goto SKIP_ALL_THIS_CRAP;
}
}
/*
* If we're not logged in, but we have authentication data (either from
* a cookie or from http-auth), try logging in to Citadel using that.
*/
if ( (!WCC->logged_in)
&& (StrLength(WCC->Hdr->c_username) > 0)
&& (StrLength(WCC->Hdr->c_password) > 0)
) {
long Status;
FlushStrBuf(Buf);
serv_printf("USER %s", ChrPtr(WCC->Hdr->c_username));
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, &Status) == 3) {
serv_printf("PASS %s", ChrPtr(WCC->Hdr->c_password));
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, NULL) == 2) {
become_logged_in(WCC->Hdr->c_username,
WCC->Hdr->c_password, Buf);
} else {
/* Should only display when password is wrong */
WCC->ImportantMsg = NewStrBufPlain(ChrPtr(Buf) + 4, StrLength(Buf) - 4);
authorization_required();
FreeStrBuf(&Buf);
goto SKIP_ALL_THIS_CRAP;
}
}
else if (Status == 541) {
WCC->logged_in = 1;
}
}
xhttp = (WCC->Hdr->HR.eReqType != eGET) &&
(WCC->Hdr->HR.eReqType != ePOST) &&
(WCC->Hdr->HR.eReqType != eHEAD);
/*
* If a 'go' (or 'gotofirst') parameter has been specified, attempt to goto that room
* prior to doing anything else.
*/
if (havebstr("go")) {
int ret;
if (verbose)
syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("go"));
ret = gotoroom(sbstr("go")); /* do quietly to avoid session output! */
if ((ret/100) != 2) {
if (verbose)
syslog(LOG_DEBUG, "Unable to change to [%s]; Reason: %d", bstr("go"), ret);
}
}
else if (havebstr("gotofirst")) {
int ret;
if (verbose)
syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("gotofirst"));
ret = gotoroom(sbstr("gotofirst")); /* do quietly to avoid session output! */
if ((ret/100) != 2) {
syslog(LOG_INFO, "Unable to change to [%s]; Reason: %d", bstr("gotofirst"), ret);
}
}
/*
* If we aren't in any room yet, but we have cookie data telling us where we're
* supposed to be, and 'go' was not specified, then go there.
*/
else if ( (StrLength(WCC->CurRoom.name) == 0) && ( (StrLength(WCC->Hdr->c_roomname) > 0) )) {
int ret;
if (verbose)
syslog(LOG_DEBUG, "We are in '%s' but cookie indicates '%s', going there...",
ChrPtr(WCC->CurRoom.name),
ChrPtr(WCC->Hdr->c_roomname)
);
ret = gotoroom(WCC->Hdr->c_roomname); /* do quietly to avoid session output! */
if ((ret/100) != 2) {
if (verbose)
syslog(LOG_DEBUG, "COOKIEGOTO: Unable to change to [%s]; Reason: %d",
ChrPtr(WCC->Hdr->c_roomname), ret);
}
}
if (WCC->Hdr->HR.Handler != NULL) {
if ( (!WCC->logged_in)
&& ((WCC->Hdr->HR.Handler->Flags & ANONYMOUS) == 0)
&& (WCC->serv_info != NULL)
&& (WCC->serv_info->serv_supports_guest == 0)
) {
display_login();
}
else {
if ((WCC->Hdr->HR.Handler->Flags & AJAX) != 0) {
begin_ajax_response();
}
WCC->Hdr->HR.Handler->F();
if ((WCC->Hdr->HR.Handler->Flags & AJAX) != 0) {
end_ajax_response();
}
}
}
/* When all else fails, display the default landing page or a main menu. */
else {
/*
* ordinary browser users get a nice login screen, DAV etc. requsets
* are given a 401 so they can handle it appropriate.
*/
if (!WCC->logged_in) {
if (xhttp) {
authorization_required();
}
else {
display_default_landing_page();
}
}
/*
* Toplevel dav requests? or just a flat browser request?
*/
else {
if (xhttp) {
dav_main();
}
else {
display_main_menu();
}
}
}
SKIP_ALL_THIS_CRAP:
FreeStrBuf(&Buf);
fflush(stdout);
}
/*
* Display the appropriate landing page for this site.
*/
void display_default_landing_page(void) {
wcsession *WCC = WC;
if (WCC && WCC->serv_info && WCC->serv_info->serv_supports_guest) {
/* default action */
if (havebstr("go")) {
if (verbose)
syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("go"));
smart_goto(sbstr("go"));
}
else if (default_landing_page) {
http_redirect(default_landing_page);
}
else {
StrBuf *teh_lobby = NewStrBufPlain(HKEY("_BASEROOM_"));
smart_goto(teh_lobby);
FreeStrBuf(&teh_lobby);
}
}
else {
display_login();
}
}
/*
* Replacement for sleep() that uses select() in order to avoid SIGALRM
*/
void sleeeeeeeeeep(int seconds)
{
struct timeval tv;
tv.tv_sec = seconds;
tv.tv_usec = 0;
select(0, NULL, NULL, NULL, &tv);
}
int Conditional_IS_HTTPS(StrBuf *Target, WCTemplputParams *TP)
{
return is_https != 0;
}
void AppendImportantMessage(const char *pch, long len)
{
wcsession *WCC = WC;
if (StrLength(WCC->ImportantMsg) > 0) {
StrBufAppendBufPlain(WCC->ImportantMsg, HKEY("\n"), 0);
}
StrBufAppendBufPlain(WCC->ImportantMsg, pch, len, 0);
}
int ConditionalImportantMesage(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC != NULL)
return (StrLength(WCC->ImportantMsg) > 0);
else
return 0;
}
void tmplput_importantmessage(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC != NULL) {
if (StrLength(WCC->ImportantMsg) > 0) {
StrBufAppendTemplate(Target, TP, WCC->ImportantMsg, 0);
}
}
}
void tmplput_trailing_javascript(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC != NULL)
StrBufAppendTemplate(Target, TP, WCC->trailing_javascript, 0);
}
void tmplput_csslocal(StrBuf *Target, WCTemplputParams *TP)
{
StrBufAppendBuf(Target,
csslocal, 0);
}
void tmplput_packagestring(StrBuf *Target, WCTemplputParams *TP)
{
StrBufAppendBufPlain(Target,
HKEY(PACKAGE_STRING), 0);
}
extern char static_local_dir[PATH_MAX];
void
InitModule_WEBCIT
(void)
{
char dir[SIZ];
WebcitAddUrlHandler(HKEY("blank"), "", 0, blank_page, ANONYMOUS|COOKIEUNNEEDED|ISSTATIC);
WebcitAddUrlHandler(HKEY("landing"), "", 0, display_default_landing_page, ANONYMOUS|COOKIEUNNEEDED);
WebcitAddUrlHandler(HKEY("do_template"), "", 0, url_do_template, ANONYMOUS);
WebcitAddUrlHandler(HKEY("sslg"), "", 0, seconds_since_last_gexp, AJAX|LOGCHATTY);
WebcitAddUrlHandler(HKEY("ajax_servcmd"), "", 0, ajax_servcmd, 0);
WebcitAddUrlHandler(HKEY("webcit"), "", 0, blank_page, URLNAMESPACE);
WebcitAddUrlHandler(HKEY("push"), "", 0, push_destination, AJAX);
WebcitAddUrlHandler(HKEY("pop"), "", 0, pop_destination, 0);
WebcitAddUrlHandler(HKEY("401"), "", 0, authorization_required, ANONYMOUS|COOKIEUNNEEDED);
RegisterConditional("COND:IMPMSG", 0, ConditionalImportantMesage, CTX_NONE);
RegisterConditional("COND:REST:DEPTH", 0, Conditional_REST_DEPTH, CTX_NONE);
RegisterConditional("COND:IS_HTTPS", 0, Conditional_IS_HTTPS, CTX_NONE);
RegisterNamespace("CSSLOCAL", 0, 0, tmplput_csslocal, NULL, CTX_NONE);
RegisterNamespace("IMPORTANTMESSAGE", 0, 1, tmplput_importantmessage, NULL, CTX_NONE);
RegisterNamespace("TRAILING_JAVASCRIPT", 0, 0, tmplput_trailing_javascript, NULL, CTX_NONE);
RegisterNamespace("URL:DISPLAYNAME", 0, 1, tmplput_HANDLER_DISPLAYNAME, NULL, CTX_NONE);
RegisterNamespace("PACKAGESTRING", 0, 1, tmplput_packagestring, NULL, CTX_NONE);
snprintf(dir, SIZ, "%s/webcit.css", static_local_dir);
if (!access(dir, R_OK)) {
syslog(LOG_INFO, "Using local Stylesheet [%s]", dir);
csslocal = NewStrBufPlain(HKEY(""));
}
else
syslog(LOG_INFO, "No Site-local Stylesheet [%s] installed.", dir);
}
void
ServerStartModule_WEBCIT
(void)
{
HandlerHash = NewHash(1, NULL);
}
void
ServerShutdownModule_WEBCIT
(void)
{
FreeStrBuf(&csslocal);
DeleteHash(&HandlerHash);
}
void
SessionNewModule_WEBCIT
(wcsession *sess)
{
sess->ImportantMsg = NewStrBuf();
sess->WBuf = NewStrBufPlain(NULL, SIZ * 4);
sess->HBuf = NewStrBufPlain(NULL, SIZ / 4);
}
void
SessionDetachModule_WEBCIT
(wcsession *sess)
{
DeleteHash(&sess->Directory);
FreeStrBuf(&sess->upload);
sess->upload_length = 0;
FreeStrBuf(&sess->trailing_javascript);
if (StrLength(sess->WBuf) > SIZ * 30) /* Bigger than 120K? release. */
{
FreeStrBuf(&sess->WBuf);
sess->WBuf = NewStrBuf();
}
else
FlushStrBuf(sess->WBuf);
FlushStrBuf(sess->HBuf);
if (StrLength(sess->ImportantMsg) > 0) {
FlushStrBuf(sess->ImportantMsg);
}
}
void
SessionDestroyModule_WEBCIT
(wcsession *sess)
{
FreeStrBuf(&sess->WBuf);
FreeStrBuf(&sess->HBuf);
FreeStrBuf(&sess->ImportantMsg);
FreeStrBuf(&sess->PushedDestination);
}
webcit-dfsg.orig/aclocal.m4 0000644 0001750 0001750 00000010241 13223341054 015634 0 ustar michael michael # generated automatically by aclocal 1.14.1 -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is '.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
# Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd "$ac_aux_dir" && pwd`
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it is modern enough.
# If it is, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
*)
MISSING="\${SHELL} $am_aux_dir/missing" ;;
esac
fi
# Use eval to expand $SHELL
if eval "$MISSING --is-lightweight"; then
am_missing_run="$MISSING "
else
am_missing_run=
AC_MSG_WARN(['missing' script is too old or missing])
fi
])
m4_include([acinclude.m4])
webcit-dfsg.orig/missing 0000755 0001750 0001750 00000014002 13223341037 015373 0 ustar michael michael #! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
# Franc,ois Pinard , 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 3.
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing - GNU libit 0.0"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`configure.in'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`configure.in'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`configure.in'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER([^):]*:\([^)]*\)).*/\1/p' configure.in`
if test -z "$files"; then
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^):]*\)).*/\1/p' configure.in`
test -z "$files" || files="$files.in"
else
files=`echo "$files" | sed -e 's/:/ /g'`
fi
test -z "$files" && files="config.h.in"
touch $files
;;
automake)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print \
| sed 's/^\(.*\).am$/touch \1.in/' \
| sh
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
webcit-dfsg.orig/availability.c 0000644 0001750 0001750 00000016620 13223341037 016622 0 ustar michael michael /*
* Copyright (c) 1996-2012 by the citadel.org team
*
* This program is open source software. You can redistribute it and/or
* modify it under the terms of the GNU General Public License, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "webcit.h"
#include "webserver.h"
#include "calendar.h"
/*
* Utility function to fetch a VFREEBUSY type of thing for any specified user.
*/
icalcomponent *get_freebusy_for_user(char *who) {
long nLines;
char buf[SIZ];
StrBuf *serialized_fb = NewStrBuf();
icalcomponent *fb = NULL;
serv_printf("ICAL freebusy|%s", who);
serv_getln(buf, sizeof buf);
if (buf[0] == '1') {
read_server_text(serialized_fb, &nLines);
}
if (serialized_fb == NULL) {
return NULL;
}
fb = icalcomponent_new_from_string(ChrPtr(serialized_fb));
FreeStrBuf(&serialized_fb);
if (fb == NULL) {
return NULL;
}
return(fb);
}
/*
* Check to see if two events overlap.
* (This function is used in both Citadel and WebCit. If you change it in
* one place, change it in the other. We should seriously consider moving
* this function upstream into libical.)
*
* Returns nonzero if they do overlap.
*/
int ical_ctdl_is_overlap(
struct icaltimetype t1start,
struct icaltimetype t1end,
struct icaltimetype t2start,
struct icaltimetype t2end
) {
if (icaltime_is_null_time(t1start)) return(0);
if (icaltime_is_null_time(t2start)) return(0);
/* if either event lacks end time, assume end = start */
if (icaltime_is_null_time(t1end))
memcpy(&t1end, &t1start, sizeof(struct icaltimetype));
else {
if (t1end.is_date && icaltime_compare(t1start, t1end)) {
/*
* the end date is non-inclusive so adjust it by one
* day because our test is inclusive, note that a day is
* not too much because we are talking about all day
* events
* if start = end we assume that nevertheless the whole
* day is meant
*/
icaltime_adjust(&t1end, -1, 0, 0, 0);
}
}
if (icaltime_is_null_time(t2end))
memcpy(&t2end, &t2start, sizeof(struct icaltimetype));
else {
if (t2end.is_date && icaltime_compare(t2start, t2end)) {
icaltime_adjust(&t2end, -1, 0, 0, 0);
}
}
/* First, check for all-day events */
if (t1start.is_date || t2start.is_date) {
/* If event 1 ends before event 2 starts, we're in the clear. */
if (icaltime_compare_date_only(t1end, t2start) < 0) return(0);
/* If event 2 ends before event 1 starts, we're also ok. */
if (icaltime_compare_date_only(t2end, t1start) < 0) return(0);
return(1);
}
/* syslog(LOG_DEBUG, "Comparing t1start %d:%d t1end %d:%d t2start %d:%d t2end %d:%d \n",
t1start.hour, t1start.minute, t1end.hour, t1end.minute,
t2start.hour, t2start.minute, t2end.hour, t2end.minute);
*/
/* Now check for overlaps using date *and* time. */
/* If event 1 ends before event 2 starts, we're in the clear. */
if (icaltime_compare(t1end, t2start) <= 0) return(0);
/* syslog(LOG_DEBUG, "first passed\n"); */
/* If event 2 ends before event 1 starts, we're also ok. */
if (icaltime_compare(t2end, t1start) <= 0) return(0);
/* syslog(LOG_DEBUG, "second passed\n"); */
/* Otherwise, they overlap. */
return(1);
}
/*
* Back end function for check_attendee_availability()
* This one checks an individual attendee against a supplied
* event start and end time. All these fields have already been
* broken out.
*
* attendee_string name of the attendee
* event_start start time of the event to check
* event_end end time of the event to check
*
* The result is placed in 'annotation'.
*/
void check_individual_attendee(char *attendee_string,
struct icaltimetype event_start,
struct icaltimetype event_end,
char *annotation) {
icalcomponent *fbc = NULL;
icalcomponent *fb = NULL;
icalproperty *thisfb = NULL;
struct icalperiodtype period;
/*
* Set to 'unknown' right from the beginning. Unless we learn
* something else, that's what we'll go with.
*/
strcpy(annotation, _("availability unknown"));
fbc = get_freebusy_for_user(attendee_string);
if (fbc == NULL) {
return;
}
/*
* Make sure we're looking at a VFREEBUSY by itself. What we're probably
* looking at initially is a VFREEBUSY encapsulated in a VCALENDAR.
*/
if (icalcomponent_isa(fbc) == ICAL_VCALENDAR_COMPONENT) {
fb = icalcomponent_get_first_component(fbc, ICAL_VFREEBUSY_COMPONENT);
}
else if (icalcomponent_isa(fbc) == ICAL_VFREEBUSY_COMPONENT) {
fb = fbc;
}
/* Iterate through all FREEBUSY's looking for conflicts. */
if (fb != NULL) {
strcpy(annotation, _("free"));
for (thisfb = icalcomponent_get_first_property(fb, ICAL_FREEBUSY_PROPERTY);
thisfb != NULL;
thisfb = icalcomponent_get_next_property(fb, ICAL_FREEBUSY_PROPERTY) ) {
/** Do the check */
period = icalproperty_get_freebusy(thisfb);
if (ical_ctdl_is_overlap(period.start, period.end,
event_start, event_end)) {
strcpy(annotation, _("BUSY"));
}
}
}
icalcomponent_free(fbc);
}
/*
* Check the availability of all attendees for an event (when possible)
* and annotate accordingly.
*
* vevent the event which should be compared with attendees calendar
*/
void check_attendee_availability(icalcomponent *vevent) {
icalproperty *attendee = NULL;
icalproperty *dtstart_p = NULL;
icalproperty *dtend_p = NULL;
struct icaltimetype dtstart_t;
struct icaltimetype dtend_t;
char attendee_string[SIZ];
char annotated_attendee_string[SIZ];
char annotation[SIZ];
const char *ch;
if (vevent == NULL) {
return;
}
/*
* If we're looking at a fully encapsulated VCALENDAR
* rather than a VEVENT component, attempt to use the first
* relevant VEVENT subcomponent. If there is none, the
* NULL returned by icalcomponent_get_first_component() will
* tell the next iteration of this function to create a
* new one.
*/
if (icalcomponent_isa(vevent) == ICAL_VCALENDAR_COMPONENT) {
check_attendee_availability(
icalcomponent_get_first_component(
vevent, ICAL_VEVENT_COMPONENT
)
);
return;
}
ical_dezonify(vevent); /**< Convert everything to UTC */
/*
* Learn the start and end times.
*/
dtstart_p = icalcomponent_get_first_property(vevent, ICAL_DTSTART_PROPERTY);
if (dtstart_p != NULL) dtstart_t = icalproperty_get_dtstart(dtstart_p);
dtend_p = icalcomponent_get_first_property(vevent, ICAL_DTEND_PROPERTY);
if (dtend_p != NULL) dtend_t = icalproperty_get_dtend(dtend_p);
/*
* Iterate through attendees.
*/
for (attendee = icalcomponent_get_first_property(vevent, ICAL_ATTENDEE_PROPERTY);
attendee != NULL;
attendee = icalcomponent_get_next_property(vevent, ICAL_ATTENDEE_PROPERTY)) {
ch = icalproperty_get_attendee(attendee);
if ((ch != NULL) && !strncasecmp(ch, "MAILTO:", 7)) {
/** screen name or email address */
safestrncpy(attendee_string, ch + 7, sizeof(attendee_string));
striplt(attendee_string);
check_individual_attendee(attendee_string,
dtstart_t, dtend_t,
annotation);
/** Replace the attendee name with an annotated one. */
snprintf(annotated_attendee_string, sizeof annotated_attendee_string,
"MAILTO:%s (%s)", attendee_string, annotation);
icalproperty_set_attendee(attendee, annotated_attendee_string);
}
}
}
webcit-dfsg.orig/openid.c 0000644 0001750 0001750 00000006533 13223341037 015430 0 ustar michael michael /*
* Copyright (c) 1996-2012 by the citadel.org team
*
* This program is open source software. You can redistribute it and/or
* modify it under the terms of the GNU General Public License, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "webcit.h"
#include "webserver.h"
/*
* Display the OpenIDs associated with an account
*/
void display_openids(void)
{
wcsession *WCC = WC;
char buf[1024];
int bg = 0;
output_headers(1, 1, 1, 0, 0, 0);
do_template("box_begin_1");
StrBufAppendBufPlain(WCC->WBuf, _("Manage Account/OpenID Associations"), -1, 0);
do_template("box_begin_2");
if (WCC->serv_info->serv_supports_openid) {
wc_printf("
\n");
wc_printf("\n", _("Attach"));
}
else {
wc_printf(_("%s does not permit authentication via OpenID."), ChrPtr(WCC->serv_info->serv_humannode));
}
do_template("box_end");
wDumpContent(2);
}
/*
* Attempt to attach an OpenID to an existing, logged-in account
*/
void openid_attach(void) {
char buf[4096];
if (havebstr("attach_button")) {
syslog(LOG_DEBUG, "Attempting to attach %s\n", bstr("openid_url"));
snprintf(buf, sizeof buf,
"OIDS %s|%s/finalize_openid_login?attach_existing=1|%s",
bstr("openid_url"),
ChrPtr(site_prefix),
ChrPtr(site_prefix)
);
serv_puts(buf);
serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
syslog(LOG_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
http_redirect(&buf[4]);
return;
}
else {
syslog(LOG_DEBUG, "OpenID attach failed: %s\n", &buf[4]);
}
}
/* If we get to this point then something failed. */
display_openids();
}
/*
* Detach an OpenID from the currently logged-in account
*/
void openid_detach(void) {
StrBuf *Line;
if (havebstr("id_to_detach")) {
serv_printf("OIDD %s", bstr("id_to_detach"));
Line = NewStrBuf();
StrBuf_ServGetln(Line);
GetServerStatusMsg(Line, NULL, 1, 2);
FreeStrBuf(&Line);
}
display_openids();
}
void
InitModule_OPENID
(void)
{
WebcitAddUrlHandler(HKEY("display_openids"), "", 0, display_openids, 0);
WebcitAddUrlHandler(HKEY("openid_attach"), "", 0, openid_attach, 0);
WebcitAddUrlHandler(HKEY("openid_detach"), "", 0, openid_detach, 0);
}
webcit-dfsg.orig/configure 0000755 0001750 0001750 00000632512 13223341054 015716 0 ustar michael michael #! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for WebCit 917.
#
# Report bugs to .
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
&& (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='print -r --'
as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='printf %s\n'
as_echo_n='printf %s'
else
if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
as_echo_n='/usr/ucb/echo -n'
else
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
case $arg in #(
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
esac;
expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
'
export as_echo_n_body
as_echo_n='sh -c $as_echo_n_body as_echo'
fi
export as_echo_body
as_echo='sh -c $as_echo_body as_echo'
fi
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
PATH_SEPARATOR=';'
}
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there. '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# Use a proper internal environment variable to ensure we don't fall
# into an infinite loop, continuously re-executing ourselves.
if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
_as_can_reexec=no; export _as_can_reexec;
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
as_fn_exit 255
fi
# We don't want this to propagate to other subprocesses.
{ _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
# is contrary to our usage. Disable this feature.
alias -g '\${1+\"\$@\"}'='\"\$@\"'
setopt NO_GLOB_SUBST
else
case \`(set -o) 2>/dev/null\` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
"
as_required="as_fn_return () { (exit \$1); }
as_fn_success () { as_fn_return 0; }
as_fn_failure () { as_fn_return 1; }
as_fn_ret_success () { return 0; }
as_fn_ret_failure () { return 1; }
exitcode=0
as_fn_success || { exitcode=1; echo as_fn_success failed.; }
as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
test x\$exitcode = x0 || exit 1
test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
test \$(( 1 + 1 )) = 2 || exit 1"
if (eval "$as_required") 2>/dev/null; then :
as_have_required=yes
else
as_have_required=no
fi
if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_found=false
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
as_found=:
case $as_dir in #(
/*)
for as_base in sh bash ksh sh5; do
# Try only shells that exist, to save several forks.
as_shell=$as_dir/$as_base
if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
CONFIG_SHELL=$as_shell as_have_required=yes
if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
break 2
fi
fi
done;;
esac
as_found=false
done
$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
CONFIG_SHELL=$SHELL as_have_required=yes
fi; }
IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
export CONFIG_SHELL
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi
if test x$as_have_required = xno; then :
$as_echo "$0: This script requires a shell more modern than all"
$as_echo "$0: the shells that I found on your system."
if test x${ZSH_VERSION+set} = xset ; then
$as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
$as_echo "$0: Please tell bug-autoconf@gnu.org and
$0: http://uncensored.citadel.org about your system,
$0: including any error possibly output before this
$0: message. Then install a modern shell, or manually run
$0: the script under such a shell if you do have one."
fi
exit 1
fi
fi
fi
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL
# Unset more variables known to interfere with behavior of common tools.
CLICOLOR_FORCE= GREP_OPTIONS=
unset CLICOLOR_FORCE GREP_OPTIONS
## --------------------- ##
## M4sh Shell Functions. ##
## --------------------- ##
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else
as_fn_append ()
{
eval $1=\$$1\$2
}
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
as_status=$1; test $as_status -eq 0 && as_status=1
if test "$4"; then
as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
$as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
$as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
as_lineno_1=$LINENO as_lineno_1a=$LINENO
as_lineno_2=$LINENO as_lineno_2a=$LINENO
eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
# Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
' <$as_myself |
sed '
s/[$]LINENO.*/&-/
t lineno
b
:lineno
N
:loop
s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
# If we had to re-execute with $CONFIG_SHELL, we're ensured to have
# already done that, so ensure we don't try to do so again and fall
# in an infinite loop. This has already happened in practice.
_as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
. "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
test -n "$DJDIR" || exec 7<&0 &1
# Name of the host.
# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
#
# Initializations.
#
ac_default_prefix=/usr/local
ac_clean_files=
ac_config_libobj_dir=.
LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='WebCit'
PACKAGE_TARNAME='webcit'
PACKAGE_VERSION='917'
PACKAGE_STRING='WebCit 917'
PACKAGE_BUGREPORT='http://uncensored.citadel.org'
PACKAGE_URL=''
# Factoring default headers for most tests.
ac_includes_default="\
#include
#ifdef HAVE_SYS_TYPES_H
# include
#endif
#ifdef HAVE_SYS_STAT_H
# include
#endif
#ifdef STDC_HEADERS
# include
# include
#else
# ifdef HAVE_STDLIB_H
# include
# endif
#endif
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
# include
# endif
# include
#endif
#ifdef HAVE_STRINGS_H
# include
#endif
#ifdef HAVE_INTTYPES_H
# include
#endif
#ifdef HAVE_STDINT_H
# include
#endif
#ifdef HAVE_UNISTD_H
# include
#endif"
ac_default_prefix=/usr/local/webcit
ac_subst_vars='LTLIBOBJS
ETCDIR
MAKE_RUN_DIR
WWWDIR
LOCALEDIR
SETUP_LIBS
ok_msgfmt
ok_msgmerge
ok_xgettext
MAKE_SSL_DIR
LIBOBJS
PTHREAD_DEFS
SED
EGREP
GREP
CPP
OBJEXT
EXEEXT
ac_ct_CC
CPPFLAGS
LDFLAGS
CFLAGS
CC
ACLOCAL
AUTOCONF
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
host_os
host_vendor
host_cpu
host
build_os
build_vendor
build_cpu
build
PROG_SUBDIRS
target_alias
host_alias
build_alias
LIBS
ECHO_T
ECHO_N
ECHO_C
DEFS
mandir
localedir
libdir
psdir
pdfdir
dvidir
htmldir
infodir
docdir
oldincludedir
includedir
localstatedir
sharedstatedir
sysconfdir
datadir
datarootdir
libexecdir
sbindir
bindir
program_transform_name
prefix
exec_prefix
PACKAGE_URL
PACKAGE_BUGREPORT
PACKAGE_STRING
PACKAGE_VERSION
PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
with_ssl
enable_iconv
with_ssldir
with_gprof
with_backtrace
with_localedir
with_wwwdir
with_rundir
with_datadir
with_editordir
with_markdowneditordir
with_etcdir
'
ac_precious_vars='build_alias
host_alias
target_alias
CC
CFLAGS
LDFLAGS
LIBS
CPPFLAGS
CPP'
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
ac_unrecognized_opts=
ac_unrecognized_sep=
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datarootdir='${prefix}/share'
datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
infodir='${datarootdir}/info'
htmldir='${docdir}'
dvidir='${docdir}'
pdfdir='${docdir}'
psdir='${docdir}'
libdir='${exec_prefix}/lib'
localedir='${datarootdir}/locale'
mandir='${datarootdir}/man'
ac_prev=
ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval $ac_prev=\$ac_option
ac_prev=
continue
fi
case $ac_option in
*=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
*=) ac_optarg= ;;
*) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
case $ac_dashdash$ac_option in
--)
ac_dashdash=yes ;;
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=*)
datadir=$ac_optarg ;;
-datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
| --dataroo | --dataro | --datar)
ac_prev=datarootdir ;;
-datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
| --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
datarootdir=$ac_optarg ;;
-disable-* | --disable-*)
ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=no ;;
-docdir | --docdir | --docdi | --doc | --do)
ac_prev=docdir ;;
-docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
docdir=$ac_optarg ;;
-dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
ac_prev=dvidir ;;
-dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
dvidir=$ac_optarg ;;
-enable-* | --enable-*)
ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
-host | --host | --hos | --ho)
ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
-htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
ac_prev=htmldir ;;
-htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
| --ht=*)
htmldir=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
-localedir | --localedir | --localedi | --localed | --locale)
ac_prev=localedir ;;
-localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
localedir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst | --locals)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
-pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
ac_prev=pdfdir ;;
-pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
pdfdir=$ac_optarg ;;
-psdir | --psdir | --psdi | --psd | --ps)
ac_prev=psdir ;;
-psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
psdir=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
-with-* | --with-*)
ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=\$ac_optarg ;;
-without-* | --without-*)
ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=no ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
-*) as_fn_error $? "unrecognized option: \`$ac_option'
Try \`$0 --help' for more information"
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
case $ac_envvar in #(
'' | [0-9]* | *[!_$as_cr_alnum]* )
as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
esac
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
$as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
$as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
: "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
as_fn_error $? "missing argument to $ac_option"
fi
if test -n "$ac_unrecognized_opts"; then
case $enable_option_checking in
no) ;;
fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
*) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
fi
# Check all directory arguments for consistency.
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
case $ac_val in
*/ )
ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
eval $ac_var=\$ac_val;;
esac
# Be sure to have absolute directory names.
case $ac_val in
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: To remove some day.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
fi
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
as_fn_error $? "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
as_fn_error $? "pwd does not report name of working directory"
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then the parent directory.
ac_confdir=`$as_dirname -- "$as_myself" ||
$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_myself" : 'X\(//\)[^/]' \| \
X"$as_myself" : 'X\(//\)$' \| \
X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_myself" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
srcdir=.
fi
# Remove unnecessary trailing slashes from srcdir.
# Double slashes in file names in object file debugging info
# mess up M-x gdb in Emacs.
case $srcdir in
*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
esac
for ac_var in $ac_precious_vars; do
eval ac_env_${ac_var}_set=\${${ac_var}+set}
eval ac_env_${ac_var}_value=\$${ac_var}
eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
eval ac_cv_env_${ac_var}_value=\$${ac_var}
done
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures WebCit 917 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print \`checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/webcit]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
_ACEOF
fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of WebCit 917:";;
esac
cat <<\_ACEOF
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-iconv do not use iconv charset conversion
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-ssl=PATH Specify path to OpenSSL installation
--with-ssldir directory to store the ssl certificates under
--with-gprof enable profiling
--with-backtrace enable backtrace dumps in the syslog
--with-localedir directory to put the locale files to
--with-wwwdir directory to put our templates
--with-rundir directory to place runtime files (UDS) to?
--with-datadir directory to store the databases under
--with-editordir directory to put our editor
--with-markdowneditordir directory to put our markdown editor
--with-etcdir directory to read our configs
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
LIBS libraries to pass to the linker, e.g. -l
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if
you have headers in a nonstandard directory
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to .
_ACEOF
ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
test -d "$ac_dir" ||
{ cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
continue
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
cd "$ac_dir" || { ac_status=$?; continue; }
# Check for guested configure.
if test -f "$ac_srcdir/configure.gnu"; then
echo &&
$SHELL "$ac_srcdir/configure.gnu" --help=recursive
elif test -f "$ac_srcdir/configure"; then
echo &&
$SHELL "$ac_srcdir/configure" --help=recursive
else
$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi || ac_status=$?
cd "$ac_pwd" || { ac_status=$?; break; }
done
fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
WebCit configure 917
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
exit
fi
## ------------------------ ##
## Autoconf initialization. ##
## ------------------------ ##
# ac_fn_c_try_compile LINENO
# --------------------------
# Try to compile conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext
if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_compile
# ac_fn_c_try_cpp LINENO
# ----------------------
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_cpp ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } > conftest.i && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_cpp
# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists, giving a warning if it cannot be compiled using
# the include files in INCLUDES and setting the cache variable VAR
# accordingly.
ac_fn_c_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if eval \${$3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
else
# Is the header compilable?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
$as_echo_n "checking $2 usability... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_header_compiler=yes
else
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }
# Is the header present?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
$as_echo_n "checking $2 presence... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <$2>
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
ac_header_preproc=yes
else
ac_header_preproc=no
fi
rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
yes:no: )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
;;
no:yes:* )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
( $as_echo "## -------------------------------------------- ##
## Report this to http://uncensored.citadel.org ##
## -------------------------------------------- ##"
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=\$ac_header_compiler"
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_mongrel
# ac_fn_c_try_run LINENO
# ----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
# that executables *can* be run.
ac_fn_c_try_run ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then :
ac_retval=0
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_run
# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists and can be compiled using the include files in
# INCLUDES, setting the cache variable VAR accordingly.
ac_fn_c_check_header_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_compile
# ac_fn_c_try_link LINENO
# -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_link ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext conftest$ac_exeext
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
test -x conftest$ac_exeext
}; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_link
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
ac_fn_c_check_func ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Define $2 to an innocuous variant, in case declares $2.
For example, HP-UX 11i declares gettimeofday. */
#define $2 innocuous_$2
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $2 (); below.
Prefer to if __STDC__ is defined, since
exists even on freestanding compilers. */
#ifdef __STDC__
# include
#else
# include
#endif
#undef $2
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $2 ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$2 || defined __stub___$2
choke me
#endif
int
main ()
{
return $2 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
# -------------------------------------------
# Tests whether TYPE exists after having included INCLUDES, setting cache
# variable VAR accordingly.
ac_fn_c_check_type ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=no"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
if (sizeof ($2))
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
if (sizeof (($2)))
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
eval "$3=yes"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
# --------------------------------------------
# Tries to find the compile-time value of EXPR in a program that includes
# INCLUDES, setting VAR accordingly. Returns whether the value could be
# computed
ac_fn_c_compute_int ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if test "$cross_compiling" = yes; then
# Depending upon the size, compute the lo and hi bounds.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) >= 0)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_lo=0 ac_mid=0
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_hi=$ac_mid; break
else
as_fn_arith $ac_mid + 1 && ac_lo=$as_val
if test $ac_lo -le $ac_mid; then
ac_lo= ac_hi=
break
fi
as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) < 0)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_hi=-1 ac_mid=-1
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) >= $ac_mid)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_lo=$ac_mid; break
else
as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
if test $ac_mid -le $ac_hi; then
ac_lo= ac_hi=
break
fi
as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
ac_lo= ac_hi=
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do
as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_hi=$ac_mid
else
as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in #((
?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
'') ac_retval=1 ;;
esac
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
static long int longval () { return $2; }
static unsigned long int ulongval () { return $2; }
#include
#include
int
main ()
{
FILE *f = fopen ("conftest.val", "w");
if (! f)
return 1;
if (($2) < 0)
{
long int i = longval ();
if (i != ($2))
return 1;
fprintf (f, "%ld", i);
}
else
{
unsigned long int i = ulongval ();
if (i != ($2))
return 1;
fprintf (f, "%lu", i);
}
/* Do not output a trailing newline, as this causes \r\n confusion
on some platforms. */
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
echo >>conftest.val; read $3 config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by WebCit $as_me 917, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
_ACEOF
exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##
hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
_ASUNAME
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
$as_echo "PATH: $as_dir"
done
IFS=$as_save_IFS
} >&5
cat >&5 <<_ACEOF
## ----------- ##
## Core tests. ##
## ----------- ##
_ACEOF
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
ac_must_keep_next=false
for ac_pass in 1 2
do
for ac_arg
do
case $ac_arg in
-no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*\'*)
ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
2)
as_fn_append ac_configure_args1 " '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
fi
as_fn_append ac_configure_args " '$ac_arg'"
;;
esac
done
done
{ ac_configure_args0=; unset ac_configure_args0;}
{ ac_configure_args1=; unset ac_configure_args1;}
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
# WARNING: Use '\'' to represent an apostrophe within the trap.
# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
echo
$as_echo "## ---------------- ##
## Cache variables. ##
## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
(
for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
*) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
sed -n \
"s/'\''/'\''\\\\'\'''\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
;; #(
*)
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
)
echo
$as_echo "## ----------------- ##
## Output variables. ##
## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
$as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
$as_echo "## ------------------- ##
## File substitutions. ##
## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
$as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
$as_echo "## ----------- ##
## confdefs.h. ##
## ----------- ##"
echo
cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
$as_echo "$as_me: caught signal $ac_signal"
$as_echo "$as_me: exit $exit_status"
} >&5
rm -f core *.core core.conftest.* &&
rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h
$as_echo "/* confdefs.h */" > confdefs.h
# Predefined preprocessor variables.
cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_URL "$PACKAGE_URL"
_ACEOF
# Let the site file select an alternate cache file if it wants to.
# Prefer an explicitly selected file to automatically selected ones.
ac_site_file1=NONE
ac_site_file2=NONE
if test -n "$CONFIG_SITE"; then
# We do not want a PATH search for config.site.
case $CONFIG_SITE in #((
-*) ac_site_file1=./$CONFIG_SITE;;
*/*) ac_site_file1=$CONFIG_SITE;;
*) ac_site_file1=./$CONFIG_SITE;;
esac
elif test "x$prefix" != xNONE; then
ac_site_file1=$prefix/share/config.site
ac_site_file2=$prefix/etc/config.site
else
ac_site_file1=$ac_default_prefix/share/config.site
ac_site_file2=$ac_default_prefix/etc/config.site
fi
for ac_site_file in "$ac_site_file1" "$ac_site_file2"
do
test "x$ac_site_file" = xNONE && continue
if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file" \
|| { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "failed to load site script $ac_site_file
See \`config.log' for more details" "$LINENO" 5; }
fi
done
if test -r "$cache_file"; then
# Some versions of bash will fail to source /dev/null (special files
# actually), so we avoid doing that. DJGPP emulates it as a regular file.
if test /dev/null != "$cache_file" && test -f "$cache_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
$as_echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . "$cache_file";;
*) . "./$cache_file";;
esac
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
$as_echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
for ac_var in $ac_precious_vars; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val=\$ac_cv_env_${ac_var}_value
eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
# differences in whitespace do not lead to failure.
ac_old_val_w=`echo x $ac_old_val`
ac_new_val_w=`echo x $ac_new_val`
if test "$ac_old_val_w" != "$ac_new_val_w"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
ac_cache_corrupted=:
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
eval $ac_var=\$ac_old_val
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
*\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
*) as_fn_append ac_configure_args " '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
fi
## -------------------- ##
## Main body of script. ##
## -------------------- ##
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
$as_echo "#define PROG_SUBDIRS /**/" >>confdefs.h
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
# and are intended to be withdrawn in a future Autoconf release.
# They can cause serious problems if a builder's source tree is in a directory
# whose full name contains unusual characters.
ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
$as_echo_n "checking build system type... " >&6; }
if ${ac_cv_build+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
test "x$ac_build_alias" = x &&
as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
$as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_build
shift
build_cpu=$1
build_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
build_os=$*
IFS=$ac_save_IFS
case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
$as_echo_n "checking host system type... " >&6; }
if ${ac_cv_host+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "x$host_alias" = x; then
ac_cv_host=$ac_cv_build
else
ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
$as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_host
shift
host_cpu=$1
host_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
host_os=$*
IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AmigaOS /C/install, which installs bootblocks on floppy discs
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
# Reject install programs that cannot install multiple files.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
$as_echo_n "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
if ${ac_cv_path_install+:} false; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
# Account for people who put trailing slashes in PATH elements.
case $as_dir/ in #((
./ | .// | /[cC]/* | \
/etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
# Don't use installbsd from OSF since it installs stuff as root
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
elif test $ac_prog = install &&
grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# program-specific install script used by HP pwplus--don't use.
:
else
rm -rf conftest.one conftest.two conftest.dir
echo one > conftest.one
echo two > conftest.two
mkdir conftest.dir
if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
test -s conftest.one && test -s conftest.two &&
test -s conftest.dir/conftest.one &&
test -s conftest.dir/conftest.two
then
ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
break 3
fi
fi
fi
done
done
;;
esac
done
IFS=$as_save_IFS
rm -rf conftest.one conftest.two conftest.dir
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
else
# As a last resort, use the slow shell script. Don't cache a
# value for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
INSTALL=$ac_install_sh
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
$as_echo "$INSTALL" >&6; }
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
missing_dir=`cd $ac_aux_dir && pwd`
# Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd "$ac_aux_dir" && pwd`
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
*)
MISSING="\${SHELL} $am_aux_dir/missing" ;;
esac
fi
# Use eval to expand $SHELL
if eval "$MISSING --is-lightweight"; then
am_missing_run="$MISSING "
else
am_missing_run=
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
fi
AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal"}
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=no
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_CC" && break
done
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
fi
fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "no acceptable C compiler found in \$PATH
See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
{ { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
$as_echo_n "checking whether the C compiler works... " >&6; }
ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
# The possible output files:
ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
ac_rmfiles=
for ac_file in $ac_files
do
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
* ) ac_rmfiles="$ac_rmfiles $ac_file";;
esac
done
rm -f $ac_rmfiles
if { { ac_try="$ac_link_default"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link_default") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
# Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
# in a Makefile. We should not override ac_cv_exeext if it was cached,
# so that the user can short-circuit this test for compilers unknown to
# Autoconf.
for ac_file in $ac_files ''
do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
then :; else
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
fi
# We set ac_cv_exeext here because the later test for it is not
# safe: cross compilers may not add the suffix if given an `-o'
# argument, so we may need to know it at that point already.
# Even if this section looks crufty: it has the advantage of
# actually working.
break;;
* )
break;;
esac
done
test "$ac_cv_exeext" = no && ac_cv_exeext=
else
ac_file=''
fi
if test -z "$ac_file"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "C compiler cannot create executables
See \`config.log' for more details" "$LINENO" 5; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
$as_echo_n "checking for C compiler default output file name... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
$as_echo "$ac_file" >&6; }
ac_exeext=$ac_cv_exeext
rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
$as_echo_n "checking for suffix of executables... " >&6; }
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
# If both `conftest.exe' and `conftest' are `present' (well, observable)
# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
# work properly (i.e., refer to `conftest.exe'), while it won't with
# `rm'.
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
break;;
* ) break;;
esac
done
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
$as_echo "$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
FILE *f = fopen ("conftest.out", "w");
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
ac_clean_files="$ac_clean_files conftest.out"
# Check that the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
$as_echo_n "checking whether we are cross compiling... " >&6; }
if test "$cross_compiling" != yes; then
{ { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
if { ac_try='./conftest$ac_cv_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then
cross_compiling=no
else
if test "$cross_compiling" = maybe; then
cross_compiling=yes
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details" "$LINENO" 5; }
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
$as_echo "$cross_compiling" >&6; }
rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
if ${ac_cv_objext+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.o conftest.obj
if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
for ac_file in conftest.o conftest.obj conftest.*; do
test -f "$ac_file" || continue;
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of object files: cannot compile
See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
$as_echo "$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
$as_echo "$ac_cv_c_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GCC=yes
else
GCC=
fi
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
if ${ac_cv_prog_cc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
ac_cv_prog_cc_g=no
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
else
CFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
$as_echo "$ac_cv_prog_cc_g" >&6; }
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
as 'x'. The following induces an error, until -std is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
that's true only with -std. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
inside strings and character constants. */
#define FOO(x) 'x'
int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
_ACEOF
for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_c89=$ac_arg
fi
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC
fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
x)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
$as_echo "none needed" >&6; } ;;
xno)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
$as_echo "unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c89"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
esac
if test "x$ac_cv_prog_cc_c89" != xno; then :
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
$as_echo_n "checking how to run the C preprocessor... " >&6; }
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
if ${ac_cv_prog_CPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
do
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
else
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
else
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
done
ac_cv_prog_CPP=$CPP
fi
CPP=$ac_cv_prog_CPP
else
ac_cv_prog_CPP=$CPP
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
$as_echo "$CPP" >&6; }
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
else
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
else
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details" "$LINENO" 5; }
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
if ${ac_cv_path_GREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$GREP"; then
ac_path_GREP_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
*GNU*)
ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo 'GREP' >> "conftest.nl"
"$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_GREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_GREP="$ac_path_GREP"
ac_path_GREP_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_GREP_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_GREP"; then
as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_GREP=$GREP
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
$as_echo "$ac_cv_path_GREP" >&6; }
GREP="$ac_cv_path_GREP"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
if ${ac_cv_path_EGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
then ac_cv_path_EGREP="$GREP -E"
else
if test -z "$EGREP"; then
ac_path_EGREP_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
*GNU*)
ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo 'EGREP' >> "conftest.nl"
"$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_EGREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_EGREP="$ac_path_EGREP"
ac_path_EGREP_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_EGREP_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_EGREP"; then
as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_EGREP=$EGREP
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
$as_echo "$ac_cv_path_EGREP" >&6; }
EGREP="$ac_cv_path_EGREP"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#include
#include
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_header_stdc=yes
else
ac_cv_header_stdc=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "memchr" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "free" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then :
:
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
return 2;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
else
ac_cv_header_stdc=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
$as_echo "$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
$as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
# On IRIX 5.3, sys/types and inttypes.h are conflicting.
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
inttypes.h stdint.h unistd.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
if test "x$ac_cv_header_minix_config_h" = xyes; then :
MINIX=yes
else
MINIX=
fi
if test "$MINIX" = yes; then
$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
$as_echo "#define _MINIX 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
if ${ac_cv_safe_to_define___extensions__+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
# define __EXTENSIONS__ 1
$ac_includes_default
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_safe_to_define___extensions__=yes
else
ac_cv_safe_to_define___extensions__=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
test $ac_cv_safe_to_define___extensions__ = yes &&
$as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
$as_echo "#define _ALL_SOURCE 1" >>confdefs.h
$as_echo "#define _GNU_SOURCE 1" >>confdefs.h
$as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
$as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
# Extract the first word of "sed", so it can be a program name with args.
set dummy sed; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_SED+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$SED"; then
ac_cv_prog_SED="$SED" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_SED="sed"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_prog_SED" && ac_cv_prog_SED="no"
fi
fi
SED=$ac_cv_prog_SED
if test -n "$SED"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5
$as_echo "$SED" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "$prefix" = NONE; then
cat >>confdefs.h <<_ACEOF
#define WEBCITDIR "$ac_default_prefix"
_ACEOF
ssl_dir="$ac_default_prefix/keys"
else
cat >>confdefs.h <<_ACEOF
#define WEBCITDIR "$prefix"
_ACEOF
ssl_dir="$prefix/keys"
fi
# Check whether --with-ssl was given.
if test "${with_ssl+set}" = set; then :
withval=$with_ssl;
if test "x$withval" != "xno" ; then
tryssldir=$withval
fi
fi
PTHREAD_DEFS=-D_REENTRANT
case "$host" in
alpha*-dec-osf*)
test -z "$CC" && CC=cc
LIBS=-pthread
;;
*-*-freebsd*)
LIBS=-pthread
PTHREAD_DEFS=-D_THREAD_SAFE
;;
*-*-solaris*)
PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
;;
*-*-darwin*)
LIBS=-lintl
esac
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=no
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_CC" && break
done
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
fi
fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "no acceptable C compiler found in \$PATH
See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
{ { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
$as_echo "$ac_cv_c_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GCC=yes
else
GCC=
fi
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
if ${ac_cv_prog_cc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
ac_cv_prog_cc_g=no
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
else
CFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
$as_echo "$ac_cv_prog_cc_g" >&6; }
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
as 'x'. The following induces an error, until -std is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
that's true only with -std. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
inside strings and character constants. */
#define FOO(x) 'x'
int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
_ACEOF
for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_c89=$ac_arg
fi
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC
fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
x)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
$as_echo "none needed" >&6; } ;;
xno)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
$as_echo "unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c89"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
esac
if test "x$ac_cv_prog_cc_c89" != xno; then :
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "$GCC" = yes; then
case "$host" in
*-*-solaris*)
CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
;;
*)
CFLAGS="$CFLAGS -Wall"
;;
esac
fi
# missing_dir=`cd $ac_aux_dir && pwd`
# AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
if test "$LIBS" != -pthread; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
if ${ac_cv_lib_pthread_pthread_create+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpthread $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char pthread_create ();
int
main ()
{
return pthread_create ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_pthread_pthread_create=yes
else
ac_cv_lib_pthread_pthread_create=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBPTHREAD 1
_ACEOF
LIBS="-lpthread $LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreads" >&5
$as_echo_n "checking for pthread_create in -lpthreads... " >&6; }
if ${ac_cv_lib_pthreads_pthread_create+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpthreads $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char pthread_create ();
int
main ()
{
return pthread_create ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_pthreads_pthread_create=yes
else
ac_cv_lib_pthreads_pthread_create=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreads_pthread_create" >&5
$as_echo "$ac_cv_lib_pthreads_pthread_create" >&6; }
if test "x$ac_cv_lib_pthreads_pthread_create" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBPTHREADS 1
_ACEOF
LIBS="-lpthreads $LIBS"
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5
$as_echo_n "checking for library containing gethostbyname... " >&6; }
if ${ac_cv_search_gethostbyname+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char gethostbyname ();
int
main ()
{
return gethostbyname ();
;
return 0;
}
_ACEOF
for ac_lib in '' nsl; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_gethostbyname=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_gethostbyname+:} false; then :
break
fi
done
if ${ac_cv_search_gethostbyname+:} false; then :
else
ac_cv_search_gethostbyname=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5
$as_echo "$ac_cv_search_gethostbyname" >&6; }
ac_res=$ac_cv_search_gethostbyname
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing connect" >&5
$as_echo_n "checking for library containing connect... " >&6; }
if ${ac_cv_search_connect+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char connect ();
int
main ()
{
return connect ();
;
return 0;
}
_ACEOF
for ac_lib in '' socket; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_connect=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_connect+:} false; then :
break
fi
done
if ${ac_cv_search_connect+:} false; then :
else
ac_cv_search_connect=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_connect" >&5
$as_echo "$ac_cv_search_connect" >&6; }
ac_res=$ac_cv_search_connect
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#include
#include
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_header_stdc=yes
else
ac_cv_header_stdc=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "memchr" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "free" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then :
:
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
return 2;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
else
ac_cv_header_stdc=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
$as_echo "$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
$as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
for ac_func in crypt gethostbyname connect flock getpwnam_r getpwuid_r getloadavg
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for call semantics from getpwuid_r" >&5
$as_echo_n "checking for call semantics from getpwuid_r... " >&6; }
if ${ac_cv_call_getpwuid_r+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
struct passwd pw, *pwp;
char pwbuf[64];
uid_t uid;
getpwuid_r(uid, &pw, pwbuf, sizeof(pwbuf), &pwp);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_call_getpwuid_r=yes
else
ac_cv_call_getpwuid_r=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_call_getpwuid_r" >&5
$as_echo "$ac_cv_call_getpwuid_r" >&6; }
if test $ac_cv_call_getpwuid_r = no; then
$as_echo "#define SOLARIS_GETPWUID /**/" >>confdefs.h
$as_echo "#define SOLARIS_LOCALTIME_R /**/" >>confdefs.h
$as_echo "#define F_UID_T \"%ld\"" >>confdefs.h
$as_echo "#define F_PID_T \"%ld\"" >>confdefs.h
$as_echo "#define F_XPID_T \"%lx\"" >>confdefs.h
else
$as_echo "#define F_UID_T \"%d\"" >>confdefs.h
$as_echo "#define F_PID_T \"%d\"" >>confdefs.h
$as_echo "#define F_XPID_T \"%x\"" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
if ${ac_cv_c_const+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __cplusplus
/* Ultrix mips cc rejects this sort of thing. */
typedef int charset[2];
const charset cs = { 0, 0 };
/* SunOS 4.1.1 cc rejects this. */
char const *const *pcpcc;
char **ppc;
/* NEC SVR4.0.2 mips cc rejects this. */
struct point {int x, y;};
static struct point const zero = {0,0};
/* AIX XL C 1.02.0.0 rejects this.
It does not let you subtract one const X* pointer from another in
an arm of an if-expression whose if-part is not a constant
expression */
const char *g = "string";
pcpcc = &g + (g ? g-g : 0);
/* HPUX 7.0 cc rejects these. */
++pcpcc;
ppc = (char**) pcpcc;
pcpcc = (char const *const *) ppc;
{ /* SCO 3.2v4 cc rejects this sort of thing. */
char tx;
char *t = &tx;
char const *s = 0 ? (char *) 0 : (char const *) 0;
*t++ = 0;
if (s) return 0;
}
{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
int x[] = {25, 17};
const int *foo = &x[0];
++foo;
}
{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
typedef const int *iptr;
iptr p = 0;
++p;
}
{ /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
"k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
struct s { int j; const int *ap[3]; } bx;
struct s *b = &bx; b->j = 5;
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
const int foo = 10;
if (!foo) return 0;
}
return !cs[0] && !zero.x;
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_c_const=yes
else
ac_cv_c_const=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
$as_echo "$ac_cv_c_const" >&6; }
if test $ac_cv_c_const = no; then
$as_echo "#define const /**/" >>confdefs.h
fi
ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
if test "x$ac_cv_type_off_t" = xyes; then :
else
cat >>confdefs.h <<_ACEOF
#define off_t long int
_ACEOF
fi
ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
if test "x$ac_cv_type_size_t" = xyes; then :
else
cat >>confdefs.h <<_ACEOF
#define size_t unsigned int
_ACEOF
fi
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char" >&5
$as_echo_n "checking size of char... " >&6; }
if ${ac_cv_sizeof_char+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char))" "ac_cv_sizeof_char" "$ac_includes_default"; then :
else
if test "$ac_cv_type_char" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (char)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_char=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char" >&5
$as_echo "$ac_cv_sizeof_char" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_CHAR $ac_cv_sizeof_char
_ACEOF
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
$as_echo_n "checking size of short... " >&6; }
if ${ac_cv_sizeof_short+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then :
else
if test "$ac_cv_type_short" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (short)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_short=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
$as_echo "$ac_cv_sizeof_short" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_SHORT $ac_cv_sizeof_short
_ACEOF
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
$as_echo_n "checking size of int... " >&6; }
if ${ac_cv_sizeof_int+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then :
else
if test "$ac_cv_type_int" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (int)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_int=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
$as_echo "$ac_cv_sizeof_int" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_INT $ac_cv_sizeof_int
_ACEOF
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
$as_echo_n "checking size of long... " >&6; }
if ${ac_cv_sizeof_long+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
else
if test "$ac_cv_type_long" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (long)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_long=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
$as_echo "$ac_cv_sizeof_long" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_LONG $ac_cv_sizeof_long
_ACEOF
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long unsigned int" >&5
$as_echo_n "checking size of long unsigned int... " >&6; }
if ${ac_cv_sizeof_long_unsigned_int+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long unsigned int))" "ac_cv_sizeof_long_unsigned_int" "$ac_includes_default"; then :
else
if test "$ac_cv_type_long_unsigned_int" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (long unsigned int)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_long_unsigned_int=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_unsigned_int" >&5
$as_echo "$ac_cv_sizeof_long_unsigned_int" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_LONG_UNSIGNED_INT $ac_cv_sizeof_long_unsigned_int
_ACEOF
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5
$as_echo_n "checking size of size_t... " >&6; }
if ${ac_cv_sizeof_size_t+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then :
else
if test "$ac_cv_type_size_t" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (size_t)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_size_t=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5
$as_echo "$ac_cv_sizeof_size_t" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t
_ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
$as_echo_n "checking return type of signal handlers... " >&6; }
if ${ac_cv_type_signal+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
return *(signal (0, 0)) (0) == 1;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_type_signal=int
else
ac_cv_type_signal=void
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
$as_echo "$ac_cv_type_signal" >&6; }
cat >>confdefs.h <<_ACEOF
#define RETSIGTYPE $ac_cv_type_signal
_ACEOF
ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf"
if test "x$ac_cv_func_snprintf" = xyes; then :
$as_echo "#define HAVE_SNPRINTF 1" >>confdefs.h
else
case " $LIBOBJS " in
*" snprintf.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS snprintf.$ac_objext"
;;
esac
fi
ac_fn_c_check_header_mongrel "$LINENO" "CUnit/CUnit.h" "ac_cv_header_CUnit_CUnit_h" "$ac_includes_default"
if test "x$ac_cv_header_CUnit_CUnit_h" = xyes; then :
$as_echo "#define ENABLE_TESTS /**/" >>confdefs.h
fi
for ac_header in fcntl.h limits.h unistd.h iconv.h xlocale.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $SERVER_LIBS"
ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
if test "x$ac_cv_header_zlib_h" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlibVersion in -lz" >&5
$as_echo_n "checking for zlibVersion in -lz... " >&6; }
if ${ac_cv_lib_z_zlibVersion+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lz $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char zlibVersion ();
int
main ()
{
return zlibVersion ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_z_zlibVersion=yes
else
ac_cv_lib_z_zlibVersion=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_zlibVersion" >&5
$as_echo "$ac_cv_lib_z_zlibVersion" >&6; }
if test "x$ac_cv_lib_z_zlibVersion" = xyes; then :
LIBS="-lz $LIBS $SERVER_LIBS"
else
as_fn_error $? "zlib was not found or is not usable. Please install zlib." "$LINENO" 5
fi
else
as_fn_error $? "zlib.h was not found or is not usable. Please install zlib." "$LINENO" 5
fi
CFLAGS="$saved_CFLAGS"
# Check whether --enable-iconv was given.
if test "${enable_iconv+set}" = set; then :
enableval=$enable_iconv; ok_iconv=no
else
ok_iconv=yes
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking to see if your system supports iconv" >&5
$as_echo_n "checking Checking to see if your system supports iconv... " >&6; }
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
main() {
iconv_t ic = (iconv_t)(-1) ;
ic = iconv_open("UTF-8", "us-ascii");
iconv_close(ic);
exit(0);
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
ok_iconv=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
ok_iconv=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
if test "$ok_iconv" = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking for an external libiconv" >&5
$as_echo_n "checking Checking for an external libiconv... " >&6; }
OLD_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -liconv"
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
main() {
iconv_t ic = (iconv_t)(-1) ;
ic = iconv_open("UTF-8", "us-ascii");
iconv_close(ic);
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
ok_iconv=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
ok_iconv=no
LDFLAGS="$OLD_LDFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
if test "$ok_iconv" != "no"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: webcit will be built with character set conversion." >&5
$as_echo "webcit will be built with character set conversion." >&6; }
$as_echo "#define HAVE_ICONV /**/" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: webcit will be built without character set conversion." >&5
$as_echo "webcit will be built without character set conversion." >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libintl_bindtextdomain in -lintl" >&5
$as_echo_n "checking for libintl_bindtextdomain in -lintl... " >&6; }
if ${ac_cv_lib_intl_libintl_bindtextdomain+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lintl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char libintl_bindtextdomain ();
int
main ()
{
return libintl_bindtextdomain ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_intl_libintl_bindtextdomain=yes
else
ac_cv_lib_intl_libintl_bindtextdomain=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_libintl_bindtextdomain" >&5
$as_echo "$ac_cv_lib_intl_libintl_bindtextdomain" >&6; }
if test "x$ac_cv_lib_intl_libintl_bindtextdomain" = xyes; then :
LDFLAGS="$LDFLAGS -lintl"
fi
ac_fn_c_check_header_mongrel "$LINENO" "libical/ical.h" "ac_cv_header_libical_ical_h" "$ac_includes_default"
if test "x$ac_cv_header_libical_ical_h" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for icaltimezone_set_tzid_prefix in -lical" >&5
$as_echo_n "checking for icaltimezone_set_tzid_prefix in -lical... " >&6; }
if ${ac_cv_lib_ical_icaltimezone_set_tzid_prefix+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lical $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char icaltimezone_set_tzid_prefix ();
int
main ()
{
return icaltimezone_set_tzid_prefix ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_ical_icaltimezone_set_tzid_prefix=yes
else
ac_cv_lib_ical_icaltimezone_set_tzid_prefix=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ical_icaltimezone_set_tzid_prefix" >&5
$as_echo "$ac_cv_lib_ical_icaltimezone_set_tzid_prefix" >&6; }
if test "x$ac_cv_lib_ical_icaltimezone_set_tzid_prefix" = xyes; then :
LIBS="-lical $LIBS"
else
as_fn_error $? "libical was not found and is required. More info: http://www.citadel.org/doku.php/installation:start" "$LINENO" 5
fi
else
as_fn_error $? "libical/ical.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for markdown in -lmarkdown" >&5
$as_echo_n "checking for markdown in -lmarkdown... " >&6; }
if ${ac_cv_lib_markdown_markdown+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lmarkdown $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char markdown ();
int
main ()
{
return markdown ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_markdown_markdown=yes
else
ac_cv_lib_markdown_markdown=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_markdown_markdown" >&5
$as_echo "$ac_cv_lib_markdown_markdown" >&6; }
if test "x$ac_cv_lib_markdown_markdown" = xyes; then :
LIBS="$LIBS -lmarkdown"
$as_echo "#define HAVE_MARKDOWN /**/" >>confdefs.h
fi
ac_fn_c_check_header_mongrel "$LINENO" "libcitadel.h" "ac_cv_header_libcitadel_h" "$ac_includes_default"
if test "x$ac_cv_header_libcitadel_h" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcitadel_version_string in -lcitadel" >&5
$as_echo_n "checking for libcitadel_version_string in -lcitadel... " >&6; }
if ${ac_cv_lib_citadel_libcitadel_version_string+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcitadel $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char libcitadel_version_string ();
int
main ()
{
return libcitadel_version_string ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_citadel_libcitadel_version_string=yes
else
ac_cv_lib_citadel_libcitadel_version_string=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_citadel_libcitadel_version_string" >&5
$as_echo "$ac_cv_lib_citadel_libcitadel_version_string" >&6; }
if test "x$ac_cv_lib_citadel_libcitadel_version_string" = xyes; then :
LIBS="-lcitadel $LIBS"
SETUP_LIBS="-lcitadel $SETUP_LIBS"
else
as_fn_error $? "libcitadel was not found or is not usable. Please install libcitadel." "$LINENO" 5
fi
else
as_fn_error $? "libcitadel.h was not found or is not usable. Please install libcitadel." "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether your system likes memcpy + HKEY" >&5
$as_echo_n "checking whether your system likes memcpy + HKEY... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _GNU_SOURCE
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "lib/libcitadel.h"
int
main ()
{
char foo[22];
memcpy(foo, HKEY("foo"));
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
$as_echo "#define UNDEF_MEMCPY /**/" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_fn_c_check_header_mongrel "$LINENO" "expat.h" "ac_cv_header_expat_h" "$ac_includes_default"
if test "x$ac_cv_header_expat_h" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML_ParserCreateNS in -lexpat" >&5
$as_echo_n "checking for XML_ParserCreateNS in -lexpat... " >&6; }
if ${ac_cv_lib_expat_XML_ParserCreateNS+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lexpat $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char XML_ParserCreateNS ();
int
main ()
{
return XML_ParserCreateNS ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_expat_XML_ParserCreateNS=yes
else
ac_cv_lib_expat_XML_ParserCreateNS=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_expat_XML_ParserCreateNS" >&5
$as_echo "$ac_cv_lib_expat_XML_ParserCreateNS" >&6; }
if test "x$ac_cv_lib_expat_XML_ParserCreateNS" = xyes; then :
LIBS="-lexpat $LIBS"
else
as_fn_error $? "The Expat XML parser was not found and is required. More info: http://www.citadel.org/doku.php/installation:start" "$LINENO" 5
fi
else
as_fn_error $? "expat.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start" "$LINENO" 5
fi
found_ssl=no
# The big search for OpenSSL
if test "$with_ssl" != "no"; then
saved_LIBS="$LIBS"
saved_LDFLAGS="$LDFLAGS"
saved_CFLAGS="$CFLAGS"
if test "x$prefix" != "xNONE"; then
tryssldir="$tryssldir $prefix"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL" >&5
$as_echo_n "checking for OpenSSL... " >&6; }
if ${ac_cv_openssldir+:} false; then :
$as_echo_n "(cached) " >&6
else
for ssldir in $tryssldir "" /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
CFLAGS="$saved_CFLAGS"
LDFLAGS="$saved_LDFLAGS"
LIBS="$saved_LIBS -lssl -lcrypto"
# Skip directories if they don't exist
if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
continue;
fi
if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
# Try to use $ssldir/lib if it exists, otherwise
# $ssldir
if test -d "$ssldir/lib" ; then
LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
if test ! -z "$need_dash_r" ; then
LDFLAGS="-R$ssldir/lib $LDFLAGS"
fi
else
LDFLAGS="-L$ssldir $saved_LDFLAGS"
if test ! -z "$need_dash_r" ; then
LDFLAGS="-R$ssldir $LDFLAGS"
fi
fi
# Try to use $ssldir/include if it exists, otherwise
# $ssldir
if test -d "$ssldir/include" ; then
CFLAGS="-I$ssldir/include $saved_CFLAGS"
else
CFLAGS="-I$ssldir $saved_CFLAGS"
fi
fi
# Basic test to check for compatible version and correct linking
# *does not* test for RSA - that comes later.
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int main(void)
{
char a[2048];
memset(a, 0, sizeof(a));
RAND_add(a, sizeof(a), sizeof(a));
return(RAND_status() <= 0);
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
found_crypto=1
break;
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
if test ! -z "$found_crypto" ; then
break;
fi
done
if test -z "$ssldir" ; then
ssldir="(system)"
fi
if test ! -z "$found_crypto" ; then
ac_cv_openssldir=$ssldir
else
ac_cv_openssldir="no"
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_openssldir" >&5
$as_echo "$ac_cv_openssldir" >&6; }
LIBS="$saved_LIBS"
LDFLAGS="$saved_LDFLAGS"
CFLAGS="$saved_CFLAGS"
if test "x$ac_cv_openssldir" != "xno" ; then
$as_echo "#define HAVE_OPENSSL /**/" >>confdefs.h
found_ssl=yes
LIBS="-lssl -lcrypto $LIBS"
ssldir=$ac_cv_openssldir
if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
# Try to use $ssldir/lib if it exists, otherwise
# $ssldir
if test -d "$ssldir/lib" ; then
LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
if test ! -z "$need_dash_r" ; then
LDFLAGS="-R$ssldir/lib $LDFLAGS"
fi
else
LDFLAGS="-L$ssldir $saved_LDFLAGS"
if test ! -z "$need_dash_r" ; then
LDFLAGS="-R$ssldir $LDFLAGS"
fi
fi
# Try to use $ssldir/include if it exists, otherwise
# $ssldir
if test -d "$ssldir/include" ; then
CFLAGS="-I$ssldir/include $saved_CFLAGS"
else
CFLAGS="-I$ssldir $saved_CFLAGS"
fi
fi
fi
fi
# Check whether --with-ssldir was given.
if test "${with_ssldir+set}" = set; then :
withval=$with_ssldir; if test "x$withval" != "xno" ; then
ssl_dir="$withval"
if test "$found_ssl" = "no"; then
echo "Your setup was incomplete; ssldir doesn't make sense without openssl"
exit
fi
fi
fi
cat >>confdefs.h <<_ACEOF
#define SSL_DIR "$ssl_dir"
_ACEOF
for ac_func in strftime_l uselocale gettext
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
if test "$ok_nls" != "no"; then
# Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ok_xgettext+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ok_xgettext"; then
ac_cv_prog_ok_xgettext="$ok_xgettext" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ok_xgettext="yes"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_prog_ok_xgettext" && ac_cv_prog_ok_xgettext="no"
fi
fi
ok_xgettext=$ac_cv_prog_ok_xgettext
if test -n "$ok_xgettext"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ok_xgettext" >&5
$as_echo "$ok_xgettext" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
ok_nls=$ok_xgettext
fi
if test "$ok_nls" != "no"; then
# Extract the first word of "msgmerge", so it can be a program name with args.
set dummy msgmerge; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ok_msgmerge+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ok_msgmerge"; then
ac_cv_prog_ok_msgmerge="$ok_msgmerge" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ok_msgmerge="yes"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_prog_ok_msgmerge" && ac_cv_prog_ok_msgmerge="no"
fi
fi
ok_msgmerge=$ac_cv_prog_ok_msgmerge
if test -n "$ok_msgmerge"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ok_msgmerge" >&5
$as_echo "$ok_msgmerge" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
ok_nls=$ok_msgmerge
fi
if test "$ok_nls" != "no"; then
# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ok_msgfmt+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ok_msgfmt"; then
ac_cv_prog_ok_msgfmt="$ok_msgfmt" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ok_msgfmt="yes"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_prog_ok_msgfmt" && ac_cv_prog_ok_msgfmt="no"
fi
fi
ok_msgfmt=$ac_cv_prog_ok_msgfmt
if test -n "$ok_msgfmt"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ok_msgfmt" >&5
$as_echo "$ok_msgfmt" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
ok_nls=$ok_msgfmt
fi
if test "$ok_nls" != "no"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: WebCit will be built with national language support." >&5
$as_echo "WebCit will be built with national language support." >&6; }
$as_echo "#define ENABLE_NLS /**/" >>confdefs.h
PROG_SUBDIRS="$PROG_SUBDIRS po/webcit/"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: WebCit will be built without national language support." >&5
$as_echo "WebCit will be built without national language support." >&6; }
fi
# Check whether --with-gprof was given.
if test "${with_gprof+set}" = set; then :
withval=$with_gprof; if test "x$withval" != "xno" ; then
CFLAGS="$CFLAGS -pg "
LDFLAGS="$LDFLAGS -pg "
fi
fi
# Check whether --with-backtrace was given.
if test "${with_backtrace+set}" = set; then :
withval=$with_backtrace; if test "x$withval" != "xno" ; then
CFLAGS="$CFLAGS -rdynamic "
LDFLAGS="$LDFLAGS -rdynamic "
for ac_func in backtrace
do :
ac_fn_c_check_func "$LINENO" "backtrace" "ac_cv_func_backtrace"
if test "x$ac_cv_func_backtrace" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_BACKTRACE 1
_ACEOF
fi
done
fi
fi
if test "$prefix" = NONE; then
datadir=$ac_default_prefix
localedir=$ac_default_prefix
wwwdir=$ac_default_prefix
rundir=$ac_default_prefix
editordir=$ac_default_prefix/tiny_mce
markdowneditordir=$ac_default_prefix/epic
etcdir=$ac_default_prefix
else
localedir=$prefix
wwwdir=$prefix
datadir=$prefix
rundir=$prefix
editordir=$prefix/tiny_mce
markdowneditordir=$prefix/epic
etcdir=$prefix
fi
# Check whether --with-localedir was given.
if test "${with_localedir+set}" = set; then :
withval=$with_localedir; if test "x$withval" != "xno" ; then
localedir=$withval
fi
fi
cat >>confdefs.h <<_ACEOF
#define LOCALEDIR "$localedir"
_ACEOF
LOCALEDIR=$localedir
# Check whether --with-wwwdir was given.
if test "${with_wwwdir+set}" = set; then :
withval=$with_wwwdir; if test "x$withval" != "xno" ; then
wwwdir=$withval
fi
fi
cat >>confdefs.h <<_ACEOF
#define WWWDIR "$wwwdir"
_ACEOF
WWWDIR=$wwwdir
# Check whether --with-rundir was given.
if test "${with_rundir+set}" = set; then :
withval=$with_rundir; if test "x$withval" != "xno" ; then
$as_echo "#define HAVE_RUN_DIR /**/" >>confdefs.h
rundir=$withval
fi
fi
cat >>confdefs.h <<_ACEOF
#define RUNDIR "$rundir"
_ACEOF
# Check whether --with-datadir was given.
if test "${with_datadir+set}" = set; then :
withval=$with_datadir; if test "x$withval" != "xno" ; then
datadir=$withval
fi
fi
cat >>confdefs.h <<_ACEOF
#define DATADIR "$datadir"
_ACEOF
# Check whether --with-editordir was given.
if test "${with_editordir+set}" = set; then :
withval=$with_editordir; if test "x$withval" != "xno" ; then
editordir=$withval
fi
fi
cat >>confdefs.h <<_ACEOF
#define EDITORDIR "$editordir"
_ACEOF
# Check whether --with-markdowneditordir was given.
if test "${with_markdowneditordir+set}" = set; then :
withval=$with_markdowneditordir; if test "x$withval" != "xno" ; then
markdowneditordir=$withval
fi
fi
cat >>confdefs.h <<_ACEOF
#define MARKDOWNEDITORDIR "$markdowneditordir"
_ACEOF
# Check whether --with-etcdir was given.
if test "${with_etcdir+set}" = set; then :
withval=$with_etcdir; if test "x$withval" != "xno" ; then
etcdir=$withval
fi
fi
cat >>confdefs.h <<_ACEOF
#define ETCDIR "$etcdir"
_ACEOF
ETCDIR=$etcdir
abs_srcdir="`cd $srcdir && pwd`"
abs_builddir="`pwd`"
if test "$abs_srcdir" != "$abs_builddir"; then
CFLAGS="$CFLAGS -I $abs_builddir"
fi
ac_config_headers="$ac_config_headers sysdep.h"
ac_config_files="$ac_config_files Makefile po/webcit/Makefile tests/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
_ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(
for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
*) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space=' '; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
# `set' does not quote correctly, so add quotes: double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \.
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;; #(
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
) |
sed '
/^ac_cv_env_/b end
t clear
:clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
if test "x$cache_file" != "x/dev/null"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
$as_echo "$as_me: updating cache $cache_file" >&6;}
if test ! -f "$cache_file" || test -h "$cache_file"; then
cat confcache >"$cache_file"
else
case $cache_file in #(
*/* | ?:*)
mv -f confcache "$cache_file"$$ &&
mv -f "$cache_file"$$ "$cache_file" ;; #(
*)
mv -f confcache "$cache_file" ;;
esac
fi
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
# 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
# will be set to the directory where LIBOBJS objects are built.
as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
as_write_fail=0
cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.
debug=false
ac_cs_recheck=false
ac_cs_silent=false
SHELL=\${CONFIG_SHELL-$SHELL}
export SHELL
_ASEOF
cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
&& (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='print -r --'
as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='printf %s\n'
as_echo_n='printf %s'
else
if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
as_echo_n='/usr/ucb/echo -n'
else
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
case $arg in #(
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
esac;
expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
'
export as_echo_n_body
as_echo_n='sh -c $as_echo_n_body as_echo'
fi
export as_echo_body
as_echo='sh -c $as_echo_body as_echo'
fi
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
PATH_SEPARATOR=';'
}
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there. '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
as_status=$1; test $as_status -eq 0 && as_status=1
if test "$4"; then
as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
$as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
$as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else
as_fn_append ()
{
eval $1=\$$1\$2
}
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 6>&1
## ----------------------------------- ##
## Main body of $CONFIG_STATUS script. ##
## ----------------------------------- ##
_ASEOF
test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by WebCit $as_me 917, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
on `(hostname || uname -n) 2>/dev/null | sed 1q`
"
_ACEOF
case $ac_config_files in *"
"*) set x $ac_config_files; shift; ac_config_files=$*;;
esac
case $ac_config_headers in *"
"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
ac_cs_usage="\
\`$as_me' instantiates files and other configuration actions
from templates according to the current configuration. Unless the files
and actions are specified as TAGs, all are instantiated by default.
Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
--config print configuration, then exit
-q, --quiet, --silent
do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
Configuration files:
$config_files
Configuration headers:
$config_headers
Report bugs to ."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
WebCit config.status 917
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
ac_pwd='$ac_pwd'
srcdir='$srcdir'
INSTALL='$INSTALL'
test -n "\$AWK" || AWK=awk
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# The default lists apply if the user does not specify any file.
ac_need_defaults=:
while test $# != 0
do
case $1 in
--*=?*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
--*=)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=
ac_shift=:
;;
*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
esac
case $ac_option in
# Handling of the options.
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
$as_echo "$ac_cs_version"; exit ;;
--config | --confi | --conf | --con | --co | --c )
$as_echo "$ac_cs_config"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
'') as_fn_error $? "missing file argument" ;;
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
--header | --heade | --head | --hea )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
as_fn_append CONFIG_HEADERS " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
--help | --hel | -h )
$as_echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
-*) as_fn_error $? "unrecognized option: \`$1'
Try \`$0 --help' for more information." ;;
*) as_fn_append ac_config_targets " $1"
ac_need_defaults=false ;;
esac
shift
done
ac_configure_extra_args=
if $ac_cs_silent; then
exec 6>/dev/null
ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
export CONFIG_SHELL
exec "\$@"
fi
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
$as_echo "$ac_log"
} >&5
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Handling of arguments.
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"sysdep.h") CONFIG_HEADERS="$CONFIG_HEADERS sysdep.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"po/webcit/Makefile") CONFIG_FILES="$CONFIG_FILES po/webcit/Makefile" ;;
"tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
fi
# Have a temporary directory for convenience. Make it in the build tree
# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Hook for its removal unless debugging.
# Note that there is a small window in which the directory will not be cleaned:
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
tmp= ac_tmp=
trap 'exit_status=$?
: "${ac_tmp:=$tmp}"
{ test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
trap 'as_fn_exit 1' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
ac_tmp=$tmp
# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
# This happens for instance with `./config.status config.h'.
if test -n "$CONFIG_FILES"; then
ac_cr=`echo X | tr X '\015'`
# On cygwin, bash can eat \r inside `` if the user requested igncr.
# But we know of no other shell where ac_cr would be empty at this
# point, so we can use a bashism as a fallback.
if test "x$ac_cr" = x; then
eval ac_cr=\$\'\\r\'
fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
ac_cs_awk_cr='\\r'
else
ac_cs_awk_cr=$ac_cr
fi
echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF
{
echo "cat >conf$$subs.awk <<_ACEOF" &&
echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
echo "_ACEOF"
} >conf$$subs.sh ||
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
. ./conf$$subs.sh ||
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
if test $ac_delim_n = $ac_delim_num; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
rm -f conf$$subs.sh
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
_ACEOF
sed -n '
h
s/^/S["/; s/!.*/"]=/
p
g
s/^[^!]*!//
:repl
t repl
s/'"$ac_delim"'$//
t delim
:nl
h
s/\(.\{148\}\)..*/\1/
t more1
s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
p
n
b repl
:more1
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t nl
:delim
h
s/\(.\{148\}\)..*/\1/
t more2
s/["\\]/\\&/g; s/^/"/; s/$/"/
p
b
:more2
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t delim
' >$CONFIG_STATUS || ac_write_fail=1
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
}
{
line = $ 0
nfields = split(line, field, "@")
substed = 0
len = length(field[1])
for (i = 2; i < nfields; i++) {
key = field[i]
keylen = length(key)
if (S_is_set[key]) {
value = S[key]
line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
len += length(value) + length(field[++i])
substed = 1
} else
len += 1 + keylen
}
print line
}
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
cat
fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
|| as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
h
s///
s/^/:/
s/[ ]*$/:/
s/:\$(srcdir):/:/g
s/:\${srcdir}:/:/g
s/:@srcdir@:/:/g
s/^:*//
s/:*$//
x
s/\(=[ ]*\).*/\1/
G
s/\n//
s/^[^=]*=[ ]*$//
}'
fi
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"
# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF
# Transform confdefs.h into an awk script `defines.awk', embedded as
# here-document in config.status, that substitutes the proper values into
# config.h.in to produce config.h.
# Create a delimiter string that does not exist in confdefs.h, to ease
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
if test -z "$ac_tt"; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
# For the awk script, D is an array of macro values keyed by name,
# likewise P contains macro parameters if any. Preserve backslash
# newline sequences.
ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
sed -n '
s/.\{148\}/&'"$ac_delim"'/g
t rset
:rset
s/^[ ]*#[ ]*define[ ][ ]*/ /
t def
d
:def
s/\\$//
t bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3"/p
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
d
:bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3\\\\\\n"\\/p
t cont
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
t cont
d
:cont
n
s/.\{148\}/&'"$ac_delim"'/g
t clear
:clear
s/\\$//
t bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/"/p
d
:bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
b cont
' >$CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
for (key in D) D_is_set[key] = 1
FS = ""
}
/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
line = \$ 0
split(line, arg, " ")
if (arg[1] == "#") {
defundef = arg[2]
mac1 = arg[3]
} else {
defundef = substr(arg[1], 2)
mac1 = arg[2]
}
split(mac1, mac2, "(") #)
macro = mac2[1]
prefix = substr(line, 1, index(line, defundef) - 1)
if (D_is_set[macro]) {
# Preserve the white space surrounding the "#".
print prefix "define", macro P[macro] D[macro]
next
} else {
# Replace #undef with comments. This is necessary, for example,
# in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
if (defundef == "undef") {
print "/*", prefix defundef, macro, "*/"
next
}
}
}
{ print }
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
fi # test -n "$CONFIG_HEADERS"
eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS "
shift
for ac_tag
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
:L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
ac_save_IFS=$IFS
IFS=:
set x $ac_tag
IFS=$ac_save_IFS
shift
ac_file=$1
shift
case $ac_mode in
:L) ac_source=$1;;
:[FH])
ac_file_inputs=
for ac_f
do
case $ac_f in
-) ac_f="$ac_tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
test -f "$ac_f" ||
case $ac_f in
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
esac
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
as_fn_append ac_file_inputs " '$ac_f'"
done
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
configure_input='Generated from '`
$as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
`' by configure.'
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
$as_echo "$as_me: creating $ac_file" >&6;}
fi
# Neutralize special characters interpreted by sed in replacement strings.
case $configure_input in #(
*\&* | *\|* | *\\* )
ac_sed_conf_input=`$as_echo "$configure_input" |
sed 's/[\\\\&|]/\\\\&/g'`;; #(
*) ac_sed_conf_input=$configure_input;;
esac
case $ac_tag in
*:-:* | *:-) cat >"$ac_tmp/stdin" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
as_dir="$ac_dir"; as_fn_mkdir_p
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
case $ac_mode in
:F)
#
# CONFIG_FILE
#
case $INSTALL in
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
*) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
esac
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
ac_sed_dataroot='
/datarootdir/ {
p
q
}
/@datadir@/p
/@docdir@/p
/@infodir@/p
/@localedir@/p
/@mandir@/p'
case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_datarootdir_hack='
s&@datadir@&$datadir&g
s&@docdir@&$docdir&g
s&@infodir@&$infodir&g
s&@localedir@&$localedir&g
s&@mandir@&$mandir&g
s&\\\${datarootdir}&$datarootdir&g' ;;
esac
_ACEOF
# Neutralize VPATH when `$srcdir' = `.'.
# Shell code in configure.ac might set extrasub.
# FIXME: do we really want to maintain this feature?
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_sed_extra="$ac_vpsub
$extrasub
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s|@configure_input@|$ac_sed_conf_input|;t t
s&@top_builddir@&$ac_top_builddir_sub&;t t
s&@top_build_prefix@&$ac_top_build_prefix&;t t
s&@srcdir@&$ac_srcdir&;t t
s&@abs_srcdir@&$ac_abs_srcdir&;t t
s&@top_srcdir@&$ac_top_srcdir&;t t
s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
s&@builddir@&$ac_builddir&;t t
s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
s&@INSTALL@&$ac_INSTALL&;t t
$ac_datarootdir_hack
"
eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
>$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
{ ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
{ ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
"$ac_tmp/out"`; test -z "$ac_out"; } &&
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&5
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&2;}
rm -f "$ac_tmp/stdin"
case $ac_file in
-) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
*) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
esac \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
:H)
#
# CONFIG_HEADER
#
if test x"$ac_file" != x-; then
{
$as_echo "/* $configure_input */" \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
} >"$ac_tmp/config.h" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
$as_echo "$as_me: $ac_file is unchanged" >&6;}
else
rm -f "$ac_file"
mv "$ac_tmp/config.h" "$ac_file" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
$as_echo "/* $configure_input */" \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
|| as_fn_error $? "could not create -" "$LINENO" 5
fi
;;
esac
done # for ac_tag
as_fn_exit 0
_ACEOF
ac_clean_files=$ac_clean_files_save
test $ac_write_fail = 0 ||
as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
# Unfortunately, on DOS this fails, as config.log is still kept open
# by configure, so config.status won't be able to write to it; its
# output is simply discarded. So we exec the FD to /dev/null,
# effectively closing config.log, so it can be properly (re)opened and
# appended to by config.status. When coming back to configure, we
# need to make the FD available again.
if test "$no_create" != yes; then
ac_cs_success=:
ac_config_status_args=
test "$silent" = yes &&
ac_config_status_args="$ac_config_status_args --quiet"
exec 5>/dev/null
$SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
$ac_cs_success || as_fn_exit 1
fi
if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
if test "$abs_srcdir" != "$abs_builddir"; then
ln -s $abs_srcdir/static $abs_builddir
ln -s $abs_srcdir/tiny_mce $abs_builddir
ln -s $abs_srcdir/epic $abs_builddir
ln -s $abs_srcdir/*.h $abs_builddir
make mkdir-init
else
if test -d .svn; then
./mk_module_init.sh
fi
fi
if test -n "$srcdir"; then
export srcdir=.
fi
echo ------------------------------------------------------------------------
echo 'Character set conversion support:' $ok_iconv
echo 'National language support: ' $ok_nls
echo
webcit-dfsg.orig/webserver.c 0000644 0001750 0001750 00000024543 13223341037 016157 0 ustar michael michael /*
* Copyright (c) 1996-2018 by the citadel.org team
*
* This program is open source software. You can redistribute it and/or
* modify it under the terms of the GNU General Public License version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "webcit.h"
#include "webserver.h"
#include "modules_init.h"
extern int msock; /* master listening socket */
extern char static_icon_dir[PATH_MAX]; /* where should we find our mime icons */
int is_https = 0; /* Nonzero if I am an HTTPS service */
int follow_xff = 0; /* Follow X-Forwarded-For: header? */
int DisableGzip = 0;
char *default_landing_page = NULL;
extern pthread_mutex_t SessionListMutex;
extern pthread_key_t MyConKey;
extern void *housekeeping_loop(void);
extern int webcit_tcp_server(char *ip_addr, int port_number, int queue_len);
extern int webcit_uds_server(char *sockpath, int queue_len);
extern void graceful_shutdown_watcher(int signum);
extern void graceful_shutdown(int signum);
extern void start_daemon(char *pid_file);
extern void webcit_calc_dirs_n_files(int relh, const char *basedir, int home, char *webcitdir, char *relhome);
extern void worker_entry(void);
extern void drop_root(uid_t UID);
char socket_dir[PATH_MAX]; /* where to talk to our citadel server */
char *server_cookie = NULL; /* our Cookie connection to the client */
int http_port = PORT_NUM; /* Port to listen on */
char *ctdlhost = DEFAULT_HOST; /* Host name or IP address of Citadel server */
char *ctdlport = DEFAULT_PORT; /* Port number of Citadel server */
int setup_wizard = 0; /* should we run the setup wizard? */
char wizard_filename[PATH_MAX]; /* location of file containing the last webcit version against which we ran setup wizard */
int running_as_daemon = 0; /* should we deamonize on startup? */
/* #define DBG_PRINNT_HOOKS_AT_START */
#ifdef DBG_PRINNT_HOOKS_AT_START
extern HashList *HandlerHash;
const char foobuf[32];
const char *nix(void *vptr) {snprintf(foobuf, 32, "%0x", (long) vptr); return foobuf;}
#endif
extern int verbose;
extern int dbg_analyze_msg;
extern int dbg_backtrace_template_errors;
extern int DumpTemplateI18NStrings;
extern StrBuf *I18nDump;
void InitTemplateCache(void);
extern int LoadTemplates;
void LoadMimeBlacklist(void);
/*
* Here's where it all begins.
*/
int main(int argc, char **argv)
{
uid_t UID = -1;
size_t basesize = 2; /* how big should strbufs be on creation? */
pthread_t SessThread; /* Thread descriptor */
pthread_attr_t attr; /* Thread attributes */
int a; /* General-purpose variable */
char ip_addr[256]="*";
int relh=0;
int home=0;
char relhome[PATH_MAX]="";
char webcitdir[PATH_MAX] = DATADIR;
char *pidfile = NULL;
char *hdir;
const char *basedir = NULL;
char uds_listen_path[PATH_MAX]; /* listen on a unix domain socket? */
const char *I18nDumpFile = NULL;
WildFireInitBacktrace(argv[0], 2);
start_modules();
#ifdef DBG_PRINNT_HOOKS_AT_START
/* dbg_PrintHash(HandlerHash, nix, NULL);*/
#endif
/* Ensure that we are linked to the correct version of libcitadel */
if (libcitadel_version_number() < LIBCITADEL_VERSION_NUMBER) {
fprintf(stderr, " You are running libcitadel version %d\n", libcitadel_version_number() );
fprintf(stderr, "WebCit was compiled against version %d\n", LIBCITADEL_VERSION_NUMBER );
return(1);
}
strcpy(uds_listen_path, "");
/* Parse command line */
#ifdef HAVE_OPENSSL
while ((a = getopt(argc, argv, "u:h:i:p:t:T:B:x:g:dD:G:cfsS:Z:v:")) != EOF)
#else
while ((a = getopt(argc, argv, "u:h:i:p:t:T:B:x:g:dD:G:cfZ:v:")) != EOF)
#endif
switch (a) {
case 'u':
UID = atol(optarg);
break;
case 'h':
hdir = strdup(optarg);
relh=hdir[0]!='/';
if (!relh) {
safestrncpy(webcitdir, hdir, sizeof webcitdir);
}
else {
safestrncpy(relhome, relhome, sizeof relhome);
}
/* free(hdir); TODO: SHOULD WE DO THIS? */
home=1;
break;
case 'd':
running_as_daemon = 1;
break;
case 'D':
pidfile = strdup(optarg);
running_as_daemon = 1;
break;
case 'g':
default_landing_page = strdup(optarg);
break;
case 'B': /* Basesize */
basesize = atoi(optarg);
if (basesize > 2)
StartLibCitadel(basesize);
break;
case 'i':
safestrncpy(ip_addr, optarg, sizeof ip_addr);
break;
case 'p':
http_port = atoi(optarg);
if (http_port == 0) {
safestrncpy(uds_listen_path, optarg, sizeof uds_listen_path);
}
break;
case 't':
/* no longer used, but ignored so old scripts don't break */
break;
case 'T':
LoadTemplates = atoi(optarg);
dbg_analyze_msg = (LoadTemplates & (1<<1)) != 0;
dbg_backtrace_template_errors = (LoadTemplates & (1<<2)) != 0;
break;
case 'Z':
DisableGzip = 1;
break;
case 'x':
/* no longer used, but ignored so old scripts don't break */
break;
case 'f':
follow_xff = 1;
break;
case 'c':
server_cookie = malloc(256);
if (server_cookie != NULL) {
safestrncpy(server_cookie,
"Set-cookie: wcserver=",
256);
if (gethostname
(&server_cookie[strlen(server_cookie)],
200) != 0) {
syslog(LOG_INFO, "gethostname: %s", strerror(errno));
free(server_cookie);
}
}
break;
#ifdef HAVE_OPENSSL
case 's':
is_https = 1;
break;
case 'S':
is_https = 1;
ssl_cipher_list = strdup(optarg);
break;
#endif
case 'G':
DumpTemplateI18NStrings = 1;
I18nDump = NewStrBufPlain(HKEY("int templatestrings(void)\n{\n"));
I18nDumpFile = optarg;
break;
case 'v':
verbose=1;
break;
default:
fprintf(stderr, "usage:\nwebcit "
"[-i ip_addr] [-p http_port] "
"[-c] [-f] "
"[-T Templatedebuglevel] "
"[-d] [-Z] [-G i18ndumpfile] "
"[-u uid] [-h homedirectory] "
"[-D daemonizepid] [-v] "
"[-g defaultlandingpage] [-B basesize] "
#ifdef HAVE_OPENSSL
"[-s] [-S cipher_suites]"
#endif
"[remotehost [remoteport]]\n");
return 1;
}
/* Start the logger */
openlog("webcit",
( running_as_daemon ? (LOG_PID) : (LOG_PID | LOG_PERROR) ),
LOG_DAEMON
);
if (optind < argc) {
ctdlhost = argv[optind];
if (++optind < argc)
ctdlport = argv[optind];
}
/* daemonize, if we were asked to */
if (!DumpTemplateI18NStrings && running_as_daemon) {
start_daemon(pidfile);
}
else {
signal(SIGINT, graceful_shutdown);
signal(SIGHUP, graceful_shutdown);
}
webcit_calc_dirs_n_files(relh, basedir, home, webcitdir, relhome);
LoadMimeBlacklist();
LoadIconDir(static_icon_dir);
/* Tell 'em who's in da house */
syslog(LOG_NOTICE, "%s", PACKAGE_STRING);
syslog(LOG_NOTICE, "Copyright (C) 1996-2018 by the citadel.org team");
syslog(LOG_NOTICE, " ");
syslog(LOG_NOTICE, "This program is open source software: you can redistribute it and/or");
syslog(LOG_NOTICE, "modify it under the terms of the GNU General Public License, version 3.");
syslog(LOG_NOTICE, " ");
syslog(LOG_NOTICE, "This program is distributed in the hope that it will be useful,");
syslog(LOG_NOTICE, "but WITHOUT ANY WARRANTY; without even the implied warranty of");
syslog(LOG_NOTICE, "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the");
syslog(LOG_NOTICE, "GNU General Public License for more details.");
syslog(LOG_NOTICE, " ");
/* initialize various subsystems */
initialise_modules();
initialise2_modules();
InitTemplateCache();
if (DumpTemplateI18NStrings) {
FILE *fd;
StrBufAppendBufPlain(I18nDump, HKEY("}\n"), 0);
if (StrLength(I18nDump) < 50) {
syslog(LOG_INFO, "*******************************************************************\n");
syslog(LOG_INFO, "* No strings found in templates! Are you sure they're there? *\n");
syslog(LOG_INFO, "*******************************************************************\n");
return -1;
}
fd = fopen(I18nDumpFile, "w");
if (fd == NULL) {
syslog(LOG_INFO, "***********************************************\n");
syslog(LOG_INFO, "* unable to open I18N dumpfile [%s] *\n", I18nDumpFile);
syslog(LOG_INFO, "***********************************************\n");
return -1;
}
fwrite(ChrPtr(I18nDump), 1, StrLength(I18nDump), fd);
fclose(fd);
return 0;
}
/* Tell libical to return an error instead of aborting if it sees badly formed iCalendar data. */
#ifdef LIBICAL_ICAL_EXPORT // cheap and sleazy way to detect libical >=2.0
icalerror_set_errors_are_fatal(0);
#else
icalerror_errors_are_fatal = 0;
#endif
/* Use our own prefix on tzid's generated from system tzdata */
icaltimezone_set_tzid_prefix("/citadel.org/");
/*
* Set up a place to put thread-specific data.
* We only need a single pointer per thread - it points to the
* wcsession struct to which the thread is currently bound.
*/
if (pthread_key_create(&MyConKey, NULL) != 0) {
syslog(LOG_ERR, "Can't create TSD key: %s", strerror(errno));
}
InitialiseSemaphores();
/*
* Set up a place to put thread-specific SSL data.
* We don't stick this in the wcsession struct because SSL starts
* up before the session is bound, and it gets torn down between
* transactions.
*/
#ifdef HAVE_OPENSSL
if (pthread_key_create(&ThreadSSL, NULL) != 0) {
syslog(LOG_ERR, "Can't create TSD key: %s", strerror(errno));
}
#endif
/*
* Bind the server to our favorite port.
* There is no need to check for errors, because webcit_tcp_server()
* exits if it doesn't succeed.
*/
if (!IsEmptyStr(uds_listen_path)) {
syslog(LOG_DEBUG, "Attempting to create listener socket at %s...", uds_listen_path);
msock = webcit_uds_server(uds_listen_path, LISTEN_QUEUE_LENGTH);
}
else {
syslog(LOG_DEBUG, "Attempting to bind to port %d...", http_port);
msock = webcit_tcp_server(ip_addr, http_port, LISTEN_QUEUE_LENGTH);
}
if (msock < 0)
{
ShutDownWebcit();
return -msock;
}
syslog(LOG_INFO, "Listening on socket %d", msock);
signal(SIGPIPE, SIG_IGN);
pthread_mutex_init(&SessionListMutex, NULL);
/*
* Start up the housekeeping thread
*/
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
pthread_create(&SessThread, &attr, (void *(*)(void *)) housekeeping_loop, NULL);
/*
* If this is an HTTPS server, fire up SSL
*/
#ifdef HAVE_OPENSSL
if (is_https) {
init_ssl();
}
#endif
drop_root(UID);
/* Become a worker thread. More worker threads will be spawned as they are needed. */
worker_entry();
ShutDownLibCitadel();
return 0;
}
webcit-dfsg.orig/who.c 0000644 0001750 0001750 00000021753 13223341037 014750 0 ustar michael michael
#include "webcit.h"
CtxType CTX_WHO = CTX_NONE;
typedef struct UserStateStruct {
StrBuf *UserName;
StrBuf *Room;
StrBuf *Host;
StrBuf *UserAgent;
StrBuf *RealRoom;
StrBuf *RealHost;
long LastActive;
int Session;
int Idle;
int IdleSince;
int SessionCount;
} UserStateStruct;
void DestroyUserStruct(void *vUser)
{
UserStateStruct *User = (UserStateStruct*) vUser;
FreeStrBuf(&User->UserName);
FreeStrBuf(&User->Room);
FreeStrBuf(&User->Host);
FreeStrBuf(&User->RealRoom);
FreeStrBuf(&User->RealHost);
FreeStrBuf(&User->UserAgent);
free(User);
}
int CompareUserStruct(const void *VUser1, const void *VUser2)
{
const UserStateStruct *User1 = (UserStateStruct*) GetSearchPayload(VUser1);
const UserStateStruct *User2 = (UserStateStruct*) GetSearchPayload(VUser2);
if (User1->Idle != User2->Idle)
return User1->Idle > User2->Idle;
return strcasecmp(ChrPtr(User1->UserName),
ChrPtr(User2->UserName));
}
int GetWholistSection(HashList *List, time_t now, StrBuf *Buf, const char *FilterName, long FNLen)
{
wcsession *WCC = WC;
UserStateStruct *User, *OldUser;
void *VOldUser;
size_t BufLen;
const char *Pos;
serv_puts("RWHO");
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, NULL) == 1) {
while (BufLen = StrBuf_ServGetln(Buf),
((BufLen >= 0) &&
((BufLen != 3) || strcmp(ChrPtr(Buf), "000"))))
{
if (BufLen <= 0)
continue;
Pos = NULL;
User = (UserStateStruct*) malloc(sizeof(UserStateStruct));
User->Session = StrBufExtractNext_int(Buf, &Pos, '|');
User->UserName = NewStrBufPlain(NULL, BufLen);
StrBufExtract_NextToken(User->UserName, Buf, &Pos, '|');
User->Room = NewStrBufPlain(NULL, BufLen);
StrBufExtract_NextToken(User->Room, Buf, &Pos, '|');
User->Host = NewStrBufPlain(NULL, BufLen);
StrBufExtract_NextToken(User->Host, Buf, &Pos, '|');
User->UserAgent = NewStrBufPlain(NULL, BufLen);
StrBufExtract_NextToken(User->UserAgent, Buf, &Pos, '|');
User->LastActive = StrBufExtractNext_long(Buf, &Pos, '|');
StrBufSkip_NTokenS(Buf, &Pos, '|', 3);
User->RealRoom = NewStrBufPlain(NULL, BufLen);
StrBufExtract_NextToken(User->RealRoom, Buf, &Pos, '|');
User->RealHost = NewStrBufPlain(NULL, BufLen);
StrBufExtract_NextToken(User->RealHost, Buf, &Pos, '|');
User->Idle = (now - User->LastActive) > 900L;
User->IdleSince = (now - User->LastActive) / 60;
User->SessionCount = 1;
if (FilterName == NULL) {
if (GetHash(List,
SKEY(User->UserName),
&VOldUser)) {
OldUser = VOldUser;
OldUser->SessionCount++;
if (!User->Idle) {
if (User->Session == WCC->ctdl_pid)
OldUser->Session = User->Session;
OldUser->Idle = User->Idle;
OldUser->LastActive = User->LastActive;
}
DestroyUserStruct(User);
}
else
Put(List,
SKEY(User->UserName),
User, DestroyUserStruct);
}
else {
if (strcmp(FilterName, ChrPtr(User->UserName)) == 0)
{
Put(List,
SKEY(User->UserName),
User, DestroyUserStruct);
}
else
{
DestroyUserStruct(User);
}
}
}
if (FilterName == NULL)
SortByPayload(List, CompareUserStruct);
return 1;
}
else {
return 0;
}
}
/*
* end session
*/
void terminate_session(void)
{
char buf[SIZ];
serv_printf("TERM %s", bstr("which_session"));
serv_getln(buf, sizeof buf);
url_do_template();
}
/*
* Change your session info (fake roomname and hostname)
*/
void edit_me(void)
{
char buf[SIZ];
output_headers(1, 0, 0, 0, 0, 0);
if (havebstr("change_room_name_button")) {
serv_printf("RCHG %s", bstr("fake_roomname"));
serv_getln(buf, sizeof buf);
do_template("who");
} else if (havebstr("change_host_name_button")) {
serv_printf("HCHG %s", bstr("fake_hostname"));
serv_getln(buf, sizeof buf);
do_template("who");
} else if (havebstr("change_user_name_button")) {
serv_printf("UCHG %s", bstr("fake_username"));
serv_getln(buf, sizeof buf);
do_template("who");
} else if (havebstr("cancel_button")) {
do_template("who");
} else {
do_template("who_edit");
}
end_burst();
}
void _terminate_session(void) {
slrp_highest();
terminate_session();
}
HashList *GetWholistHash(StrBuf *Target, WCTemplputParams *TP)
{
const char *ch = NULL;
int HashUniq = 1;
long len;
StrBuf *FilterNameStr = NULL;
StrBuf *Buf;
HashList *List;
time_t now;
Buf = NewStrBuf();
serv_puts("TIME");
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, NULL) == 2) {
const char *pos = ChrPtr(Buf) + 4;
now = StrBufExtractNext_long(Buf, &pos, '|');
}
else {
now = time(NULL);
}
if (HaveTemplateTokenString(NULL, TP, 2, &ch, &len))
{
FilterNameStr = NewStrBuf();
GetTemplateTokenString(FilterNameStr, TP, 2, &ch, &len);
HashUniq = 0;
}
List = NewHash(HashUniq, NULL);
GetWholistSection(List, now, Buf, ch, len);
FreeStrBuf(&Buf);
FreeStrBuf(&FilterNameStr);
return List;
}
void DeleteWholistHash(HashList **KillMe)
{
DeleteHash(KillMe);
}
void tmplput_who_username(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
StrBufAppendTemplate(Target, TP, User->UserName, 0);
}
void tmplput_who_UserAgent(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
StrBufAppendTemplate(Target, TP, User->UserAgent, 0);
}
void tmplput_who_room(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
StrBufAppendTemplate(Target, TP, User->Room, 0);
}
void tmplput_who_host(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
StrBufAppendTemplate(Target, TP, User->Host, 0);
}
void tmplput_who_realroom(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
StrBufAppendTemplate(Target, TP, User->RealRoom, 0);
}
int conditional_who_realroom(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
return StrLength(User->RealRoom) > 0;
}
void tmplput_who_realhost(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
StrBufAppendTemplate(Target, TP, User->RealHost, 0);
}
int conditional_who_realhost(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
return StrLength(User->RealHost) > 0;
}
void tmplput_who_lastactive(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
StrBufAppendPrintf(Target, "%d", User->LastActive);
}
void tmplput_who_idlesince(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
StrBufAppendPrintf(Target, "%d", User->IdleSince);
}
void tmplput_who_session(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
StrBufAppendPrintf(Target, "%d", User->Session);
}
int conditional_who_idle(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
return User->Idle;
}
int conditional_who_nsessions(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
return User->SessionCount;
}
void tmplput_who_nsessions(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
StrBufAppendPrintf(Target, "%d", User->SessionCount);
}
int conditional_who_isme(StrBuf *Target, WCTemplputParams *TP)
{
UserStateStruct *User = (UserStateStruct*) CTX(CTX_WHO);
return (User->Session == WC->ctdl_pid);
}
void
InitModule_WHO
(void)
{
RegisterCTX(CTX_WHO);
WebcitAddUrlHandler(HKEY("terminate_session"), "", 0, _terminate_session, 0);
WebcitAddUrlHandler(HKEY("edit_me"), "", 0, edit_me, 0);
RegisterIterator("WHOLIST", 1, NULL, GetWholistHash, NULL, DeleteWholistHash, CTX_WHO, CTX_NONE, IT_NOFLAG);
RegisterNamespace("WHO:NAME", 0, 1, tmplput_who_username, NULL, CTX_WHO);
RegisterNamespace("WHO:USERAGENT", 0, 1, tmplput_who_UserAgent, NULL, CTX_WHO);
RegisterNamespace("WHO:ROOM", 0, 1, tmplput_who_room, NULL, CTX_WHO);
RegisterNamespace("WHO:HOST", 0, 1, tmplput_who_host, NULL, CTX_WHO);
RegisterNamespace("WHO:REALROOM", 0, 1, tmplput_who_realroom, NULL, CTX_WHO);
RegisterNamespace("WHO:REALHOST", 0, 1, tmplput_who_realhost, NULL, CTX_WHO);
RegisterNamespace("WHO:LASTACTIVE", 0, 1, tmplput_who_lastactive, NULL, CTX_WHO);
RegisterNamespace("WHO:IDLESINCE", 0, 1, tmplput_who_idlesince, NULL, CTX_WHO);
RegisterNamespace("WHO:SESSION", 0, 1, tmplput_who_session, NULL, CTX_WHO);
RegisterNamespace("WHO:NSESSIONS", 0, 1, tmplput_who_nsessions, NULL, CTX_WHO);
RegisterNamespace("WHO:NSESSIONS", 0, 1, tmplput_who_nsessions, NULL, CTX_WHO);
RegisterConditional("WHO:IDLE", 1, conditional_who_idle, CTX_WHO);
RegisterConditional("WHO:NSESSIONS", 1, conditional_who_nsessions, CTX_WHO);
RegisterConditional("WHO:ISME", 1, conditional_who_isme, CTX_WHO);
RegisterConditional("WHO:REALROOM", 1, conditional_who_realroom, CTX_WHO);
RegisterConditional("WHO:REALHOST", 1, conditional_who_realhost, CTX_WHO);
}
webcit-dfsg.orig/paging.c 0000644 0001750 0001750 00000007640 13223341037 015417 0 ustar michael michael /*
* This module handles instant message related functions.
*
* Copyright (c) 1996-2012 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "webcit.h"
/*
* display the form for paging (x-messaging) another user
*/
void display_page(void)
{
char recp[SIZ];
strcpy(recp, bstr("recp"));
output_headers(1, 1, 1, 0, 0, 0);
wc_printf("
\n");
wDumpContent(1);
}
void tmplput_url_part(StrBuf *Target, WCTemplputParams *TP)
{
StrBuf *Name = NULL;
StrBuf *UrlBuf = NULL;
wcsession *WCC = WC;
if (WCC != NULL) {
long n;
n = GetTemplateTokenNumber(Target, TP, 0, 0);
if (n == 0) {
if (WCC->Hdr->HR.Handler != NULL)
UrlBuf = Name = WCC->Hdr->HR.Handler->Name;
}
else if (n == 1) {
UrlBuf = NewStrBuf();
StrBufExtract_token(UrlBuf, WCC->Hdr->HR.ReqLine, 0, '/');
}
else {
UrlBuf = NewStrBuf();
StrBufExtract_token(UrlBuf, WCC->Hdr->HR.ReqLine, 1, '/');
}
if (UrlBuf == NULL) {
LogTemplateError(Target, "urlbuf", ERR_PARM1, TP, "not set.");
}
StrBufAppendTemplate(Target, TP, UrlBuf, 2);
if (Name == NULL) FreeStrBuf(&UrlBuf);
}
}
typedef struct __BstrPair {
StrBuf *x;
StrBuf *y;
}BstrPair;
CtxType CTX_BSTRPAIRS = CTX_NONE;
void HFreeBstrPair(void *pv)
{
BstrPair *p = (BstrPair*) pv;
FreeStrBuf(&p->x);
FreeStrBuf(&p->y);
free(pv);
}
HashList *iterate_GetBstrPairs(StrBuf *Target, WCTemplputParams *TP)
{
StrBuf *X, *Y;
const char *ch = NULL;
long len;
const StrBuf *TheBStr;
BstrPair *OnePair;
HashList *List;
const char *Pos = NULL;
int i = 0;
if (HaveTemplateTokenString(NULL, TP, 2, &ch, &len))
{
GetTemplateTokenString(Target, TP, 2, &ch, &len);
}
else
{
return NULL;
}
TheBStr = SBstr(ch, len);
if ((TheBStr == NULL) || (StrLength(TheBStr) == 0))
return NULL;
List = NewHash(1, NULL);
while (Pos != StrBufNOTNULL)
{
X = NewStrBufPlain(NULL, StrLength(TheBStr));
StrBufExtract_NextToken(X, TheBStr, &Pos, '|');
if (Pos == StrBufNOTNULL) {
FreeStrBuf(&X);
DeleteHash(&List);
return NULL;
}
Y = NewStrBufPlain(NULL, StrLength(TheBStr));
StrBufExtract_NextToken(Y, TheBStr, &Pos, '|');
OnePair = (BstrPair*)malloc(sizeof(BstrPair));
OnePair->x = X;
OnePair->y = Y;
Put(List, IKEY(i), OnePair, HFreeBstrPair);
i++;
}
return List;
}
void tmplput_bstr_pair(StrBuf *Target, WCTemplputParams *TP, int XY)
{
BstrPair *Pair = (BstrPair*) CTX(CTX_BSTRPAIRS);
StrBufAppendTemplate(Target, TP, (XY)?Pair->y:Pair->x, 0);
}
void tmplput_bstr_pair_x(StrBuf *Target, WCTemplputParams *TP)
{ tmplput_bstr_pair(Target, TP, 0); }
void tmplput_bstr_pair_y(StrBuf *Target, WCTemplputParams *TP)
{ tmplput_bstr_pair(Target, TP, 1); }
void
InitModule_PARAMHANDLING
(void)
{
RegisterCTX(CTX_BSTRPAIRS);
WebcitAddUrlHandler(HKEY("diagnostics"), "", 0, diagnostics, NEED_URL);
RegisterIterator("ITERATE:BSTR:PAIR", 1, NULL, iterate_GetBstrPairs, NULL, DeleteHash, CTX_BSTRPAIRS, CTX_NONE, IT_NOFLAG);
RegisterNamespace("BSTR:PAIR:X", 1, 2, tmplput_bstr_pair_x, NULL, CTX_BSTRPAIRS);
RegisterNamespace("BSTR:PAIR:Y", 1, 2, tmplput_bstr_pair_y, NULL, CTX_BSTRPAIRS);
RegisterConditional("COND:BSTR", 1, ConditionalBstr, CTX_NONE);
RegisterNamespace("BSTR", 1, 2, tmplput_bstr, NULL, CTX_NONE);
RegisterNamespace("BSTR:FORWARD", 1, 2, tmplput_bstrforward, NULL, CTX_NONE);
RegisterNamespace("URLPART", 1, 2, tmplput_url_part, NULL, CTX_NONE);
}
void
SessionAttachModule_PARAMHANDLING
(wcsession *sess)
{
sess->Hdr->urlstrings = NewHash(1,NULL);
}
void
SessionDetachModule_PARAMHANDLING
(wcsession *sess)
{
DeleteHash(&sess->Hdr->urlstrings);
FreeStrBuf(&sess->upload_filename);
}
webcit-dfsg.orig/http_datestring.c 0000644 0001750 0001750 00000003650 13223341037 017352 0 ustar michael michael #include "webcit.h"
/** HTTP Months - do not translate - these are not for human consumption */
static char *httpdate_months[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
/** HTTP Weekdays - do not translate - these are not for human consumption */
static char *httpdate_weekdays[] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
/**
* \brief Supplied with a unix timestamp, generate a textual time/date stamp
* \param buf the return buffer
* \param n the size of the buffer
* \param xtime the time to format as string
*/
void http_datestring(char *buf, size_t n, time_t xtime) {
struct tm t;
long offset;
char offsign;
localtime_r(&xtime, &t);
/** Convert "seconds west of GMT" to "hours/minutes offset" */
#ifdef HAVE_STRUCT_TM_TM_GMTOFF
offset = t.tm_gmtoff;
#else
offset = timezone;
#endif
if (offset > 0) {
offsign = '+';
}
else {
offset = 0L - offset;
offsign = '-';
}
offset = ( (offset / 3600) * 100 ) + ( offset % 60 );
snprintf(buf, n, "%s, %02d %s %04d %02d:%02d:%02d %c%04ld",
httpdate_weekdays[t.tm_wday],
t.tm_mday,
httpdate_months[t.tm_mon],
t.tm_year + 1900,
t.tm_hour,
t.tm_min,
t.tm_sec,
offsign, offset
);
}
void tmplput_nowstr(StrBuf *Target, WCTemplputParams *TP)
{
char buf[64];
long bufused;
time_t now;
now = time(NULL);
#ifdef HAVE_SOLARIS_LOCALTIME_R
asctime_r(localtime(&now), buf, sizeof(buf));
#else
asctime_r(localtime(&now), buf);
#endif
bufused = strlen(buf);
if ((bufused > 0) && (buf[bufused - 1] == '\n')) {
buf[bufused - 1] = '\0';
bufused --;
}
StrEscAppend(Target, NULL, buf, 0, 0);
}
void tmplput_nowno(StrBuf *Target, WCTemplputParams *TP)
{
time_t now;
now = time(NULL);
StrBufAppendPrintf(Target, "%ld", now);
}
void
InitModule_DATE
(void)
{
RegisterNamespace("DATE:NOW:STR", 0, 0, tmplput_nowstr, NULL, CTX_NONE);
RegisterNamespace("DATE:NOW:NO", 0, 0, tmplput_nowno, NULL, CTX_NONE);
}
webcit-dfsg.orig/calendar_tools.c 0000644 0001750 0001750 00000023146 13223341037 017142 0 ustar michael michael /*
* Miscellaneous functions which handle calendar components.
*
* Copyright (c) 1996-2012 by the citadel.org team
*
* This program is open source software. You can redistribute it and/or
* modify it under the terms of the GNU General Public License, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "webcit.h"
#include "webserver.h"
#include "time.h"
#include "calendar.h"
/* Hour strings */
char *hourname[] = {
"12am", "1am", "2am", "3am", "4am", "5am", "6am",
"7am", "8am", "9am", "10am", "11am", "12pm",
"1pm", "2pm", "3pm", "4pm", "5pm", "6pm",
"7pm", "8pm", "9pm", "10pm", "11pm"
};
/*
* The display_icaltimetype_as_webform() and icaltime_from_webform() functions
* handle the display and editing of date/time properties in web pages. The
* first one converts an icaltimetype into valid HTML markup -- a series of form
* fields for editing the date and time. When the user submits the form, the
* results can be fed back into the second function, which turns it back into
* an icaltimetype. The "prefix" string required by both functions is prepended
* to all field names. This allows a form to contain more than one date/time
* property (for example, a start and end time) by ensuring the field names are
* unique within the form.
*
* NOTE: These functions assume that the icaltimetype being edited is in UTC, and
* will convert to/from local time for editing. "local" in this case is assumed
* to be the time zone in which the WebCit server is running. A future improvement
* might be to allow the user to specify his/her timezone.
*/
void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix, int date_only) {
wcsession *WCC = WC;
int i;
time_t now;
struct tm tm_now;
time_t tt;
struct tm tm;
int all_day_event = 0;
int time_format;
char timebuf[32];
time_format = get_time_format_cached ();
now = time(NULL);
localtime_r(&now, &tm_now);
if (t == NULL) return;
if (t->is_date) all_day_event = 1;
tt = icaltime_as_timet(*t);
if (all_day_event) {
gmtime_r(&tt, &tm);
}
else {
localtime_r(&tt, &tm);
}
wc_printf("WBuf, prefix, -1, 0);
wc_printf("\" id=\"");
StrBufAppendBufPlain(WCC->WBuf, prefix, -1, 0);
wc_printf("\" size=\"10\" maxlength=\"10\" value=\"");
wc_strftime(timebuf, 32, "%Y-%m-%d", &tm);
StrBufAppendBufPlain(WCC->WBuf, timebuf, -1, 0);
wc_printf("\">");
StrBufAppendPrintf(WC->trailing_javascript, "attachDatePicker('");
StrBufAppendPrintf(WC->trailing_javascript, prefix);
StrBufAppendPrintf(WC->trailing_javascript, "', '%s');\n", get_selected_language());
/* If we're editing a date only, we still generate the time boxes, but we hide them.
* This keeps the data model consistent.
*/
if (date_only) {
wc_printf("
");
}
}
/*
* Get date/time from a web form and convert it into an icaltimetype struct.
*/
void icaltime_from_webform(struct icaltimetype *t, char *prefix) {
char vname[32];
if (!t) return;
/* Stuff with zero values */
memset(t, 0, sizeof(struct icaltimetype));
/* Get the year/month/date all in one shot -- it will be in ISO YYYY-MM-DD format */
sscanf((char*)BSTR(prefix), "%04d-%02d-%02d", &t->year, &t->month, &t->day);
/* hour */
sprintf(vname, "%s_hour", prefix);
t->hour = IBSTR(vname);
/* minute */
sprintf(vname, "%s_minute", prefix);
t->minute = IBSTR(vname);
/* time zone is set to the default zone for this server */
t->is_utc = 0;
t->is_date = 0;
t->zone = get_default_icaltimezone();
}
/*
* Get date (no time) from a web form and convert it into an icaltimetype struct.
*/
void icaltime_from_webform_dateonly(struct icaltimetype *t, char *prefix) {
if (!t) return;
/* Stuff with zero values */
memset(t, 0, sizeof(struct icaltimetype));
/* Get the year/month/date all in one shot -- it will be in ISO YYYY-MM-DD format */
sscanf((char*)BSTR(prefix), "%04d-%02d-%02d", &t->year, &t->month, &t->day);
/* time zone is set to the default zone for this server */
t->is_utc = 1;
t->is_date = 1;
}
/*
* Render a PARTSTAT parameter as a string (and put it in parentheses)
*/
void partstat_as_string(char *buf, icalproperty *attendee) {
icalparameter *partstat_param;
icalparameter_partstat partstat;
strcpy(buf, _("(status unknown)"));
partstat_param = icalproperty_get_first_parameter(
attendee,
ICAL_PARTSTAT_PARAMETER
);
if (partstat_param == NULL) {
return;
}
partstat = icalparameter_get_partstat(partstat_param);
switch(partstat) {
case ICAL_PARTSTAT_X:
strcpy(buf, "(x)");
break;
case ICAL_PARTSTAT_NEEDSACTION:
strcpy(buf, _("(needs action)"));
break;
case ICAL_PARTSTAT_ACCEPTED:
strcpy(buf, _("(accepted)"));
break;
case ICAL_PARTSTAT_DECLINED:
strcpy(buf, _("(declined)"));
break;
case ICAL_PARTSTAT_TENTATIVE:
strcpy(buf, _("(tenative)"));
break;
case ICAL_PARTSTAT_DELEGATED:
strcpy(buf, _("(delegated)"));
break;
case ICAL_PARTSTAT_COMPLETED:
strcpy(buf, _("(completed)"));
break;
case ICAL_PARTSTAT_INPROCESS:
strcpy(buf, _("(in process)"));
break;
case ICAL_PARTSTAT_NONE:
strcpy(buf, _("(none)"));
break;
}
}
/*
* Utility function to encapsulate a subcomponent into a full VCALENDAR.
*
* We also scan for any date/time properties that reference timezones, and attach
* those timezones along with the supplied subcomponent. (Increase the size of the array if you need to.)
*
* Note: if you change anything here, change it in Citadel server's ical_send_out_invitations() too.
*/
icalcomponent *ical_encapsulate_subcomponent(icalcomponent *subcomp) {
icalcomponent *encaps;
icalproperty *p;
struct icaltimetype t;
const icaltimezone *attached_zones[5] = { NULL, NULL, NULL, NULL, NULL };
int i;
const icaltimezone *z;
int num_zones_attached = 0;
int zone_already_attached;
if (subcomp == NULL) {
syslog(LOG_WARNING, "ERROR: ical_encapsulate_subcomponent() called with NULL argument\n");
return NULL;
}
/*
* If we're already looking at a full VCALENDAR component, this is probably an error.
*/
if (icalcomponent_isa(subcomp) == ICAL_VCALENDAR_COMPONENT) {
syslog(LOG_WARNING, "ERROR: component sent to ical_encapsulate_subcomponent() already top level\n");
return subcomp;
}
/* search for... */
for (p = icalcomponent_get_first_property(subcomp, ICAL_ANY_PROPERTY);
p != NULL;
p = icalcomponent_get_next_property(subcomp, ICAL_ANY_PROPERTY))
{
if ( (icalproperty_isa(p) == ICAL_COMPLETED_PROPERTY)
|| (icalproperty_isa(p) == ICAL_CREATED_PROPERTY)
|| (icalproperty_isa(p) == ICAL_DATEMAX_PROPERTY)
|| (icalproperty_isa(p) == ICAL_DATEMIN_PROPERTY)
|| (icalproperty_isa(p) == ICAL_DTEND_PROPERTY)
|| (icalproperty_isa(p) == ICAL_DTSTAMP_PROPERTY)
|| (icalproperty_isa(p) == ICAL_DTSTART_PROPERTY)
|| (icalproperty_isa(p) == ICAL_DUE_PROPERTY)
|| (icalproperty_isa(p) == ICAL_EXDATE_PROPERTY)
|| (icalproperty_isa(p) == ICAL_LASTMODIFIED_PROPERTY)
|| (icalproperty_isa(p) == ICAL_MAXDATE_PROPERTY)
|| (icalproperty_isa(p) == ICAL_MINDATE_PROPERTY)
|| (icalproperty_isa(p) == ICAL_RECURRENCEID_PROPERTY)
) {
t = icalproperty_get_dtstart(p); /*/ it's safe to use dtstart for all of them */
if ((icaltime_is_valid_time(t)) && (z=icaltime_get_timezone(t), z)) {
zone_already_attached = 0;
for (i=0; i<5; ++i) {
if (z == attached_zones[i]) {
++zone_already_attached;
syslog(LOG_DEBUG, "zone already attached!!\n");
}
}
if ((!zone_already_attached) && (num_zones_attached < 5)) {
syslog(LOG_DEBUG, "attaching zone %d!\n", num_zones_attached);
attached_zones[num_zones_attached++] = z;
}
icalproperty_set_parameter(p,
icalparameter_new_tzid(icaltimezone_get_tzid((icaltimezone *)z))
);
}
}
}
/* Encapsulate the VEVENT component into a complete VCALENDAR */
encaps = icalcomponent_new(ICAL_VCALENDAR_COMPONENT);
if (encaps == NULL) {
syslog(LOG_WARNING, "ERROR: ical_encapsulate_subcomponent() could not allocate component\n");
return NULL;
}
/* Set the Product ID */
icalcomponent_add_property(encaps, icalproperty_new_prodid(PRODID));
/* Set the Version Number */
icalcomponent_add_property(encaps, icalproperty_new_version("2.0"));
/* Attach any timezones we need */
if (num_zones_attached > 0) for (i=0; i