[net.unix-wizards] 4.2 source compatibility

stevesu@azure.UUCP (Steve Summit) (08/22/85)

I really like to try to keep my source code generic, with the
occasional machine/compiler/operating dependencies handled with
#ifdef's.  This is more-or-less possible in all cases I have come
across except for the stupid .h files that moved under 4.2.  (I
refer specifically to time.h and ndir.h .)  It simply isn't
possible to take the same file to a 4.2 machine and a non-4.2
machine and compile it without change.  I've been using -DBSD42
on the cc line, and putting it in CFLAGS in my makefiles, which
keeps the .c files generic, but requires me to keep different
makefiles on the different machines.

A PLEA TO BERKELEY (but it's probably too late for 4.3):
Please please please predefine some symbol or other in 4.2 and
later cpp's.  It would make life _s_o much easier...

                                         Steve Summit
                                         tektronix!bronze!stevesu

chris@umcp-cs.UUCP (Chris Torek) (08/23/85)

Actually, you probably mean <time.h> and <dir.h> (ndir.h doesn't
exist on many systems).  time.h is back in 4.3 (well, qualifier:
in the directory heirarchy on the alpha tape); it contains only
the non-kernel aspects of time things.  <sys/time.h> has the kernel-
related time code, and also includes <time.h> for you.

However, there's no <dir.h>, but this is easy enough for everyone to
fix by just doing "ln -s sys/dir.h /usr/include/dir.h".
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (08/23/85)

Hey!  People who need to use the directory access library routines
should not be using old-style direct reading of directory structures.
The two dir.h files are not interchangeable.

guy@sun.uucp (Guy Harris) (08/23/85)

> I really like to try to keep my source code generic, with the
> occasional machine/compiler/operating dependencies handled with
> #ifdef's.  This is more-or-less possible in all cases I have come
> across except for the stupid .h files that moved under 4.2.  (I
> refer specifically to time.h and ndir.h .) ...
> 
> A PLEA TO BERKELEY (but it's probably too late for 4.3):

I believe there is a <time.h> as well as a <sys/time.h> in 4.3 (yay!).  As
for <ndir.h>, I don't know which systems other than 4.[23] are distributed
with the directory library; the maintainers of those systems should 1) put
<ndir.h> or whatever into <dir.h> and 2) put the directory library routines
into the C library.  4.3 should then make <dir.h> a symlink to <sys/dir.h>
or something like that.  (We did both at CCI - the first in our V7/S3-based
system and the second in our 4.2-based system.)

	Guy Harris

guy@sun.uucp (Guy Harris) (08/25/85)

> Hey!  People who need to use the directory access library routines
> should not be using old-style direct reading of directory structures.
> The two dir.h files are not interchangeable.

I'd delete the clause "who need to use the directory access library
routines" from that statement.  Versions of the library routines which work
with pre-4.2BSD directories are available from several sources.  (And if any
code out there is assuming that directory entries read from a pre-4.2BSD
directory have null-terminated file names - as does some version of the S5R2
"ls", for instance - get fixed for free by being changed to use the
directory library.)