version 1.336, 2003/11/24 14:45:34
|
version 1.337, 2003/12/16 12:10:07
|
Line 17
|
Line 17
|
/* defines to include elsewhere |
/* defines to include elsewhere |
*********************************/ |
*********************************/ |
|
|
#ifdef _WINDOWS |
#ifdef _WINGUI |
#include <string.h> |
#include <string.h> |
#endif /* !_WINDOWS */ |
#endif /* !_WINGUI */ |
|
|
#define AMAYA_WWW_CACHE |
#define AMAYA_WWW_CACHE |
#define AMAYA_LOST_UPDATE |
#define AMAYA_LOST_UPDATE |
Line 30
|
Line 30
|
#include "init_f.h" |
#include "init_f.h" |
#include <sys/types.h> |
#include <sys/types.h> |
|
|
#ifndef _WINDOWS |
#ifndef _WINGUI |
#include <unistd.h> |
#include <unistd.h> |
#endif |
#endif |
|
|
Line 76 struct _HTError
|
Line 76 struct _HTError
|
/*----------------------------------------------------------------------*/ |
/*----------------------------------------------------------------------*/ |
|
|
/* libwww default parameters */ |
/* libwww default parameters */ |
#ifdef _WINDOWS |
#ifdef _WINGUI |
#define CACHE_DIR_NAME "\\libwww-cache\\" |
#define CACHE_DIR_NAME "\\libwww-cache\\" |
#endif /* _WINDOWS */ |
#endif /* _WINGUI */ |
|
|
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) |
#define CACHE_DIR_NAME "/libwww-cache/" |
#define CACHE_DIR_NAME "/libwww-cache/" |
Line 140 static FILE *trace_fp = NULL;
|
Line 140 static FILE *trace_fp = NULL;
|
|
|
/* prototypes */ |
/* prototypes */ |
|
|
#ifdef _WINDOWS |
#ifdef _WINGUI |
int WIN_Activate_Request (HTRequest* , HTAlertOpcode, int, const char*, void*, HTAlertPar*); |
int WIN_Activate_Request (HTRequest* , HTAlertOpcode, int, const char*, void*, HTAlertPar*); |
#endif /* _WINDOWS */ |
#endif /* _WINGUI */ |
|
|
#ifdef AMAYA_WWW_CACHE |
#ifdef AMAYA_WWW_CACHE |
/*************************************************************** |
/*************************************************************** |
Line 158 int WIN_Activate_Request (HTRequest* , H
|
Line 158 int WIN_Activate_Request (HTRequest* , H
|
static int set_cachelock (char *filename) |
static int set_cachelock (char *filename) |
{ |
{ |
int status = 0; |
int status = 0; |
#ifdef _WINDOWS |
#ifdef _WINGUI |
|
|
status = TtaFileExist (filename); |
status = TtaFileExist (filename); |
return ((status) ? 0 : -1); |
return ((status) ? 0 : -1); |
#endif /* _WINDOWS */ |
#endif /* _WINGUI */ |
|
|
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
struct flock lock; |
struct flock lock; |
Line 217 static int clear_cachelock (void)
|
Line 217 static int clear_cachelock (void)
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static int test_cachelock (char *filename) |
static int test_cachelock (char *filename) |
{ |
{ |
#ifdef _WINDOWS |
#ifdef _WINGUI |
/* if the lock is set, we can't unlink the file under Windows */ |
/* if the lock is set, we can't unlink the file under Windows */ |
if (!TtaFileUnlink (filename)) |
if (!TtaFileUnlink (filename)) |
return 0; |
return 0; |
Line 809 int AHTOpen_file (HTRequ
|
Line 809 int AHTOpen_file (HTRequ
|
(me->output != stdout) && |
(me->output != stdout) && |
(me->output = fopen (me->outputfile, "w")) == NULL) |
(me->output = fopen (me->outputfile, "w")) == NULL) |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
#ifdef _WINDOWS |
#ifdef _WINGUI |
if (!(me->output) && |
if (!(me->output) && |
(me->output != stdout) && |
(me->output != stdout) && |
(me->output = fopen (me->outputfile, "wb")) == NULL) |
(me->output = fopen (me->outputfile, "wb")) == NULL) |
#endif /* _WINDOWS */ |
#endif /* _WINGUI */ |
{ |
{ |
me->outputfile[0] = EOS; /* file could not be opened */ |
me->outputfile[0] = EOS; /* file could not be opened */ |
#ifdef DEBUG_LIBWWW |
#ifdef DEBUG_LIBWWW |
Line 1826 static void AHTProtocolInit (voi
|
Line 1826 static void AHTProtocolInit (voi
|
HTTransport_add("buffered_tcp", HT_TP_SINGLE, HTReader_new, |
HTTransport_add("buffered_tcp", HT_TP_SINGLE, HTReader_new, |
HTBufferWriter_new); |
HTBufferWriter_new); |
HTProtocol_add ("http", "buffered_tcp", HTTP_PORT, NO, HTLoadHTTP, NULL); |
HTProtocol_add ("http", "buffered_tcp", HTTP_PORT, NO, HTLoadHTTP, NULL); |
#ifdef _WINDOWS |
#ifdef _WINGUI |
HTProtocol_add ("file", "local", 0, YES, HTLoadFile, NULL); |
HTProtocol_add ("file", "local", 0, YES, HTLoadFile, NULL); |
#endif /* _WINDOWS */ |
#endif /* _WINGUI */ |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
HTProtocol_add ("file", "local", 0, NO, HTLoadFile, NULL); |
HTProtocol_add ("file", "local", 0, NO, HTLoadFile, NULL); |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
Line 1904 static void AHTAlertInit (void)
|
Line 1904 static void AHTAlertInit (void)
|
{ |
{ |
HTAlert_add (AHTProgress, HT_A_PROGRESS); |
HTAlert_add (AHTProgress, HT_A_PROGRESS); |
|
|
#ifdef _WINDOWS /* <<-- SG : it was __WINDOWS : I replace it with _WINDOWS */ |
#ifdef _WINGUI /* <<-- SG : it was __WINGUI : I replace it with _WINGUI */ |
HTAlert_add ((HTAlertCallback *) WIN_Activate_Request, HT_PROG_CONNECT); |
HTAlert_add ((HTAlertCallback *) WIN_Activate_Request, HT_PROG_CONNECT); |
#endif /* _WINDOWS */ |
#endif /* _WINGUI */ |
|
|
HTAlert_add (AHTError_print, HT_A_MESSAGE); |
HTAlert_add (AHTError_print, HT_A_MESSAGE); |
HTError_setShow ( (HTErrorShow)(~((unsigned int) 0 ) & ~((unsigned int) HT_ERR_SHOW_DEBUG)) ); /* process all messages except debug ones*/ |
HTError_setShow ( (HTErrorShow)(~((unsigned int) 0 ) & ~((unsigned int) HT_ERR_SHOW_DEBUG)) ); /* process all messages except debug ones*/ |
Line 1922 static void AHTAlertInit (void)
|
Line 1922 static void AHTAlertInit (void)
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static void RecCleanCache (char *dirname) |
static void RecCleanCache (char *dirname) |
{ |
{ |
#ifdef _WINDOWS |
#ifdef _WINGUI |
HANDLE hFindFile; |
HANDLE hFindFile; |
ThotBool status; |
ThotBool status; |
WIN32_FIND_DATA ffd; |
WIN32_FIND_DATA ffd; |
Line 1969 static void RecCleanCache (char *dirname
|
Line 1969 static void RecCleanCache (char *dirname
|
status = FindNextFile (hFindFile, &ffd); |
status = FindNextFile (hFindFile, &ffd); |
} |
} |
FindClose (hFindFile); |
FindClose (hFindFile); |
#endif /* _WINDOWS */ |
#endif /* _WINGUI */ |
|
|
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
DIR *dp; |
DIR *dp; |
Line 2446 static void AHTProfile_delete (v
|
Line 2446 static void AHTProfile_delete (v
|
HTList_delete (Amaya->reqlist); |
HTList_delete (Amaya->reqlist); |
TtaFreeMemory (Amaya); |
TtaFreeMemory (Amaya); |
|
|
#ifdef _WINDOWS |
#ifdef _WINGUI |
if (HTLib_isInitialized ()) |
if (HTLib_isInitialized ()) |
HTEventTerminate (); |
HTEventTerminate (); |
#endif /* _WINDOWS; */ |
#endif /* _WINGUI; */ |
|
|
/* Clean up the persistent cache (if any) */ |
/* Clean up the persistent cache (if any) */ |
#ifdef AMAYA_WWW_CACHE |
#ifdef AMAYA_WWW_CACHE |
Line 2505 void QueryInit ()
|
Line 2505 void QueryInit ()
|
CanDoStop_set (TRUE); |
CanDoStop_set (TRUE); |
UserAborted_flag = FALSE; |
UserAborted_flag = FALSE; |
|
|
#ifdef _WINDOWS |
#ifdef _WINGUI |
HTEventInit (); |
HTEventInit (); |
#endif /* _WINDOWS */ |
#endif /* _WINGUI */ |
|
|
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
HTEvent_setRegisterCallback ( AHTEvent_register); |
HTEvent_setRegisterCallback ( AHTEvent_register); |
Line 2645 static int LoopForStop (AHTReqC
|
Line 2645 static int LoopForStop (AHTReqC
|
{ |
{ |
int status_req = HT_OK; |
int status_req = HT_OK; |
|
|
#ifdef _WINDOWS |
#ifdef _WINGUI |
MSG msg; |
MSG msg; |
unsigned long libwww_msg; |
unsigned long libwww_msg; |
HWND old_active_window, libwww_window; |
HWND old_active_window, libwww_window; |
Line 2666 static int LoopForStop (AHTReqC
|
Line 2666 static int LoopForStop (AHTReqC
|
if (!AmayaIsAlive ()) |
if (!AmayaIsAlive ()) |
/* Amaya was killed by one of the callback handlers */ |
/* Amaya was killed by one of the callback handlers */ |
exit (0); |
exit (0); |
#endif /* _WINDOWS */ |
#endif /* _WINGUI */ |
|
|
#if defined(_MOTIF) || defined(_GTK) |
#if defined(_MOTIF) || defined(_GTK) |
ThotEvent ev; |
ThotEvent ev; |
Line 3103 int GetObjectWWW (int docid, int refdoc,
|
Line 3103 int GetObjectWWW (int docid, int refdoc,
|
else |
else |
me->urlName = (char *)TtaGetMemory (MAX_LENGTH + 2); |
me->urlName = (char *)TtaGetMemory (MAX_LENGTH + 2); |
strcpy (me->urlName, urlName); |
strcpy (me->urlName, urlName); |
#ifdef _WINDOWS |
#ifdef _WINGUI |
/* force windows ASYNC requests to always be non preemptive */ |
/* force windows ASYNC requests to always be non preemptive */ |
HTRequest_setPreemptive (me->request, NO); |
HTRequest_setPreemptive (me->request, NO); |
#endif /*_WINDOWS */ |
#endif /*_WINGUI */ |
} /* AMAYA_ASYNC mode */ |
} /* AMAYA_ASYNC mode */ |
else |
else |
#ifdef _WINDOWS |
#ifdef _WINGUI |
{ |
{ |
me->outputfile = outputfile; |
me->outputfile = outputfile; |
me->urlName = urlName; |
me->urlName = urlName; |
/* force windows SYNC requests to always be non preemptive */ |
/* force windows SYNC requests to always be non preemptive */ |
HTRequest_setPreemptive (me->request, YES); |
HTRequest_setPreemptive (me->request, YES); |
} |
} |
#endif /* !_WINDOWS */ |
#endif /* !_WINGUI */ |
|
|
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
{ |
{ |
Line 3336 int PutObjectWWW (int docid, char *fileN
|
Line 3336 int PutObjectWWW (int docid, char *fileN
|
char url_name[MAX_LENGTH]; |
char url_name[MAX_LENGTH]; |
char *resource_name; |
char *resource_name; |
char *tmp2; |
char *tmp2; |
#ifdef _WINDOWS |
#ifdef _WINGUI |
char file_name[MAX_LENGTH]; |
char file_name[MAX_LENGTH]; |
#endif /* _WINDOWS */ |
#endif /* _WINGUI */ |
|
|
if (mode & AMAYA_SIMPLE_PUT) |
if (mode & AMAYA_SIMPLE_PUT) |
{ |
{ |
Line 3463 int PutObjectWWW (int docid, char *fileN
|
Line 3463 int PutObjectWWW (int docid, char *fileN
|
me->outputfile = (char *) NULL; |
me->outputfile = (char *) NULL; |
} |
} |
|
|
#ifdef _WINDOWS |
#ifdef _WINGUI |
/* libwww's HTParse function doesn't take into account the drive name; |
/* libwww's HTParse function doesn't take into account the drive name; |
so we sidestep it */ |
so we sidestep it */ |
|
|
Line 3471 int PutObjectWWW (int docid, char *fileN
|
Line 3471 int PutObjectWWW (int docid, char *fileN
|
StrAllocCopy (fileURL, "file:"); |
StrAllocCopy (fileURL, "file:"); |
strcpy (file_name, fileName); |
strcpy (file_name, fileName); |
StrAllocCat (fileURL, file_name); |
StrAllocCat (fileURL, file_name); |
#endif /* _WINDOWS */ |
#endif /* _WINGUI */ |
|
|
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
fileURL = HTParse (fileName, "file:/", PARSE_ALL); |
fileURL = HTParse (fileName, "file:/", PARSE_ALL); |
Line 3848 ThotBool AHTFTPURL_flag (void)
|
Line 3848 ThotBool AHTFTPURL_flag (void)
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
ThotBool CheckSingleInstance (char *pid_dir) |
ThotBool CheckSingleInstance (char *pid_dir) |
{ |
{ |
#ifdef _WINDOWS |
#ifdef _WINGUI |
HWND hwnd; |
HWND hwnd; |
|
|
hwnd = FindWindow ("Amaya", NULL); |
hwnd = FindWindow ("Amaya", NULL); |
Line 3858 ThotBool CheckSingleInstance (char *pid_
|
Line 3858 ThotBool CheckSingleInstance (char *pid_
|
else |
else |
return FALSE; |
return FALSE; |
|
|
#endif /* _WINDOWS */ |
#endif /* _WINGUI */ |
|
|
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
int instances; |
int instances; |