[Prev][Next][Index][Thread]

Help getting started with libwww



I am having alot of trouble getting started using libwww. Specifically,
what I want to do as a starting point is to hook up the NCSA HTML widget
with the libwww code for retrieving html. I.e. feed a URL into libwww, get
back a bunch of HTML, and put that into the HTML widget, and have it get
displayed. Seems like it should be simple, but I am getting lost in the
documentation.

I have made some progress, but have some major questions.

1. In numerous places the docs say you should "overwrite" various
   modules if you have your own HTML parser, but I can find no
   information about what is meant by this, or how it should be done.

   I was able to define dummy stubs for the various HText_* functions
   to get my program to compile. Then instead of trying to replace the
   HTML module, I set up a request structure using WWW_HTML as the
   output format. Is there anything wrong with doing it this way? Do I
   really need to "overwrite", whatever that means?

2. I think I am missing something really obvious and basic about the
   way streams are supposed to work. What should be in the
   output_stream field of my request? I just want to get back a string
   full of HTML to drop into the HTML widget. I got it to sort of work
   by using pipe(), and passing in the write-end to HTWriter_new, then
   reading off the other end, but pipes really are not meant for use
   in a single process, and I think the program would block if more
   than 4096 bytes got written to the pipe before I could read it.

   I also have gotten it to write to a file, which I could then simply
   read off the disk, but that does not seem efficient. I started
   looking at HTSaveAndCallback(), but the comment in the source
   recommends not using it.

   Do I need to use a AF_UNIX socket or something? Or should I just go
   ahead and use two separate processes and a pipe?

3. The libwww.a library seems to build just fine, and I can link with
   it (I am on Dec Ultrix, by the way), but when I try to use
   xcodecenter to debug my program, it chokes while trying to link
   libwww.a. Anybody know why?

4. Is there any problem in general linking libwww with an X/Motif program?
   Mosaic does it, so it must be possible. But it seems to me that there
   could be interence, for example you are supposed to use XtMalloc and
   XtFree instead of malloc() and free() everywhere in a Motif program.

Any and all help would be greatly appreciated. What I would most like,
if it exists, would be pointers to any documentation on libwww that is
more introductory in nature.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
= Matthew M. Freedman                                                 =
= U. of Washington Information Systems       mattf@cac.washington.edu =
= 4545 15th Ave. NE; 3rd Floor               (206) 543-5593           =
= Seattle, WA  98105                                                  =
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-











Follow-Ups: