Path: utzoo!utgpu!watmath!att!occrsh!uokmax!servalan!rmtodd From: rmtodd@servalan.uucp (Richard Todd) Newsgroups: news.software.b Subject: Re: Porting C News to MS-DOS? Summary: You wouldn't believe how nasty it could get... Message-ID: <1989Jul28.232622.1036@servalan.uucp> Date: 28 Jul 89 23:26:22 GMT References: <1143@mailrus.cc.umich.edu> Reply-To: rmtodd@servalan.UUCP (Richard Todd) Organization: Ministry of Silly Walks Lines: 62 In article <1143@mailrus.cc.umich.edu> mju@mudos.ann-arbor.mi.us (Marc Unangst) writes: >At any rate, I am curious how difficult it would be to port C News to >MS-DOS. I plan on using Turbo C 2.0, which is "mostly" UNIX compatable, >except for some things (such as signal(), which doesn't support all of >the UNIX signals), and, quite obviously, things that have no relevance >to a single-tasking system, such as fork(). I can speak with some authority on this subject. Back when C News Alpha was posted to the net a year or so back, I started work on trying to port it to my PC/XT. After several weeks of messing about with it, I gave up in disgust, having not been able to even get relaynews working. It's a good deal more difficult than it might look on the surface. >I realize that the absense of fork() may make porting C News difficult, >but since a fork() is very commonly almost immediately followed by an >exec(), and since Turbo C has a set of spawn() routines to spawn a >process, it shouldn't be that hard (although it'll probably be tedious). That's just one of the many things you have to diddle with. When you look into it, there are a lot of calles in Unix that you somehow have to deal with on MS-DOS. Some are relatively simple (e.g. getuid() -- just have it return some suitably plausible integer), some are not. Probably the nastiest one to deal with is link(). The MS-DOS filesystem just doesn't support giving multiple links (names) to the same file, and this feature is *repeatedly* used in C News (and B News, for that matter) to handle crossposted articles. The gross and ugly hack I used was to accumulate in an array the names of all the links the file was to have, then as the incoming article was processed accumulate it in a temp file, then at the end of article processing make copies of the article under all the destination filenames. Another problem I noticed, but never figured out a solution to, is this: On Unix time values are stored in a very simple format (seconds since midnight Jan 1,1970), and doing arithmetic on time values (figuring out, e.g. just what time value corresponds to "3 days ago") is trivial. Under MSDOS time values are more complex (an ugly mass of bitfields for day,week, month, hour, etc.) and doing arithmetic on these values is non-trivial. Expire, among other programs, depends heavily on being able to do this sort of arithmetic on time values. Never did figure out a solution for this one... More fun: Much of the guts of C News (programs like inews, the control message handlers, etc.) is done as shell scripts. While on a Unix system this is really cool, as shell scripts are easy to modify, on a DOS system you've got to somehow translate the shell scripts into C programs. And some of those shell scripts are rather complex.... Once you get all the stuff set up so that it will at least compile and link, they you get the joy of trying to debug it. Or, to be more exact, you end up debugging the compiler's code. As I recall, I gave up in disgust after finding over 10 separate places in relaynews alone where the compiler (Aztec C v4.1) had produced incorrect code. I've got better things to do with my time than debug somebody's compiler for them. The state of the art in PC compiler reliability may be better now than it was then, but I wouldn't bet on it. Some time back, I saw a posting on the net from somebody who claimed to have ported B News 2.11 to MS-DOS. He said it took him a year to do it. I can believe it. In summary: Trying to get netnews to run on a PC is like trying to teach a pig to sing; it wastes your time and annoys the pig. If you want to have your own netnews site, save your pennies and get yourself a real Unix box. Rumor has it you can pick up a 3b1 or 3b2 pretty cheap these days, and it'll be a whole lot easier to work with. -- Richard Todd rmtodd@uokmax.ecn.uoknor.edu rmtodd@chinet.chi.il.us rmtodd@servalan.uucp Motorola Skates On Intel's Head!