file_cmds-60.tar.gz
[apple/file_cmds.git] / file / PORTING
1 $NetBSD: PORTING,v 1.5 1998/09/20 15:27:15 christos Exp $
2 Portability of the new file(1) command.
3 @(#) Id: PORTING,v 1.11 1993/09/23 21:47:23 christos Exp 
4
5 Read this file only if the program doesn't compile on your system.
6
7 This release has been around UNIX; it has been compiled and tested
8 in the following environments:
9
10 SunOS sqarc 4.1.1 8 sun4
11         No problems.
12 ULTRIX squint 4.2 0 RISC
13         No problems.
14 A/UX sqmac 3.0a9 SVR22 mc68020
15         No problems.
16 AIX sqibm 2 3 000XXXXXX100
17         Had weird "make" problems making "magic" file automatically; just
18         built it by hand. Your mileage may vary.
19 SCO sqwang 3.2 2 i386
20         Compiles fine; their weird make can't handle "[a-z]*" as a dependancy,
21         so build magic by hand. Runs fine.
22 sqzme sqzme 3.1.1 3 3B2
23         The 3B2 SVR3 needed a few tweaks as well as COPTS = -Ilocalinc
24         in order to compile.
25
26 This version, reluctanly, includes <stdlib.h>, which won't exist
27 on older systems or those that aren't even close to the ANSI C
28 standard. There is a null "stdlib.h", and some other bogus headers,
29 in subdirectory "localinc"; if you get complaints about missing
30 stdlib.h and others, uncomment the line with COPTS=-Ilocalinc
31 in the Makefile, and try again.
32
33 You must have either <stdarg.h> or the older <varargs.h>, otherwise you'll
34 have to butcher some routines in print.c.
35
36 Beyond that, I have tried to make a program that doesn't need any
37 command-line defines (-D) to specify what version of UNIX is in use,
38 by using the definitions available in the system #include
39 files. For example, the lstat(2) call is normally found in
40 4BSD systems, but might be grafted into some other variant
41 of UNIX. If it's done right (ie., using the same definitions),
42 my program will compile and work correctly. Look at the #ifdefs
43 to see how it's done. 
44
45 I've also tried to include source for all the non-portable library routines
46 I used (getopt, str*).   Non-portable here means `not in every
47 reasonably standard UNIX out there: V7, System V, 4BSD'.
48 These are in subdirectory "localsrc", and not used unless you
49 need them; again, see the Makefile.
50
51 There is one area that just might cause problems. On System
52 V, they moved the definition of major() and minor() out of
53 <sys/types.h> into <sys/sysmacros.h>.  Hence, if major isn't
54 defined after including types.h, I automatically include sys/sysmacros.h.
55 This will work for 99% of the systems out there. ONLY if you
56 have a system in which  neither types.h nor sysmacros.h defines
57 `major' will this automatic include fail (I hope). On such
58 systems, you will get a compilation error in trying to compile
59 a warning message. Please do the following: 
60
61         1) change the appropriate #include at the start of fsmagic.c
62 and     2) let me know the name of the system, the release number,
63            and the name of the header file that *does* include
64            this "standard" definition.
65
66 If you are running the old Ritchie PDP-11 C compiler or
67 some other compiler that doesn't know about `void', you will have
68 to include `-Dvoid=int' in the variable COPTS in the Makefile.
69
70 Other than this, there should be no portability problems,
71 but one never knows these days. Please let me know of any
72 other problems you find porting to a UNIX system. I don't much
73 care about non-UNIX systems but will collect widely-used magic 
74 numbers for them as well as for UNIX systems.
75
76 Mark Moraes and Christos Zoulas
77 (address in README)