|
|
1.1 ! root 1: ! 2: ! 3: INSTALLATION INSTRUCTIONS ! 4: ! 5: ! 6: The following instructions are for systems resembling Ninth Edition UNIX, with ! 7: hints about dealing with variations you may encounter for your specific system. ! 8: Installation should be done only by someone who is comfortable with modifying ! 9: the standard C library and header files. ! 10: ! 11: If your system already includes directory access routines, you should replace ! 12: them with this package. We're trying to get this standardized; see the ! 13: discussion in the NOTES file. ! 14: ! 15: I have tried to make the source code as generic as possible, but if your system ! 16: predates Seventh Edition UNIX you will have problems. ! 17: ! 18: DISCLAIMER: Although I believe the code and procedures described here to be ! 19: correct, I make no warranty of any kind, and you are advised to perform your ! 20: own careful testing before making any substantial change like this to your ! 21: programming environment. ! 22: ! 23: ! 24: 0) For antique systems that do not support C's "void" data type, edit the file ! 25: sys.dirent.h to add the following: ! 26: ! 27: typedef int void; /* good enough for govt work */ ! 28: ! 29: If for some reason your <sys/types.h> doesn't define them, add the ! 30: following to sys.dirent.h: ! 31: ! 32: typedef unsigned short ino_t; /* (assuming original UFS) */ ! 33: typedef long off_t; /* long is forced by lseek() */ ! 34: ! 35: None of this should be necessary for any modern UNIX system. ! 36: ! 37: 1) Copy the file dirent.h to /usr/include/dirent.h and copy the file ! 38: sys.dirent.h to /usr/include/sys/dirent.h. (The file sys._dir.h is also ! 39: provided for the BRL UNIX System V emulation for 4.nBSD. That environment ! 40: uses different directory names for everything.) ! 41: ! 42: 2) Copy the file directory.3c to /usr/man/man3/directory.3 and copy the file ! 43: dirent.4 to /usr/man/man5/dirent.5; edit the new file ! 44: /usr/man/man3/directory.3 to change the "SEE ALSO" reference from dirent(4) ! 45: to dirent(5) and to change the 3C on the first line to 3; edit the new file ! 46: /usr/man/man5/dirent.5 to change the 4 on the first line to 5; then print ! 47: the manual pages via the command ! 48: ! 49: man directory dirent ! 50: ! 51: to see what the new routines are like. (If you have a "catman" style of ! 52: on-line manual, adapt these instructions accordingly. Manual entries are ! 53: kept in directories with other names on some systems such as UNIX System V. ! 54: On systems that already had a directory library documented in some other ! 55: manual entry, remove the superseded manual entry; if the description of the ! 56: native filesystem directory format found by "man dir" refers to a directory ! 57: library, modify it to simply refer to the entry for "dirent".) ! 58: ! 59: 3) Copy the files closedir.c, opendir.c, readdir.c, rewinddir.c, seekdir.c, ! 60: and telldir.c to the "gen" or "port/gen" subdirectory of your C library ! 61: source directory. If you do not have a getdents() system call, copy the ! 62: file getdents.c to the "sys" or "port/sys" subdirectory and copy the file ! 63: getdents.2 to /usr/man/man2/getdents.2 (actually you may prefer to put this ! 64: file in section 3 and adjust the references in the other manual entries ! 65: accordingly; also adjust the references to dirent(4) to be to dirent(5) if ! 66: that's where the entry is). Edit the C library makefile(s) to include the ! 67: new object modules in the C library. (See the comments at the beginning of ! 68: getdents.c for symbols that must be defined to configure getdents.c.) Then ! 69: remake and reinstall the C library. Alternatively, you can just compile ! 70: the new sources and insert their objects near the front of the C library ! 71: /lib/libc.a using the "ar" utility (seekdir.o should precede readdir.o, ! 72: which in turn should precede getdents.o). On some systems you then need to ! 73: use the "ranlib" utility to update the archive symbol table. ! 74: ! 75: 4) After the C library has been updated, delete /usr/include/ndir.h or any ! 76: other header used with a previous directory library to prevent inadvertent ! 77: use of the superseded directory access interface. Also delete any ! 78: corresponding library such as /usr/lib/libndir.a. ! 79: ! 80: 5) To verify installation, try compiling, linking, and running the program ! 81: testdir.c. This program searches the current directory "." for each file ! 82: named as a program argument and prints `"FOO" found.' or `"FOO" not found.' ! 83: where FOO is of course replaced by the name being sought in the directory. ! 84: Try something like ! 85: ! 86: cd /usr/bin # a multi-block directory ! 87: WHEREVER/testdir FOO lint BAR f77 XYZZY ! 88: ! 89: which should produce the output ! 90: ! 91: "FOO" not found. ! 92: "lint" found. ! 93: "BAR" not found. ! 94: "f77" found. ! 95: "XYZZY" not found. ! 96: ! 97: A more thorough test would be ! 98: ! 99: cd /usr/bin # a multi-block directory ! 100: WHEREVER/testdir `ls -a` | grep 'not found' ! 101: ! 102: This program does not test the seekdir() and telldir() functions. ! 103: ! 104: 6) Notify your programmers that all directory access must be made through the ! 105: new interface, and that documentation is available via ! 106: ! 107: man directory dirent ! 108: ! 109: Make the NOTES file available to those programmers who might want to ! 110: understand what this is all about. ! 111: ! 112: 7) Change all system sources that were accessing directories to use the new ! 113: routines. Nearly all such sources contain the line ! 114: ! 115: #include <sys/dir.h> ! 116: or ! 117: #include <ndir.h> ! 118: ! 119: so they should be easy to find. (If you earlier removed some other header ! 120: file, that is, if this package superseded an earlier version of the ! 121: directory access library, look for its name too. See the conversion ! 122: instructions in the NOTES file.)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.