Re: Just The Page, Please

> I'd like libwww to just get a page and dump it to stdout *UNTOUCHED*.
> 
> Why doesn't the following do this?
> 
>    HTLibInit("Dump", "0.0);
> 
>    HTProtocol_add("http", YES, HTLoadHTTP, NULL);
> 
>    HTRequest_setOutputStream (request, output);
> 
>    if ((ref = HTParse(argv[1], "", PARSE_ALL)) &&
>        (anchor = (HTParentAnchor *) HTAnchor_findAddress(ref)) &&
>        HTLoadAnchor((HTAnchor *)anchor, request))
>    { printf ("\n");
>      exit (0);
>    }
>    else
>    { exit (1); }

You can actually use the example code that I sent out yesterday on the list. 
Let me just repeat that it is almost identical to the libapp_3.c example that 
you can find in the distribution at

	WWW/Library/Examples

You can also find it online at

	http://www.w3.org/pub/WWW/Library/Examples/

There are no window make files for the examples, but that should be pretty 
straight forward to do.

                         0
                          \ /
-- CLIP -- CLIP -- CLIP -- x -- CLIP -- CLIP -- CLIP -- CLIP -- CLIP -- CLIP --
                          / \
                         0
#include "WWWLib.h"
#include "HTTP.h"
#include "WWWMIME.h"
#include "HTDialog.h"

int main (int argc, char ** argv)
{
    HTList * converters = HTList_new();
    HTRequest * request = HTRequest_new();	  /* Create a request object */

    /* WWWTRACE = SHOW_ALL_TRACE; */

    HTLibInit("TestApp", "1.0");
    HTProtocol_add("http", YES, HTLoadHTTP, NULL);

    HTConversion_add(converters, "message/rfc822", "*/*", HTMIMEConvert,
		     1.0, 0.0, 0.0);
    HTConversion_add(converters, "*/*", "www/present", HTSaveLocally,
		     1.0, 0.0, 0.0);
    HTFormat_setConversion(converters);
    HTAlert_add(HTPrompt, HT_A_PROMPT);
    if (argc == 2) {
	HTLoadAbsolute(argv[1], request);
    } else
	printf("Type the URL to fetch\n");
    HTRequest_delete(request);			/* Delete the request object */
    HTConversion_deleteAll(converters);
    HTLibTerminate();
    return 0;
}

-- 

Henrik Frystyk Nielsen, <frystyk@w3.org>
World-Wide Web Consortium, MIT/LCS NE43-356
545 Technology Square, Cambridge MA 02139, USA

Received on Friday, 12 January 1996 10:43:38 UTC