Problems Running Later Code on Vanilla V6 Backporting code from later Unix versions to V6 can be somewhat problematic. The issues can be divided into i) language issues, where the C language has changed; ii) system interface issues, and iii) other. Use of the new 'Typesetter' C compiler (available for V6) gives access to a more modern (but not fully modern) version of the language, with longs, etc but some issues (particularly in the system interface) remain. Language Issues The main issue is that V6 C is pretty archaic, and there are a number of places where the syntax is different from 'modern' C (or even later C's, like V7). Many of these can be fixed/avoided by use of the 'Typesetter' C compiler. Here are the ones I know of: - Things like "a =+ 2" does not now do what it used to back then, and the new compilers don't barf on it (as they do with things like "=|"). Many will probably cause a compiler error on a new compiler; the ones to search for (which _won't_ always give compiler errors) are "=+", "=-", "=*" and "=&" (I think that list is complete). And the vanilla V6 compiler is so old it doesn't recognize "+=", so one _has_ to write the old form. (One could write "a = a + 2", so the code would be portable across the V6/later boundary.) - Initializations don't have the '=' between the name and initializer. This shouldn't be a big problem; the compiler should barf on them. Again, one can't code around this - the V6 compiler only supports the older style. - V6 C is pretty promiscuous about types (especially pointers). So it's common to see things like: int *a; char *b; a = b; Again, most later compilers will notice this and bark at you. - V6 C doesn't support "register" storage class for arguments, so you will see foo(aip) int *aip; { register int *ip; ip = aip; all over the place. This is pretty harmless, although it takes a few extra characters. System Interface Issues Anything which relies on system headers (which is not just 'system' code like tar, etc, but also anything that does a 'stat' call) has to use the old formats. In particular, in V6 the stat block was a plain inode structure, and in V7, it's synthetic and different; e.g. the file size isn't a simple long in V6. To truly support stdio's functionality, one needs to add at least one new system call, lseek(). [Taking a long argument isn't the problem: the problem is that the tell() functionality just isn't available [AFAIK] in vanilla V6.] A few system calls have changed their arguments, but most of these can be worked around [code for many is given in the \src\libc\v6 directory on V7]: chown() - going to short UIDs from bytes means it's now three args execl() [although the arguments are the same, the V7 version uses a static external to find the environment], Some system calls don't exist in V7, and there are new ones. Removed: sleep() [replaced by a subr which calls alarm() and pause()] tiu() Added: alarm(), pause() utime() access() [which is done in a hacky way in the v6 replacement - doing it right would involve another new system call] ftime() tell() [already obsolete] sysacct() sysphys() syslock() ioctl() mpxchan() exece() umask() chroot() Some things are missing from the V6 stdio library: mktemp() Other Issues - If switching to the 'Typesetter C', one has to replace csv.s with the newer CSV, as the old one bashed r1 (used to return long values).