int LYTestMailcapCommand( char *testcommand, char *params ) { int eax; int result; char TmpFileName[256]; HTChunk *expanded = 0; if ( LYMailcapUsesPctS( testcommand ) & 255 ) { if ( LYOpenTemp( TmpFileName, ".html", "w" ) == 0 ) { ExitWithError( gettext( "Can't open temporary file!" ) ); } LYCloseTemp( TmpFileName ); } else TmpFileName[0] = 0; expanded = HTChunkCreate( 1024 ); result = BuildCommand( expanded, testcommand, TmpFileName, params ); if ( result ) { result = 1; if ( WWW_TraceFlag == 0 || ( WWW_TraceMask & 8 ) == 0 ) { HTChunkFree( expanded ); LYRemoveTemp( TmpFileName ); return result; } fprintf( TraceFP( ), "PassesTest: Deferring test command: %s\n", &expanded->data ); } else { if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) ) { fprintf( TraceFP( ), "PassesTest: Executing test command: %s\n", &expanded->data ); } result = LYSystem( &expanded->data ); if ( result ) { result = -1; if ( WWW_TraceFlag == 0 || ( WWW_TraceMask & 8 ) == 0 ) { HTChunkFree( expanded ); LYRemoveTemp( TmpFileName ); return result; } fprintf( TraceFP( ), "PassesTest: Test failed!\n" ); } else { if ( WWW_TraceFlag == 0 || ( WWW_TraceMask & 8 ) == 0 ) { HTChunkFree( expanded ); LYRemoveTemp( TmpFileName ); return result; } fprintf( TraceFP( ), "PassesTest: Test passed!\n" ); } } }
int optionsURL_tcl(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) { if (argc == 2) { char *url = argv[1]; if (url) { HTRequest *req = HTRequest_new(); BOOL work; HTChunk *chunk = HTChunk_new(0x2000); HTStream *stream = HTStreamToChunk(req, &chunk, 0); HTRequest_setOutputFormat(req, DEFAULT_FORMAT); HTRequest_setOutputStream(req, stream); HTRequest_setPreemptive(req, YES); work = HTOptionsAbsolute(url, req); Tcl_AppendResult(interp, work ? "YES" : "NO", HTChunkData(chunk), NULL); HT_FREE(url); HTRequest_kill(req); HT_FREE(stream); HTChunkFree(chunk); return TCL_OK; } Tcl_AppendResult(interp, bad_vars, NULL); return TCL_ERROR; } else { Tcl_AppendResult(interp, err_string, argv[0], " url", NULL); return TCL_ERROR; } }
int postURL_tcl(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) { if (argc == 3) { char *url = argv[1]; char *dest = argv[2]; if (url && dest) { HTParentAnchor *source = (HTParentAnchor *) HTAnchor_findAddress(url); HTRequest *req = HTRequest_new(); HTChunk *chunk = HTChunk_new(0x2000); HTStream *stream = HTStreamToChunk(req, &chunk, 0); BOOL work; HTRequest_setOutputFormat(req, DEFAULT_FORMAT); HTRequest_setOutputStream(req, stream); HTRequest_setPreemptive(req, YES); work = HTPostAbsolute (source, dest, req); Tcl_AppendResult(interp, work ? "YES" : "NO", HTChunkData(chunk), NULL); HT_FREE(url); HTRequest_kill(req); HTAnchor_delete(source); HT_FREE(stream); HTChunkFree(chunk); return TCL_OK; } Tcl_AppendResult(interp, bad_vars, NULL); return TCL_ERROR; } else { Tcl_AppendResult(interp, err_string, argv[0], " url destination", NULL); return TCL_ERROR; } }
char *LYMakeMailcapCommand( char *command, char *params, char *filename ) { HTChunk *expanded = 0; char *result = 0; expanded = HTChunkCreate( 1024 ); BuildCommand( expanded, command, filename, params ); HTSACopy( &result, &expanded->data ); HTChunkFree( expanded ); return result; }
PRIVATE int CSUserList_abort (HTStream * me, HTList * e) { int status = HT_ERROR; if (me->target) status = (*me->target->isa->abort)(me->target, e); HTTRACE(APP_TRACE, "Rules....... ABORTING...\n"); HTChunkFree(me->buffer); /* HTList_delete(me->URLs); */ HT_FREE(me); return status; }
PRIVATE int CSUserList_free (HTStream * me) { int status = HT_OK; if (me->target) { if ((status = (*me->target->isa->_free)(me->target)) == HT_WOULD_BLOCK) return HT_WOULD_BLOCK; } HTTRACE(APP_TRACE, "Rules....... FREEING....\n"); HTChunkFree(me->buffer); /* HTList_delete(me->URLs); */ HT_FREE(me); return status; }
PUBLIC void HTAnchor_clearSourceCache ARGS1( HTParentAnchor *, me) { /* * Clean up the source cache, if any. */ if (me->source_cache_file) { CTRACE((tfp, "SourceCache: Removing file %s\n", me->source_cache_file)); LYRemoveTemp(me->source_cache_file); FREE(me->source_cache_file); } if (me->source_cache_chunk) { CTRACE((tfp, "SourceCache: Removing memory chunk %p\n", (void *)me->source_cache_chunk)); HTChunkFree(me->source_cache_chunk); me->source_cache_chunk = NULL; } }