W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2001

Re: libwww on Macs

From: Jeff Adams <jeffa@coursewave.com>
Date: Wed, 21 Mar 2001 12:53:42 -0600
Message-ID: <3AB8F8B6.AA0CB164@coursewave.com>
To: Manuel Gonzalez <mgonzal@bpo.hp.com>
CC: www-lib@w3.org
Manuel Gonzalez wrote:
> Hi everyone,
> I have to develop an application with a HTTP client integrated that must run
> in Macs, Windows and Linux. I think libwww can be a solution but I have read
> that "It doesn't work out of the box but several people are using it on
> Macs. Ask on the <www-lib@w3.org> mailing list". So, that is what i am
> doing...
> Someone knows how to use the library  in Macs? There exists some
> documentation?
> Best Regards
> ---------------------------------------------------------
> Manuel González               email: m_gonzalez@hp.com
> R&D Engineer                   Hewlett-Packard ICD

Hello Manuel,

Yes it is possible to use the latest libwww on Mac OS 8.x/9.x and it 
definitely does not work 'out of the box' unfortunately.
Also the documentation on gettting it to work is very sparse or 
non-existent so I thought I'd send a quick reply with a possible
checklist and cc the 
mailing list so someone searching the archives of the mailing list might
find it

It really would be nice if the libwww maintainers could update the
porting info
on MacOS, especially now with this Saturday's release of MacOS X.
BTW. I do not know if you have the option of only porting to MacOS X and
not the older
versions, because last I tried it libwww on MacOS X works with a simple
'./configure, make'
since it's BSD/UNIX based.  Though I did notice the examples/ failed to
build because
the Makefile generated added a '-lm' for the math lib which MacOS X does
not use explicitly.
But I digress...

First off let me state for the record I am by no means a MacOS 8.x/9.x
I, like you, am using libwww in a Linux/Windows/Mac porting effort and
needed a Mac port
of libwww out of necessity.

Here is a brief summary of the ingredients and issues I had getting
to work on Mac. There might be other options but for someone not a
native MacOS programmer
this seemed the least painful:

- I am using the latest libwww v 5.3.2
- I used the third-party GUSI library version 2.1.3
- I also used Metrowerks CodeWarrior v6.0 IDE and its libraries which
work nicely with GUSI

- You will notice some #defines already in the libwww code for GUSI and
for metrowerks especially
  in wwwsys.h. I had to add to the Metrowerks/Mac section of wwwsys.h to
add some missing
  mac specific items

- The latest distribution handles platform specific pathname issues for
Linux and Windows but does
  not handle Mac issues like ":" path separators etc. at all.  Depending
upon whether you end
  up using the local filesystem features of libwww in your client you
may not
  need to update/improve this code.

- The other significant hurdle I found on using GUSI/libwww on Mac is
that when using GUSI,
  the time_t field needs to be an unsigned long for libwww to work on
the Mac

Since I am no expert on MacOS (pre OS X) I do not feel confident in
submitting my code
as official Mac ports for libwww as I have also only implemented what I
have needed
to get my client working with libwww on the Mac. I do not use local file
i/o so I have not
really come close to completely porting the lib to Mac

Here is just a brief list of files and changes I made which you/someone
would want to 
look at along with a few casting additions to remove compiling errors.

- HTInet.c:   HTGetTmpFileName() to handle mac specific tmp file issues
- HTWWWStr.c:  HTWWWToLocal() and HTLocalToWWW() to handle mac specifc
filename and URL mappings
- Here is my MACINTOSH section of wwwsys.h as well for you to see what
  additions I have made.

#ifdef __MWERKS__

/* Since GUSI/Mac uses unsigned longs for time funcs if we do not do
   this for libwww, they will get negative values from GUSI and Mac
   all over the place

typedef unsigned long time_t;
#define _TIME_T_DEFINED 

#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#include <netinet/in.h>
#include <arpa/inet.h>

#include <sys/types.h>

#include <dirent.h>
#include <errno.h>
#include <sys/errno.h>

#include <sioux.h>

#include <fcntl.h>
#include <netdb.h>

#include <sys/socket.h>
#include <sys/stat.h>


#define GUSI                    /* Identifies changes made for GUSI */

/* Is there a better general, non-MacOSX define to use? */

/* I would prefer to just some of these in a local wwwconf.h file
   such as autoconf generates for UNIX but for lagacy reasons leaving
   these Mac specific defines in this section for __MWERKS__


#define HT_EXPAT	1
#define HT_MD5 1
#define HT_ZLIB 1

/* Define to be the package name. */
#define W3C_PACKAGE "w3c-libwww"

/* Define to be the version. */
#define W3C_VERSION "5.3.2"

#undef  HAVE_GETDOMAINNAME      /* STR */
#undef  HAVE_GETWD

#define USE_DIRENT
#define NO_GROUPS
#define GOT_READ_DIR

#undef  HAVE_TIMEZONE           /* STR */
#define NO_GMTOFF

//#define SLEEP(n)        GUSIDefaultSpin( SP_SLEEP, n/60)

#define MKDIR(a,b)      mkdir(a)

#define HAVE_STRFTIME           // added JTD:5/1/96
#define HAVE_MKTIME             // added JTD:5/1/96
#define HAVE_STRCHR             // added JTD:5/1/96
#define STDC_HEADERS            // added JTD:5/1/96
#define HAVE_MEMCPY             // added JTD:5/1/96
#define TTY_IS_SELECTABLE       // added JTD:5/1/96
#define HAVE_READDIR            // added JTD:5/1/96
#define HAVE_DIRENT_INO         // added JTD:5/1/96
#define HAVE_DIRENT_H           // added JTD:5/1/96


#undef  XML_UNICODE  


Hope this helps,
I am happy with the current performance of my Mac libwww port using GUSI
and it certainly
does work as well as the Linux and Windows versions to get me the
cross-platform coding
I needed.  
Of course in the future, only supporting a MacOS X client port of libwww
will be infinitely easier...

Jeff Adams
Received on Wednesday, 21 March 2001 13:50:08 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:53 UTC