[comp.sys.mac.programmer] Suggestion for THINK C UNIX libs

jbr0@cbnews.att.com (joseph.a.brownlee) (09/10/90)

As some of you may know, I do a fair amount of porting of UNIX code to the Mac.
I use THINK C, and tend to give the UNIX libraries a real workout.  The
libraries actually hold up pretty well, but there are a couple of things that
I keep running into that are missing from the UNIX library, and I offer the
humble suggestion that the one described below might be considered for
inclusion in THINK C 5.x.

The one call I run into often and is stat() (and its sibling fstat()).  I
suggest that it be added to the library.  Now I know that all of the fields
returned by stat() under UNIX can't be precisely emulated.  However, they are
just as hard to emulate under MS-DOS, but MS-C still gives you these calls.
Granted, they return pre-determined values for some of the fields, such as
always returning 1 for the inode number, etc., but the values would appear
reasonable to a UNIX program being ported.  This allows you to at least compile
the code until you can determine what the desired semantics should actually be.

Of course, along with the stat() calls, the UNIX header files <stat.h> and
<types.h> would have to be available.

Anyway, for most ports, I have found that stat() is often called only to
determine whether a pathname is a file or directory, and I have been able to
deal with that quite easily.  But in my most recent porting effort, I have
found that several fields are used.  I am perfectly willing to write faked
stat() calls to give me the extra data, but I was wondering if anyone had
already done this.  If someone has and would be willing to pass along a copy,
I'd greatly appreciate it.  Otherwise, I'll dig in myself.

At any rate, though, I think this would be a nice addition to the THINK C
UNIX library.

P.S. -- It would be nice if there was a compile mode that would find all
        errors without stopping, too, but that's already been suggested.

-- 
   -      _   Joe Brownlee, Analysts International Corp. @ AT&T Network Systems
  /_\  @ / `  471 E Broad St, Suite 1610, Columbus, Ohio 43215   (614) 860-7461
 /   \ | \_,  E-mail: jbr@cblph.att.com     Who pays attention to what _I_ say?
 "Scotty, we need warp drive in 3 minutes or we're all dead!" --- James T. Kirk